[Tutor] Converting from a single module to a package

Tim Johnson tim at johnsons-web.com
Sat Aug 6 03:55:06 CEST 2011


* Emile van Sebille <emile at fenx.com> [110805 15:51]:
> On 8/5/2011 4:22 PM Tim Johnson said...
> >* Christopher King<g.nius.ck at gmail.com>  [110805 12:03]:
> >>To make a package, you make a folder named what you want to name the
> >>package, for example: virus_toolkit. Then you make a file in it called
> >>__init__.py. This is what you import if you import the virus_toolkit. You
> >>usually put documentation and general functions in this
> 
> 
> But you can provide for both methods if in tlib.__init__ you provide
> for backward compatibility.
> 
> 
> >  # current way
> >  import tlib as std
> >  ....
> >  std.htmlButton(*arglist)
> >
> >  # New way, after transition
> >  import tlib as std
> 
> in tlib.__init__, include the following:
> 
> import html
> htmlButton = html.button
  Yes. That's what I'm talking about.
  Thank you Emile. :)
-- 
Tim 
tim at johnsons-web dot com or akwebsoft dot com
http://www.akwebsoft.com


More information about the Tutor mailing list