I merely worry about what happens if people
> start relying upon the fact that a float annotation 'will handle all
> the numbers I care about' to the forgotten Decimal users such as
> myself.
Well, that's what you get in exchange for "type safety".
Which is exactly why I'm concerned about
Any chance of adding Decimal to the list of things that are also
acceptable for things annotated float?
Laura
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
Hey guys,
Could someone clarify for me why it is a good idea to have map return an
iterator
that is iterable multiple times and acts as an empty iterator in
subsequent iterations?
> r = range(10)
> list(r) == list(r)
True
> a=map(lambda x:x+1, [1,2,3])
> list(a) == list(a)
False
Wouldn't it
On Tue, 13 Oct 2015 14:59:56 +0300, Stefan Mihaila
wrote:
> Maybe it's just python2 habits, but I assume I'm not the only one
> carelessly thinking that "iterating over an input a second time will
> result in the same thing as the first time (or raise an error)".
"R. David Murray" writes:
> On Tue, 13 Oct 2015 14:59:56 +0300, Stefan Mihaila
> wrote:
>> Maybe it's just python2 habits, but I assume I'm not the only one
>> carelessly thinking that "iterating over an input a second time will
>> result in
> On Oct 13, 2015, at 4:21 AM, Laura Creighton wrote:
>
> Any chance of adding Decimal to the list of things that are also
> acceptable for things annotated float?
>From Lib/numbers.py:
## Notes on Decimal
##
## Decimal has all of the methods specified by the
On Tue, Oct 13, 2015 at 10:26 AM, Random832 wrote:
> "R. David Murray" writes:
>
>> On Tue, 13 Oct 2015 14:59:56 +0300, Stefan Mihaila
>> wrote:
>>> Maybe it's just python2 habits, but I assume I'm not the only one
>>>
On Tue, 13 Oct 2015 11:26:09 -0400, Random832 wrote:
> "R. David Murray" writes:
>
> > On Tue, 13 Oct 2015 14:59:56 +0300, Stefan Mihaila
> > wrote:
> >> Maybe it's just python2 habits, but I assume I'm not the only one
"R. David Murray" writes:
> On Tue, 13 Oct 2015 11:26:09 -0400, Random832 wrote:
>> It does raise the question though of what working code it would actually
>> break to have "exhausted" iterators raise an error if you try to iterate
>> them again
In a message of Tue, 13 Oct 2015 08:38:07 -0700, Raymond Hettinger writes:
>
>
>> On Oct 13, 2015, at 4:21 AM, Laura Creighton wrote:
>>
>> Any chance of adding Decimal to the list of things that are also
>> acceptable for things annotated float?
>
>>From Lib/numbers.py:
>
>##
On Wed, Oct 14, 2015 at 3:49 AM, Random832 wrote:
> My theory is that most circumstances under which this would cause a
> RuntimeError are indicative of a bug in the algorithm consuming the
> iterator (for example, an algorithm that hasn't considered iterators and
>
On Wed, Oct 14, 2015 at 3:08 AM, Random832 wrote:
> If you are writing code that tries
> to resume iterating after the iterator has been exhausted, I have to
> ask: why?
A well-behaved iterator is supposed to continue raising StopIteration
forever once it's been
> From Lib/numbers.py:
>
> ## Notes on Decimal
> ##
> ## Decimal has all of the methods specified by the Real abc, but it should
> ## not be registered as a Real because decimals do not interoperate with
> ## binary floats (i.e. Decimal('3.14') + 2.71828 is undefined). But,
> ##
Chris Angelico writes:
> A well-behaved iterator is supposed to continue raising StopIteration
> forever once it's been exhausted.
Yes, and that is *precisely* the behavior that causes the problem under
discussion. My question was what code depends on this.
> Play with that,
On Tue, Oct 13, 2015 at 8:26 AM, Random832 wrote:
> "R. David Murray" writes:
>
>> On Tue, 13 Oct 2015 14:59:56 +0300, Stefan Mihaila
>> wrote:
>>> Maybe it's just python2 habits, but I assume I'm not the only one
>>>
On Tue, 13 Oct 2015 12:08:12 -0400, Random832 wrote:
> "R. David Murray" writes:
> > On Tue, 13 Oct 2015 11:26:09 -0400, Random832
> > wrote:
> >
> > And the answer to the question is: lots of code. I've written some:
> >
On 13.10.2015 17:38, Raymond Hettinger wrote:
Traceback (most recent call last):
File "", line 1, in
Decimal('3.14') + 2.71828
TypeError: unsupported operand type(s) for +: 'decimal.Decimal' and 'float'
Reminds me of 'int' and 'long'. Different but almost the same.
Best,
Steven D'Aprano writes:
> On Tue, Oct 13, 2015 at 04:37:43PM -0700, Raymond Hettinger wrote:
>
>> We could have (and still could) make the choice to always coerce to
>> decimal (every float is exactly representable in decimal). Further,
>> any decimal float or binary
On 10/13/2015 7:59 AM, Stefan Mihaila wrote:
Could someone clarify for me ...
This list, pydev, short for 'python development', is for discussing
development of future releases of CPython. Your question should have
been directed to python-list, where it would be entirely on topic.
--
On Tue, Oct 13, 2015 at 04:37:43PM -0700, Raymond Hettinger wrote:
> We could have (and still could) make the choice to always coerce to
> decimal (every float is exactly representable in decimal). Further,
> any decimal float or binary float could be losslessly coerced to a
> Fraction, but
On Tue, Oct 13, 2015 at 11:26:09AM -0400, Random832 wrote:
> "R. David Murray" writes:
>
> > On Tue, 13 Oct 2015 14:59:56 +0300, Stefan Mihaila
> > wrote:
> >> Maybe it's just python2 habits, but I assume I'm not the only one
> >> carelessly
On 14 October 2015 at 09:59, Steven D'Aprano wrote:
> On Tue, Oct 13, 2015 at 11:26:09AM -0400, Random832 wrote:
>> "R. David Murray" writes:
>>
>> > On Tue, 13 Oct 2015 14:59:56 +0300, Stefan Mihaila
>> > wrote:
>> >> Maybe
> On Oct 13, 2015, at 9:16 AM, Random832 wrote:
>
>> ##
>> ## Decimal has all of the methods specified by the Real abc, but it should
>> ## not be registered as a Real because decimals do not interoperate with
>> ## binary floats (i.e. Decimal('3.14') +
23 matches
Mail list logo