Which of the best choice ?

Mel Wilson mwilson at the-wire.com
Wed Nov 19 11:50:10 EST 2003


In article <Kf2dnRmXkuHQMS-iRVn-jA at comcast.com>,
"Terry Reedy" <tjreedy at udel.edu> wrote:
>In some situations, I like a third choice: import math as m, for
>instance.  (But I would not bother to abbreviate 'sys'.)  Typing 'm.'
>as in 'm.sin' is quick and a small price for keeping math names
>segregated.

   That's also good for choosing among modules which truly
are alternatives, as in

    if md5_required:
        import md5 as digest
    else:
        import sha as digest
...
    digester = digest.new()
...

and so on.

        Regards.        Mel.




More information about the Python-list mailing list