Why does Python mix OO concepts and non OO concepts for operation s on basic types?

Bjorn Pettersen BPettersen at NAREX.com
Mon Jun 10 19:00:30 EDT 2002


> From: James T. Dennis [mailto:jadestar at idiom.com] 
> 

[snip]

> 
> 	Personally I think it would be generally nice if I could
> 	call most of the list and string methods in both ways:
> 
> 	list.append(somelist,someitem) would be the same as:
> 	somelist.append(someitem).
> 
> 	And the obvious:
> 
> 	string.join('',something) would be as: ''.join(something).

Your wish is granted:

>>> x = []
>>> list.append(x, 5)
>>> x
[5]
>>> str.join(' ', ['a', 'b', 'c'])
'a b c'
>>>

not-that-I-would-ever-do-something-like-that'ly y'rs
-- bjorn





More information about the Python-list mailing list