Status of PEP's?

Jeff Hinrichs jlh at cox.net
Sun Mar 3 12:51:23 EST 2002


"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)

> Jeff Hinrichs <jlh at cox.net> wrote:
>
> > "Carel Fellinger" <cfelling at iae.nl> wrote in message
> > news:a5pmvd$fic$1 at animus.fel.iae.nl...
> >> Jeff Hinrichs <jlh at cox.net> wrote:
> >>
> >> > What you are asking everyone to agree with is:
> >> >         5 = [0,1,2,3,4]
> >>
> >> No he isn't:)  He explicitly says he doesn't think of sequences at all.
> > If it walks like a duck and talks like a duck...
> >   It's a duck.   How can one iterate over something that is not a
> > sequence/collection?
>
> This used to be the case in Python, but the invention of iterators
> has changed the landscape.  The for-construct no longer works on
> sequences, it works on iterable objects.
from the current docs: "The for statement is used to iterate over the
elements of a sequence (such as a string, tuple or list) or other iterable
object"
So sequences are not out the for construct has been augmented to include
iterable objects.

>So it's not right anymore
> to reject such a proposal based on that the thing isn't a sequence.
> You now must reject it if you feel the thing can't be iterated over.
> This may seem like a word play, but it isn't, it's a vital though
> subtle difference.  And it took me, being an old farth, quit some
> time to let it sink in.
Accepted.
<sidebar>
    Ok, so iterable vs. sequence.  iterable seems to mean "a sequence that
has been contrived."
</sidebar>
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] ?
if you get 5 then how can you get [0,1,2,3,4] in the, for i in 5: statement?
If the default property of an integer object as specified in the statement,
for i in 5: is to return the indici it would seem proper to return that OR
<5 at 007B5660> type statement that happens when you use the print statement
on objects.
if you print [0,1,2,3,4] or a string representation of an object pointer,
won't that shock and confuse many?  If integers are objects, would they not
then support dot notation?  How does that affect the parser?(5.property()
vs. 5.0 , Is it an integer object or a float)
Why only make integers objects?  Is there support for making all numbers
objects?  Integers, after all, are a subset of all numbers.

Shouldn't objects have to meet some of the same requirements that design
patterns meet? Namely, be applicable to more than a specific problem?  This
appears to be a unique request for only a certain subset of numbers.  If,
objectifying integers is good then shouldn't making all numbers objects be
better?

I hope that all take my questions as they are intended, as questions from
someone trying to learn.  I apologize for the number of questions, but only
by revealing my ignorance is there any hope for me<g>.

-Jeff






More information about the Python-list mailing list