Fredrik Lundh wrote: > Peter Hansen wrote: [the OP wrote] >>>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 > > I frankly don't see what "portability" has to do with this. Why would the > location of a reusable static data structure matter ? Python code work > the same way in scripts and modules...
A local variable (i.e. "inside the def") wouldn't be quite so accessible as a global one... At least, that's what I inferred the OP meant with his question above. -Peter -- http://mail.python.org/mailman/listinfo/python-list