Orest Kozyar wrote:
You're right. I just figured out that for some reason, when I use the
SQLAlchemy mapper() function to map my classes to the corresponding table
object, it seems to affect inspect.getargspec().
For example:
from sqlalchemy.orm import mapper
from sqlalchemy import
Orest Kozyar wrote:
I have the following code:
class meta(type):
def __call__(cls, *args, **kwargs):
argnames = inspect.getargspec(cls.__init__)[0]
for i, value in enumerate(args):
kwargs[argnames[i]] = value
This could be written
This could be written
kwargs.update(zip(argnames, args))
Nice trick! Thanks for the pointer.
return type.__call__(cls, kwargs)
You are passing kwargs as a positional argument to __call__(); i.e.
passing the dict as an ordinary parameter. To use kwargs as
the keyword
I have the following code:
class meta(type):
def __call__(cls, *args, **kwargs):
argnames = inspect.getargspec(cls.__init__)[0]
for i, value in enumerate(args):
kwargs[argnames[i]] = value
return type.__call__(cls,