python 3 - instantiating class from user input

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Apr 7 02:50:38 EDT 2011


On 2011年4月06日 21:04:44 -0700, Brad Bailey wrote:
> I dont understand why this is such a big deal. Nor do i understand why
> google can't find a reasonable answer. If one can't figure out from the
> title what I'm trying to do, then a look at code should firmly plant the
> intent. The general idea of the code is, in my opinion, very basic.
>> I notice, that when you are coding a class instance, it's in the format
> of: newInstance = someClass()
>> OK, so we are calling someClass as if it's a function. Is there a way to
> do something to the effect of:
> someClass(newInstance)

I don't know. What effect do you expect? 
Please don't assume that just because you've spent hours searching for an 
answer, we know what the question is.
-- 
Steven


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /