Leonel, in your example, if "import peartree" doesn't bring in Pear (and thus Pear needs to be imported explicitly) - then... How is Pear accessible at all? I mean, if Pear is not accessible - then what's the difference between direct usage and indirect usage? I guess I am missing something basic on how namespaces work, but it seems straightforward to me: if rows=db.select() works and rows is known to be an instance of the class Rows, and Rows is recognized as a class and can be used, just... not directly??? I mean, it should be either visible or invisible, and if it's visible - everything about it is visible, and if it's invisible - everything about it should be invisible... So, how can it be that it's visible and recognized as a class, yet the details of this class are hidden - so it can be used partially but not fully?? I am mystified. Thank you for your patience :)
On Tuesday, May 21, 2019 at 9:22:53 AM UTC-4, Leonel Câmara wrote: > > If you have a module called peartree.py which has only this > > class Pear: > pass > > > def shake(): > return Pear() > > > If in another module you do: > > import peartree > > > mypear = peartree.shake() > > > mypear will be an instance of Pear, however Pear is not defined in this > context and you cannot use the class directly without going through the > peartree namespace. > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/646b59a4-a583-4850-9d08-e091120cc274%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.