append to non-existing list

bruno at modulix onurb at xiludom.gro
Wed Nov 9 14:45:52 EST 2005


Yves Glodt wrote:
(snip)
> 
> ok I see your point, and python's...
> 
> (just FYI, and not to start a flamewar ;-):
> In php, the [] means "append to an array object".

yes, I know this.

> If the array does not exist yet, it's created.

Which is what I don't like. It should crash.

> [] *is* explicit for
> arrays, 

IIRC, you can also use it to sbscript strings, but I wouldn't bet my
life on this.

> thus for php it's clear what you want.)

Nope. You may be in the case where you think the array already exists,
and then you (well, I at least...) would prefer that PHP don't try to
second-guess you... If and when I want to create an object, I tell it.
If I dont tell "create me an array", I don't want one to come in existence.

(snip)
> an "undefined" notice, yes, not a warning... ;-)
> 
(snip)
>
> Ok... I thank you for all the explanations.
> 
> It helps me to see more far. I (and will continue to) use php for web,
> and wanna standardize on python for all non-web stuff we are doing, 

You might discover that Python is just great for web programming too !-)

> so I
> might be a frequent guest on this list...

You're welcome !-)
And if you're a french speaker, there's also french-speaking mailing
list and newsgroups.


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list