Use and usefulness of the as syntax

0xfn oleg.rimko at gmail.com
Sun Nov 13 03:55:16 EST 2011


On Nov 12, 7:48 am, Rafael Durán Castañeda
<rafadurancastan... at gmail.com> wrote:
> El 12/11/11 13:43, Tim Chase escribió:>   I hate trying to track down variable-names if one did something like
>
> >   from Tkinter import *
>
> +1

Really, this questionable code is always mentioned as example in
Tkinter tuts.
IMHO much better is
>>> import Tkinter as tk
In common case `as` is useful when:
1. You `import ThirdPartyModuleWithTerriblyLongName as tpm`
2. Whant to free some common variable name, which is engaged by module
name by default
   (right what Mel Wilson has pictured)



More information about the Python-list mailing list