Status of PEP's?

Carel Fellinger cfelling at iae.nl
Sun Mar 3 16:55:30 EST 2002


Jeff Hinrichs <jlh at cox.net> wrote:

> "Carel Fellinger" <cfelling at iae.nl> wrote in message
> news:a5ro01$b3u$1 at animus.fel.iae.nl...
>> How strange the world is, I now end up defending a proposal I'm
>> against (or was against, I'm still in dubio)
> Sometimes it is easier to reach the truth by arguing against your
> position.(i.e. devil's advocate)

Yep. E.g. I didn't get why negative numbers where excluded, so I
enhanced the proposal in a way that seemed logical and straightforward
to me.  Then Emile came to dampen my new found joy pointing out that
there were other ligitemate interpretations for negeative integers in
the for construct if you kept an eye on slice notation.

So maybe my enhancement turns out to be a counter argument in
disguise.  The fact that it doesn't work well with negative integers
surely looks like a show stopper to me.  We could ofcourse decide,
like Guido did in the key versus item debat for iter(dict), that
the `count down' meaning is the one to use, but I doubt it would be
a good decision.  But then who cares, I'm no language designer.




> but continued reading states that, "The expression list is evaluated once;
> it should yield a sequence."
> So what is the [0,1,2,3,4] returned by the 5 in, for i in 5: , called? (I
> realized it's generated by iterable object)The indici?

> I'm still trying to understand so bare with me...
> So if we say that, for i in 5:  has the same result as, for i in range(5):
> then what happens, if python adopts this idea, when you try:
>>>>print 5
> do you get 5 or [0,1,2,3,4] ?

`for i in 5' and `range(5)' both yield the same result, but achieve
this via a different route.  `for i in 5' is transformed by the
interpreter to `for i in iter(5)'.  This transformation is triggered
by the `in' keyword, and as there is no `in' keyword in that print
statement, no transformation takes place, and 5 remains 5.


> Why only make integers objects?  Is there support for making all numbers
> objects?  Integers, after all, are a subset of all numbers.

They already are:)

-- 
groetjes, carel



More information about the Python-list mailing list