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.
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/f36c7b49-d6dd-41c0-aa5f-4cc31a581034%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBMJbSHqRV96nFQH_1J4dsBY-pkGL769LRVSSZZ%2BfN6Ww%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1DrN_0wD1%2BwNHTWqa-7E2L1QrrHJ2-%2B-NZaodqPyqrmw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Class CAR():
def __init__(self, drive):
if drive:
self.engine(True)
def engine(self, turnOn= False):
print "Im a lawnmower. :("
if turnOn:
print "putt putt"
def chassis(self):
print "basic"
class sportscar(car.CAR):
def __init__(self, drive):
car.CAR.__init__(drive)
def engine(self, turnOn):
print "I am now a V12"
if turnOn:
print "Hell yes"
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/648d8e7c-e7cf-478e-acb8-f19539a6903a%40googlegroups.com.
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/79b673f1-8610-46be-aa5e-bc821a584872%40googlegroups.com.
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/1150fcf2-befa-48b8-9260-3e551df5ecf2%40googlegroups.com.