Re: Metaprogramming question

2014-02-11 Thread Zachary Ware
On Tue, Feb 11, 2014 at 12:13 PM, Travis Griggs wrote: > So here’s my basic question. Is there anyway to programatically query that > information in python code? > > inspect.signature(datetime.datetime.now) > > just gives a ValueError. inspect must only be good for the python code that I > write

Metaprogramming question

2014-02-11 Thread Travis Griggs
The discussion about niladic functions, made me want to follow a segue and do some reflection/introspective programming in Python. I’ve not done a lot of that yet, and it seemed like an educational (well, at least entertaining) goose chase. If I run the following code: import datetime datetime

Re: Metaprogramming question

2006-10-06 Thread Georg Brandl
Steve Menard wrote: > I have a need to create class instance without invokking the class' __init__ > method. > > Were I using old-style classes, I'd use new.instance() function. However, I > am using new-style classes and new.instance() complain "TypeError: > instance() argument 1 must be clas

Re: Metaprogramming question

2006-10-05 Thread MonkeeSage
Steve Menard wrote: > So my question is, how to replicate new.instance() functionality with new > classes? class A(object): def __init__(self): print "Class A" A() A.__new__(A) # <- this one Regards, Jordan -- http://mail.python.org/mailman/listinfo/python-list

Metaprogramming question

2006-10-05 Thread Steve Menard
I have a need to create class instance without invokking the class' __init__ method. Were I using old-style classes, I'd use new.instance() function. However, I am using new-style classes and new.instance() complain "TypeError: instance() argument 1 must be classobj, not type" ... So my quest