Thanks again for the responses. I dont usually put anything in the 
__init__.py files, but I noticed that in some instances for some python 
packages elsewhere that this has been done. My issue is having repetitive 
names when calling a module.

Say for instance my package is:

vehicle/
    __init__.py
    car.py
    sportscar.py
Where inside car.py, I will have 

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"
   


And inside sportscar.py

from vehicle import car as car

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"
       

SO my issue is having to parse in car.CAR, seems repetitive. But I guess 
the fact that not many people go through this.... I must be approaching 
structure of my code incorrectly.

How would you guys approach this?

-Jeremy

On Sunday, 11 May 2014 19:51:36 UTC+10, Jeremy YeoKhoo 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/648d8e7c-e7cf-478e-acb8-f19539a6903a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to