Different cache filename

2013-04-19 Thread Fabian PyDEV
Hi,

when load a module mymodule.py with importlib.machinery.SourceFileLoader a 
bytecode file is created as mymodule.cpython-33.pyc.

If I load a module mymodule.ext.py the same way the same bytecode file is 
created as mymodule.cpython-33.pyc.

Is there any way I could tell python to generate the bycode file as 
mymodule.ext.cpython-33.pyc?

Regards,
Fabian

-- 
http://mail.python.org/mailman/listinfo/python-list


extending class static members and inheritance

2013-04-02 Thread Fabian PyDEV
Hi All,

I have a question.

Let says I have the following two classes:

class Base(object):
__mylist__ = [value1, value2]

def somemethod(self):
pass


class Derived(Base):
__mylist__ = [value3, value4]

def anothermethod(self):
pass




what I would like to accomplish is that the class Derived has the member 
__mylist__ extended or merged as [value1, value2, value3, value4].

Is there anyway I could accomplish this?

I was thinking on accomplishing this as follows:


class Derived(Base):
__mylist__ = Base.__mylist__ + [value3, value4]

def anothermethod(self):
pass


Is there a better way? Perhaps a decorator?


Thanks in advance and regards,
Fabian

-- 
http://mail.python.org/mailman/listinfo/python-list