Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20352

Re: package extension problem

Newsgroups comp.lang.python
Date 2012-02-13 09:18 -0800
References <mailman.5734.1329072778.27778.python-list@python.org>
Subject Re: package extension problem
From Miki Tebeka <miki.tebeka@gmail.com>
Message-ID <mailman.5764.1329153506.27778.python-list@python.org> (permalink)

Show all headers | View raw


> B[some_hash] still returns an instance of the old class A, while I want 
an instance of the new class A. 
I don't understand this sentence. How does B[some_hash] related to A?

I've tried the below and it seems to work. Can you paste some code to help us understand more?

-- old.py --
class A:
    pass

-- new.py __
import old
class A(old.A):
    pass

-- main.py --
import new
a = new.A()
a.__class__ # Shows new.A

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

package extension problem Fabrizio Pollastri <f.pollastri@inrim.it> - 2012-02-12 19:46 +0100
  Re: package extension problem Miki Tebeka <miki.tebeka@gmail.com> - 2012-02-13 09:18 -0800
    Re: package extension problem Fabrizio Pollastri <f.pollastri@inrim.it> - 2012-02-13 18:53 +0100
      Re: package extension problem Miki Tebeka <miki.tebeka@gmail.com> - 2012-02-13 09:58 -0800
        Re: package extension problem Terry Reedy <tjreedy@udel.edu> - 2012-02-13 14:12 -0500
      Re: package extension problem Miki Tebeka <miki.tebeka@gmail.com> - 2012-02-13 09:58 -0800
    Re: package extension problem Peter Otten <__peter__@web.de> - 2012-02-13 19:28 +0100
  Re: package extension problem Miki Tebeka <miki.tebeka@gmail.com> - 2012-02-13 09:18 -0800

csiph-web