[prev in list] [next in list] [prev in thread] [next in thread]
List: python-list
Subject: Re: Very weird behavior that's driving me crazy
From: Pupeno <pupeno () pupeno ! com>
Date: 2006-08-16 8:01:26
Message-ID: 44e2d0cf$0$6994$9b4e6d93 () newsspool1 ! arcor-online ! net
[Download RAW message or body]
Nevermind, it was fixed. Thanks.
Pupeno wrote:
> Hello,
> I am experiencing a weird behavior that is driving me crazy. I have module
> called Sensors containing, among other things:
>
> class Manager:
> def getStatus(self):
> print "getStatus(self=%s)" % self
> return {"a": "b", "c": "d"}
>
> and then I have another module called SensorSingleton that emulates the
> hard-to-code-on-python singleton in this way:
>
> manager = Manager()
> print "manager=%s" % manager
> def getStatus():
> print "getStatus()"
> return manager.getStatus()
>
> and then in some other module, I import SensorSingleton and I do, among
> other things:
>
> print SensorSingleton.getStatus()
>
> and the output is more or less like this. First, the manager:
>
> manager: <Sensor.Manager object at 0xb7b9efec>
>
> ok, then
>
> Manager.getStatus(self=<Sensor.Manager object at 0xb77cde8c>) =>
> {"a": "b", "c": "d"}
> None
>
> None is the return of SensorSingleton.getStatus(), now, my questions are:
>
> - Shouldn't the manager be the same in the first print and the second,
> that is, the id is different, shouldn't it be the same ?
> - What happened with all the output of SensorSingleton.getStatus() ?
> there's no trace of it (but there's output of the method it calls).
> - Why doesn't the SensorSingleton.getStatus() return the return value of
> manager.getStatus(), it's a very straight forward call to it and return
> it.
>
> Thank you.
--
Pupeno <pupeno@pupeno.com> (http://pupeno.com)
--
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic