Assignment to slice
jcarlson at uci.edu
Wed Jan 21 22:09:52 CET 2004
> Instead python will just tack stuff on to the front of
> the array. Which, I still believe, is totally
> inconsistent. But what do I know? I have about 5
> minutes of python experience.
> Oh well. Maybe my problem is that I'm using perl as my
> model of consistency. Plus, it's a minor issue anyway.
> I just need to be aware of it, and not try to write
> perl code in python. I need to learn to write python
> code in python.
There are a few choices that one can make when allowing slice reading
and writing in sequences. Python made one: never cause an exception for
integer arguments, and certain indices map to the same location. Perl
made another: extend the sequence if necessary to fill it out.
Both are consistant and predictable. Python does it one way, Perl does
it another. Heck, Python has variable definitions that are done one way,
Perl has variable definitions that are done another. They were choices
made during the creation that fit a paradigm.
Expecting Python to behave like Perl is like expecting your mother to
pee standing up; without alteration, it's not gonna happen.
More information about the Python-list