about sort and dictionary

rurpy at yahoo.com rurpy at yahoo.com
Thu Nov 24 01:44:45 CET 2005

Magnus Lycka wrote:
> rurpy at yahoo.com wrote:
> > a reminder" that the change is inplace.  How arrogant!  While
> > I'm sure the designers had kindly intentions. my memory, though
> > bad, is not that bad, and I object to being forced to write code
> > that is more clunky than need be, because the designers thought
> > they needed to help me with my memory.
> Such as being arm-twisted into writing horrible things
> like x = sorted(l) instead of x = l.sort()?

The first statement is not the same as the second.

> It sounds a
> bit as if someone locked you into a cellar and forced
> you to program Python, just to torture you. I guess the
> next step will be the comfy armchair! ;)
> Python has its roots in ABC, a language intended for
> teaching programming to beginners, and it goes to great
> lengths to make it easy to do things right. In my opinion,

"do things right" is my fundamental beef with Python.
Dispite claims, I don't believe Python's designers have
a monopoly on the definition of "right".

> it also avoids the mistake of introducing hurdles in a
> vain attempts to prevent programmer mistakes. Such hurdles
> typically lead to ugly workarounds. There are a few cases
> when things don't work as some people would expect them
> to work, but I think there are good resons for that.
> I'm surprised that you don't complain about not being able
> to do "while x = f(): ..." while you're at it. That's also
> a restriction of the kind you seem to rebel against.

I would have but fortunately the introduction of iterators
spared you from having to read about that :-)

> I'm pretty sure Guido didn't think a bit about *your*
> memory capacity when he designed Python, but rather wanted
> to avoid spending his and other programmers' time on helping
> people with yet another set of silly bugs.

I serious doubt sort's return value of lack thereof made any
measurable difference in the time spent helping people.

> > There is much about Perl's rich functionality that is very worthy.
> > Unfortunately, as you know, it's syntax leaves a lot to be desired.
> Which is mainly a consequence of TMTOWTDI...

> If you want something more perlish, but with somewhat more
> sane syntax, you might want to try Ruby.

More information about the Python-list mailing list