Question About Creating Lists

Steve Holden steve at holdenweb.com
Fri Apr 13 09:11:14 EDT 2007


Scott wrote:
> 
>> Please forgo the psychological self analysis from your future posts.
> 
> Unfortunately I can't, that's how I am, love it or leave it.  But if your 
> going to be condescending about it, please leave your future replies in your 
> outbox.  Now don't take that as I don't appreciate your reply.  I just don't 
> appreciate the tone of that statement. I wouldn't say something about your 
> pseudonym possibly making up for some personal deficiency only because it 
> wouldn't be right. Email etiquette is a beautiful thing.
> 
And that's a really sideways way to take a swipe at someone while 
pretending to be too high-minded to do it (plus see James's comments 
about other possible explanations). If you kiddies would take this fight 
out into the playground perhaps the rest of the class can continue.

It *would* be helpful if you "just asked the question". You said in your 
original post that "... I need to know the petty just because I need to 
know", but that's an abuse of the word need unless you suffer from a 
quite unusual psychological compulsion.

Another psychological compulsion, of course, is the inability to ignore 
the irrelevant in other people's posts. The two apparently don't combine 
well.

> And I'm sorry if you didn't mean it that way, but that's the way it read.
> 
To you. Get over it, this is Usenet. You will experience worse if you 
stick at it long enough.

>> I don't think your question has anything to do with lists.  Maybe this
>> will help: there is a distinction between what are called "literals"
>> and "variables".
> 
> My question was in fact about lists and their proper "syntax" (I'm guessing 
> that's the right word). Basically all I was asking was if I had the idea 
> down or not, which was meant to be implied when I wrote: Am I safe in 
> assuming....
> 
> Maybe I didn't write it the exact way to get the response I needed, and if 
> it read differently I'm sorry. But that's all I was asking. 
> 
> 
You can't really separate the syntax of lists from the syntax of the 
rest of Python. Maybe you didn't mean syntax, it's hard to know. There 
are, as has been pointed out, names and values. Names are references to 
values. So after you say

five = 5

the following conditions are true:

[1, 2, 3, 4, 5] == [1, 2, 3, 4, five]
[1, 2, 3, 4, 'five'] != [1, 2, 3, 4, five]

Then execute

five = 'five'

and the truth value of both conditions flips, so the first is false and 
the second is true.

The value referenced by the name five changes as new values are assigned 
(in Python we tend to prefer to say "bound", to remind us that names are 
really references) to it. The values represented by the literals 5 and 
'five' will never change.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb     http://del.icio.us/steve.holden
Recent Ramblings       http://holdenweb.blogspot.com




More information about the Python-list mailing list