On 9/20/2010 7:16 AM Michael Scharf said...
Why is it
    list0.extend(list1)
and not
    extend(list 0, list1)
or
    stri0 = stri0.strip()
and not
    stri0 = strip(stri0)
Why have arguments on the left side at all, when usually the dot notation
left to right implies a hierarchical relation: file.class or class.method
etc.


You can also have it your way...

>>> def extend(*args):
...     try:
...         args[0].extend(*args[1:])
...     except:
...         raise AttributeError
...
>>>
...
>>>
>>> a = []
>>> a.extend([1,2,3])
>>> a
[1, 2, 3]
>>> extend(a,[4,5,6])
>>> a
[1, 2, 3, 4, 5, 6]
>>>


Emile


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to