You’d be rather unique in doing that and I wouldn’t consider it very
Pythonic, making it an extra barrier for readers of your code to grasp.
Instead, you could define a class in your __init__.py and inherit from that.
Folders with __init__.py files are called “Packages” and can be treated
much like a class.
import mypackage
mypackage.MyClass()
class MyNewClass(mypackage.MyClass):
pass
This would be called working with namespaces, which is very Pythonic.
On 11 May 2014 10:51, Jeremy YeoKhoo <[email protected]> wrote:
> Hey gu
> I'm starting to cleanup my code, and since I've self taught programming
> from the get go and arent aware of some basic things. I have a question,.
> In regards to an __init__.py file. Can I use a folder that contains a
> __init__.py as an inherited object? And if I can, how do i structure the
> code?
>
>
> So if Car folder has __init__ how do I the call:
>
> class sportscar(car):
> def __init__(self, car.__init__):
> print "go vroom"
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/f36c7b49-d6dd-41c0-aa5f-4cc31a581034%40googlegroups.com<https://groups.google.com/d/msgid/python_inside_maya/f36c7b49-d6dd-41c0-aa5f-4cc31a581034%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
*Marcus Ottosson*
[email protected]
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBMJbSHqRV96nFQH_1J4dsBY-pkGL769LRVSSZZ%2BfN6Ww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.