Making Non Callable Objects Callable

View: New views
4 Messages — Rating Filter:   Alert me  

Making Non Callable Objects Callable

by exiquio :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.
--
http://mail.python.org/mailman/listinfo/python-list

Re: Making Non Callable Objects Callable

by Christian Heimes-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

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

Parent Message unknown Re: Making Non Callable Objects Callable

by exiquio :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Oct 7, 1:56 pm, Christian Heimes <li...@...> 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.
--
http://mail.python.org/mailman/listinfo/python-list

Parent Message unknown Re: Making Non Callable Objects Callable

by exiquio :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Oct 7, 1:56 pm, Christian Heimes <li...@...> 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.
--
http://mail.python.org/mailman/listinfo/python-list
LightInTheBox - Buy quality products at wholesale price!