please help shrink this each_with_index() implementation

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Tue Jan 5 18:26:26 EST 2010


On Tue, 05 Jan 2010 14:40:49 -0800, Phlip wrote:

> On Jan 5, 1:10 pm, Antoine Pitrou <solip... at pitrou.net> wrote:
> 
>> http://docs.python.org/library/functions.html
>>
>> Don't forget that the Python documentation is rich and structured. And
>> good luck.
> 
> Does it say how to convert a string containing either an integer
> representation, or something alphabetic, into an integer, or a zero, in
> like 1 method call? (No except: ?)

If you mean something like this:

>>> int('153')
153

then yes it does. But if you mean something like this:


>>> some_mysterious_function('one hundred and fifty-three')
153

then no, it doesn't.



> Nothing personal, but I'm finding the super-hard stuff very facile &
> tractable, and the easy stuff absurdly hard around here...


Then perhaps you should work through the tutorial to learn the basics.



-- 
Steven



More information about the Python-list mailing list