Making Non Callable Objects Callable

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • exiquio

    Making Non Callable Objects Callable

    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.
  • Christian Heimes

    #2
    Re: Making Non Callable Objects Callable

    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

    Comment

    • exiquio

      #3
      Re: Making Non Callable Objects Callable

      On Oct 7, 1:56 pm, Christian Heimes <li...@cheimes. dewrote:
      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.

      Comment

      • exiquio

        #4
        Re: Making Non Callable Objects Callable

        On Oct 7, 1:56 pm, Christian Heimes <li...@cheimes. dewrote:
        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.

        Comment

        Working...