Alex Martelli wrote: > Is it finally time in Python 2.5 to allow the "obvious" use of, say, > str(5,2) to give '101', just the converse of the way int('101',1) > gives 5? I'm not sure why str has never allowed this obvious use -- > any bright beginner assumes it's there and it's awkward to explain > why it's not!-). My main concern is what the impact on __str__ would be. It seems "obvious" that def str(obj, *args): return obj.__str__(*args) because it is ultimately int's responsibility to interpret the base argument, not str's. People would then come up with use cases like class Color: msg = {'en':['red', 'green', 'blue'], 'de':['rot','grün','blau']} def __str__(self, language='en'): return self.msg[language][self.value] red = Color(0) so you could say print str(red, 'de') I don't think I like this direction. Regards, Martin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4