More random python observations from a perl programmer

Greg Ewing greg.ewing at compaq.com
Mon Aug 23 00:50:13 EDT 1999


Tom Christiansen wrote:
> Michael Hudson <mwh21 at cam.ac.uk> writes:
> :Well, no. How would you like to pass a tuple to a function?
> 
> I'd like using
> 
>     fn(t)
> 
> and then the function deciding whether it got enoguh arguments.

Personally I think it's a Good Thing that one
expression always maps onto one argument. It
saves potential confusion. Consider:

   def fred(a, b, c=None):

i.e. the third argument is optional. Now would
you like

   fred(1, (2, 3))

to mean fred(1, 2, 3) or fred(1, (2, 3), None)?

> No, that's not it.  Perl's hex takes a hex number and returns
> a decimal one; same with oct.  Python's is the reverse.  Very weird.

Different, certainly, and something a Perl programmer
needs to be made aware of. But one way isn't objectively
"weirder" than the other that I can see.

> Order is irrelevant.  You seem to be equating slicing with ranges.

The term "slice" seems to mean different things to
Perl and Python people. Perhaps we need to talk
about perl_slices and python_slices?

> That sounds like religion.  And aren't bound methods inherent
> memory leaks?

Only if you make cyclic data structures out of them,
but there are plenty of other ways to to that.

Greg




More information about the Python-list mailing list