Why python doesn't use syntax like function(,,x) for default parameters?

A

Antoon Pardon

Op 2006-03-10 said:
Actually, I consider the unique calling pattern for x/range to be something
of a wart. Learning this inconsistency was at least a minor problem. It
is a rather extreme example of typing laziness beats purity.

Well then we can at least agree on that.
Given that enumerate() eliminate many uses of range(), it might be worth
considering requiring the start param. range(0,n) only takes two more
keystrokes. Better maybe to shorten range to rng to get them back ;-)

I can't use enumerate that much. I usually work with a Table which is
like a list, but the index can start at any integer value. Enumerate
doesn't work well with a table.
 
A

Antoon Pardon

Op 2006-03-10 said:
Actually, I consider the unique calling pattern for x/range to be something
of a wart. Learning this inconsistency was at least a minor problem. It
is a rather extreme example of typing laziness beats purity.

Given that enumerate() eliminate many uses of range(), it might be worth
considering requiring the start param. range(0,n) only takes two more
keystrokes. Better maybe to shorten range to rng to get them back ;-)

Take the split method of strings. Personnaly I would prefer to be able
to write:

s.split(,3)

Instead of having to write

s.split(None,3)


The reason is that None is IMO an implemenation detail here. Also
the alternative

s,split(maxsplit=3)

doesn't work in this case.


What may be an option for the future is a Default Object. So that
if you have.

def f(x=0,y=0):
...

then

f(Default, 5)


would be equivallent to

f(0,5)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top