[issue4998] __slots__ on Fraction is useless

2009-02-12 Thread Mark Dickinson
Mark Dickinson added the comment: Merged (manually) to py3k in r69547; svnmerged to 3.0 and 2.6 in r69548, r69549. -- status: open -> closed ___ Python tracker ___

[issue4998] __slots__ on Fraction is useless

2009-02-12 Thread Mark Dickinson
Mark Dickinson added the comment: This needs to be merged before 3.0.1 goes out. I can't do it right now since I don't have ssh access; will do it when I get home if no-one beats me to it. -- priority: critical -> release blocker ___ Python tracker

[issue4998] __slots__ on Fraction is useless

2009-01-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks Mark. Fixed in r68819 . ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue4998] __slots__ on Fraction is useless

2009-01-20 Thread Mark Dickinson
Mark Dickinson added the comment: BTW, Raymond, it looks as though your earlier commit, r68799, changed distutils/command/wininst-8.0.exe. Was that deliberate? ___ Python tracker ___ __

[issue4998] __slots__ on Fraction is useless

2009-01-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: Fixed in the trunk: r68813. Benjamin, can you please apply to 2.6, 3.0 and 3.1. -- assignee: rhettinger -> benjamin.peterson resolution: -> fixed ___ Python tracker __

[issue4998] __slots__ on Fraction is useless

2009-01-20 Thread Mark Dickinson
Mark Dickinson added the comment: Got it. Thanks, Jeffrey. The patch looks good to me---please go ahead and apply. -- assignee: marketdickinson -> rhettinger ___ Python tracker __

[issue4998] __slots__ on Fraction is useless

2009-01-20 Thread Jeffrey Yasskin
Jeffrey Yasskin added the comment: Rational has default definitions for some of its methods and properties. If Fraction inherits from Rational, it gets those definitions implicitly. If it's registered with Rational, it has to define them itself. I don't know that much about __slots__ (or I'd ha

[issue4998] __slots__ on Fraction is useless

2009-01-20 Thread Mark Dickinson
Mark Dickinson added the comment: Thanks for the patch, Raymond. I'm don't really have any experience with ABCs. I've read the PEP (a few times), but am not convinced that I fully understand all the ideas involved. What are the practical differences between having Fraction inherit from Rat

[issue4998] __slots__ on Fraction is useless

2009-01-20 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: jyasskin -> marketdickinson keywords: +patch priority: release blocker -> critical type: -> behavior versions: +Python 2.6, Python 2.7, Python 3.1 Added file: http://bugs.python.org/file12810/fractions.diff ___

[issue4998] __slots__ on Fraction is useless

2009-01-20 Thread Mark Dickinson
Mark Dickinson added the comment: > ~44 bytes per Decimal on average with __slots__ > ~183 bytes per Decimal on average without __slots__ ...and of course a difference of 140 bytes shouldn't really be much of a surprise: Python 3.1a0 (py3k:68809M, Jan 20 2009, 16:55:13) [GCC 4.0.1 (Apple Inc.

[issue4998] __slots__ on Fraction is useless

2009-01-20 Thread Mark Dickinson
Mark Dickinson added the comment: A random data point: just for fun, I just tried assessing the impact of __slots__ on Decimal instances, by the crude method of putting all of the Decimal instances that are created during a complete run of the Decimal test suite (over 10 of them) into a

[issue4998] __slots__ on Fraction is useless

2009-01-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: Fixed the decimal issue in r68800 and r68799 . Still needs a fix to Fractions, preferably adding an empty __slots__ to all levels of numbers.py. ___ Python tracker _

[issue4998] __slots__ on Fraction is useless

2009-01-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: Py3.0.1 should not go out without this being fixed. -- priority: critical -> release blocker ___ Python tracker ___ _

[issue4998] __slots__ on Fraction is useless

2009-01-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: For the Fractions issue, consider adding an empty __slots__ declaration to every level in numbers.py. That will preclude unintended dictionary creation for anything inheriting from the numbers abcs. We should also be an issue for the other abcs. The collec

[issue4998] __slots__ on Fraction is useless

2009-01-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: Arghh! Decimal is NOT supposed to inherit or register with numbers. Guido has pronounced on this and we've discussed it multiple times. See the comments in numbers.py which were supposed to serve as a reminder. Decimals are not interoperable with floats

[issue4998] __slots__ on Fraction is useless

2009-01-19 Thread Mark Dickinson
Mark Dickinson added the comment: The Decimal class has the same issue in py3k (but not in the trunk). ___ Python tracker ___ ___ Python-bugs-l

[issue4998] __slots__ on Fraction is useless

2009-01-19 Thread Mark Dickinson
Mark Dickinson added the comment: I believe that __slots__ was used for performance (memory, speed) reasons here rather than for preventing random attribute assignments. But maybe inheriting from Rational invalidates those reasons as well... -- nosy: +marketdickinson ___

[issue4998] __slots__ on Fraction is useless

2009-01-19 Thread Benjamin Peterson
Benjamin Peterson added the comment: The problem is that Fraction inherits from a class without __slots__ (Rationale), so it's useless. I suggest that the __slots__ be removed or Rationale.register() is used instead of inheritance. -- assignee: -> jyasskin nosy: +benjamin.peterson, jya