Re: float("nan") in set or as key

2011-05-29 Thread Steven D'Aprano
On Mon, 30 May 2011 12:53:59 +1000, Chris Angelico wrote: > Okay, here's a question. The Python 'float' value - is it meant to be "a > Python representation of an IEEE double-precision floating point value", Yes. > or "a Python representation of a real number"? No. Floats are not real numbers

Re: scope of function parameters

2011-05-29 Thread Steven D'Aprano
On Mon, 30 May 2011 11:31:33 +1000, Ben Finney wrote: > Steven D'Aprano writes: > >> http://mail.python.org/pipermail/tutor/2010-December/080505.html >> >> >> Constructive criticism welcome. > > Informative, but it “buries the lead” as our friends in the press corps > would say. Thank you, tha

Re: float("nan") in set or as key

2011-05-29 Thread John Nagle
On 5/29/2011 9:15 PM, Steven D'Aprano wrote: On Mon, 30 May 2011 11:14:58 +1000, Chris Angelico wrote: So, apart from float("nan"), are there actually any places where real production code has to handle NaN? Yes. I used to write dynamic simulation engines. There were situations that prod

Re: Class decorators might also be super too

2011-05-29 Thread Raymond Hettinger
On May 28, 11:33 pm, Michele Simionato wrote: > He is basically showing that using mixins for implementing logging is not > such a good idea, i.e. you can get the same effect in a better way by making > use of other Python features. I argued the same thing many times in the past. > I even wrote

Re: float("nan") in set or as key

2011-05-29 Thread Chris Torek
In article <[email protected]>, Steven D'Aprano wrote: >That's also completely wrong. The correct way to test for a NAN is with >the IEEE-mandated function isnan(). The NAN != NAN trick is exactly that, >a trick, used by programmers when their language or compi

Re: float("nan") in set or as key

2011-05-29 Thread Raymond Hettinger
On May 28, 4:41 pm, MRAB wrote: > Here's a curiosity. float("nan") can occur multiple times in a set or as > a key in a dict: Which is by design. NaNs intentionally have multiple possible instances (some implementations even include distinct payload values). Sets and dicts intentionally recogni

Re: 3.1.4 release candidate 1

2011-05-29 Thread Raymond Hettinger
On May 29, 3:44 pm, Benjamin Peterson wrote: > On behalf of the Python development team, I'm happy as a swallow to announce a > release candidate for the fourth bugfix release for the Python 3.1 > series, Python > 3.1.4. The Pi release of Python :-) Raymond P.S. For the most part, if you have

[ANN] PyYAML-3.10: YAML parser and emitter for Python

2011-05-29 Thread Kirill Simonov
Announcing PyYAML-3.10 A new bug fix release of PyYAML is now available: http://pyyaml.org/wiki/PyYAML Changes === * Do not try to build LibYAML bindings on platforms other than CPython (Thank to olt(at)bogosoft(dot)com). * Clear cy

Re: float("nan") in set or as key

2011-05-29 Thread Chris Torek
In article I wrote, in part: >_inf = float("inf") >def isinf(x): >return x == _inf >del _inf Oops, take out the del, or otherwise fix the obvious problem, e.g., perhaps: def isinf(x): return x == isinf._inf isinf._inf = float("inf") (Of course, if something l

Re: float("nan") in set or as key

2011-05-29 Thread Steven D'Aprano
On Mon, 30 May 2011 04:29:19 +, Chris Torek wrote: > In article <[email protected]>, Steven > D'Aprano wrote: >>That's also completely wrong. The correct way to test for a NAN is with >>the IEEE-mandated function isnan(). The NAN != NAN trick is exactly >>th

Re: float("nan") in set or as key

2011-05-29 Thread Steven D'Aprano
On Mon, 30 May 2011 04:15:11 +, Steven D'Aprano wrote: > On Mon, 30 May 2011 11:14:58 +1000, Chris Angelico wrote: > >> So, apart from float("nan"), are there actually any places where real >> production code has to handle NaN? I was unable to get a nan by any of >> the above methods, except

<    1   2