parsing engineering symbols

Peter Hansen peter at engcorp.com
Wed Dec 21 16:48:57 EST 2005


Jacob Rael wrote:
> Just a newbie, trolling.
> 
> I like this solution. Simple, easy to understand.
> 
> Did you put the SI_prefixes  outside the def so you could wrap the
> whole thing in a module and reuse it in other blocks?

Do "import dis" and then try "dis.dis(myfloat)" on Fredrik's version and 
on your suggested variation...  (Hint, it's likely more an instinct for 
decent performance instead of an instinct for decent portability, though 
it would serve both purposes.)

-Peter




More information about the Python-list mailing list