Re: A Revised Rational Proposal

2004-12-28 Thread Mike Meyer
"John Roth" <[EMAIL PROTECTED]> writes: > "Mike Meyer" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Nick Coghlan <[EMAIL PROTECTED]> writes: >> >>> Mike Meyer wrote: Yup. Thank you. This now reads: Regarding str() and repr() behaviour, repr() will be either ''rat

Re: A Revised Rational Proposal

2004-12-27 Thread John Roth
"Mike Meyer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Nick Coghlan <[EMAIL PROTECTED]> writes: Mike Meyer wrote: Yup. Thank you. This now reads: Regarding str() and repr() behaviour, repr() will be either ''rational(num)'' if the denominator is one, or ''rational(num, denom)'' i

RE: A Revised Rational Proposal

2004-12-27 Thread Batista, Facundo
Title: RE: A Revised Rational Proposal [Mike Meyer] #- I don't think so, as I don't see it coming up often enough to warrant #- implementing. However, Rational("x" / "y") will be an acceptable #- string format as fallout from accepting floating point string

Re: A Revised Rational Proposal

2004-12-27 Thread Mike Meyer
Skip Montanaro <[EMAIL PROTECTED]> writes: > Mike> ... or making them old-style classes, which is discouraged. > > Since when is use of old-style classes discouraged? I was under the imperssion that old-style classes were going away, and hence discouraged for new library modules. However, a

Re: A Revised Rational Proposal

2004-12-27 Thread Mike Meyer
Nick Coghlan <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> Yup. Thank you. This now reads: >> Regarding str() and repr() behaviour, repr() will be either >> ''rational(num)'' if the denominator is one, or ''rational(num, >> denom)'' if the denominator is not one. str() will be either ''num''

Re: A Revised Rational Proposal

2004-12-27 Thread Steve Holden
Skip Montanaro wrote: Mike> ... or making them old-style classes, which is discouraged. Since when is use of old-style classes discouraged? Well, since new-style classes came along, surely? I should have thought the obvious way to move forward was to only use old-style classes when their inco

Re: A Revised Rational Proposal

2004-12-27 Thread Skip Montanaro
Mike> ... or making them old-style classes, which is discouraged. Since when is use of old-style classes discouraged? Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: A Revised Rational Proposal

2004-12-27 Thread Steve Holden
Dan Bishop wrote: Steven Bethard wrote: Dan Bishop wrote: Mike Meyer wrote: PEP: XXX I'll be the first to volunteer an implementation. Very cool. Thanks for the quick work! For stdlib acceptance, I'd suggest a few cosmetic changes: No problem. """Implementation of rational arithmetic.""" [Yards o

RE: A Revised Rational Proposal

2004-12-27 Thread Batista, Facundo
Title: RE: A Revised Rational Proposal [Dan Bishop] #- * Binary operators with one Rational operand and one float or Decimal #- operand will not raise a TypeError, but return a float or Decimal. I think this is a mistake. Rational should never interact with float. #- * Expressions of

RE: A Revised Rational Proposal

2004-12-27 Thread Batista, Facundo
Title: RE: A Revised Rational Proposal [Dan Bishop] #- I disagree with raising a TypeError here.  If, in mixed-type #- expressions, we treat ints as a special case of rationals, it's #- inconsistent for rationals to raise TypeErrors in situations #- where int #- doesn't. I thin

RE: A Revised Rational Proposal

2004-12-27 Thread Batista, Facundo
Title: RE: A Revised Rational Proposal [Mike Meyer] #- When combined with a floating type - either complex or float - or a #- decimal type, the result will be a TypeError.  The reason for this is #- that floating point numbers - including complex - and decimals are #- already imprecise.  To

Re: A Revised Rational Proposal

2004-12-27 Thread Nick Coghlan
Mike Meyer wrote: Yup. Thank you. This now reads: Regarding str() and repr() behaviour, repr() will be either ''rational(num)'' if the denominator is one, or ''rational(num, denom)'' if the denominator is not one. str() will be either ''num'' if the denominator is one, or ''(num / denom)'' if the d

Re: A Revised Rational Proposal

2004-12-26 Thread Steven Bethard
Mike Meyer wrote: "John Roth" <[EMAIL PROTECTED]> writes: I'd suggest making them public rather than either protected or private. There's a precident with the complex module, where the real and imaginary parts are exposed as .real and .imag. This isn't addressed in the PEP, and is an oversight on

Re: A Revised Rational Proposal

2004-12-26 Thread Mike Meyer
Nick Coghlan <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> Regarding str() and repr() behaviour, Ka-Ping Yee proposes that repr() have >> the same behaviour as str() and Tim Peters proposes that str() behave like >> the >> to-scientific-string operation from the Spec. > > This looks like a C

Re: A Revised Rational Proposal

2004-12-26 Thread Mike Meyer
"John Roth" <[EMAIL PROTECTED]> writes: > I'd suggest making them public rather than either protected or > private. There's a precident with the complex module, where > the real and imaginary parts are exposed as .real and .imag. This isn't addressed in the PEP, and is an oversight on my part. I'

Re: A Revised Rational Proposal

2004-12-26 Thread Mike Meyer
"Dan Bishop" <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> This version includes the input from various and sundry people. > Thanks >> to everyone who contributed. >> >>> >> PEP: XXX >> Title: A rational number module for Python > ... >> Implementation >> == >> >> There is cur

Re: A Revised Rational Proposal

2004-12-26 Thread Nick Coghlan
Dan Bishop wrote: Mike Meyer wrote: This version includes the input from various and sundry people. Thanks to everyone who contributed. PEP: XXX Title: A rational number module for Python ... Implicit Construction - When combined with a floating type - either complex or float

Re: A Revised Rational Proposal

2004-12-26 Thread Nick Coghlan
Mike Meyer wrote: Regarding str() and repr() behaviour, Ka-Ping Yee proposes that repr() have the same behaviour as str() and Tim Peters proposes that str() behave like the to-scientific-string operation from the Spec. This looks like a C & P leftover from the Decimal PEP :) Otherwise, looks good.

Re: A Revised Rational Proposal

2004-12-26 Thread Dan Bishop
Steven Bethard wrote: > Dan Bishop wrote: > > Mike Meyer wrote: > >> > >>PEP: XXX > > > > I'll be the first to volunteer an implementation. > > Very cool. Thanks for the quick work! > > For stdlib acceptance, I'd suggest a few cosmetic changes: No problem. """Implementation of rational arithmet

Re: A Revised Rational Proposal

2004-12-26 Thread John Roth
"Steven Bethard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Dan Bishop wrote: Mike Meyer wrote: PEP: XXX I'll be the first to volunteer an implementation. Very cool. Thanks for the quick work! For stdlib acceptance, I'd suggest a few cosmetic changes: Use PEP 257[1] docstring con

Re: A Revised Rational Proposal

2004-12-26 Thread Steven Bethard
Dan Bishop wrote: Mike Meyer wrote: PEP: XXX I'll be the first to volunteer an implementation. Very cool. Thanks for the quick work! For stdlib acceptance, I'd suggest a few cosmetic changes: Use PEP 257[1] docstring conventions, e.g. triple-quoted strings. Use PEP 8[2] naming conventions, e.g. na

Re: A Revised Rational Proposal

2004-12-26 Thread Dan Bishop
Dan Bishop wrote: > Mike Meyer wrote: > > This version includes the input from various and sundry people. > Thanks > > to everyone who contributed. > > > > > > > PEP: XXX > > Title: A rational number module for Python > ... > > Implementation > > == > > > > There is currently a rati

Re: A Revised Rational Proposal

2004-12-26 Thread Dan Bishop
Mike Meyer wrote: > This version includes the input from various and sundry people. Thanks > to everyone who contributed. > > > PEP: XXX > Title: A rational number module for Python ... > Implementation > == > > There is currently a rational module distributed with Python, and a >

Re: A Revised Rational Proposal

2004-12-26 Thread John Roth
"Dan Bishop" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Mike Meyer wrote: This version includes the input from various and sundry people. Thanks to everyone who contributed. PEP: XXX Title: A rational number module for Python ... Implicit Construction - Whe

Re: A Revised Rational Proposal

2004-12-26 Thread Dan Bishop
Mike Meyer wrote: > This version includes the input from various and sundry people. Thanks > to everyone who contributed. > > > PEP: XXX > Title: A rational number module for Python ... > Implicit Construction > - > > When combined with a floating type - either complex or fl