Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Making Non Callable Objects Callable

Reply
Thread Tools

Making Non Callable Objects Callable

 
 
exiquio
Guest
Posts: n/a
 
      10-07-2008
I am trying to figure out if there is a way to make an object in
python callable, modules in particular. I wrongly assume that defining
'__call__' in the the objects __dict__ would work. Any help would be
appreciated.
 
Reply With Quote
 
 
 
 
exiquio
Guest
Posts: n/a
 
      10-07-2008
On Oct 7, 1:56*pm, Christian Heimes <(E-Mail Removed)> wrote:
> exiquio wrote:
> > I am trying to figure out if there is a way to make an object in
> > python callable, modules in particular. I wrongly assume that defining
> > '__call__' in the the objects __dict__ would work. Any help would be
> > appreciated.

>
> No, that doesn't work. Several magic methods (__*__) aren't looked up in
> __dict__ or through __getattr__().
>
> Christian


Thanks.
 
Reply With Quote
 
 
 
 
exiquio
Guest
Posts: n/a
 
      10-07-2008
On Oct 7, 1:56*pm, Christian Heimes <(E-Mail Removed)> wrote:
> exiquio wrote:
> > I am trying to figure out if there is a way to make an object in
> > python callable, modules in particular. I wrongly assume that defining
> > '__call__' in the the objects __dict__ would work. Any help would be
> > appreciated.

>
> No, that doesn't work. Several magic methods (__*__) aren't looked up in
> __dict__ or through __getattr__().
>
> Christian


Thanks.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
making a class callable dude Python 3 03-04-2011 09:03 AM
Functions, callable objects, and bound/unbound methods Ron Garret Python 6 12-01-2006 05:43 PM
Making virtual objects out of non-virtual objects 4zumanga@gmail.com C++ 2 05-19-2006 06:24 PM
why descriptors? (WAS: Make staticmethod objects callable?) Steven Bethard Python 0 03-01-2006 11:03 PM
Make staticmethod objects callable? Nicolas Fleury Python 10 03-01-2006 10:02 PM



Advertisments