raise or not to raise [Newbie]

2007-02-03 Thread Jacol
Hello everybody!

I found this:
http://mail.python.org/pipermail/python-list/1999-July/006344.html

My question concernings "callerFunc" and is more general what is difference
between:

try:
raise "xyz"
except "xyz":
print "This is smthing"

and simpler:
print "This is smthing"

Both give the same result.
I don't understand manuals in this point.

Thanks a lot,
Jacek
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: raise or not to raise [Newbie]

2007-02-03 Thread Jacol
I understand that author generated exception and than extracted the name of
function from the exeption. But is any sens in using exeptions service if
we have smthing simpler: just print for example? In my opinion no, it
doesn't make sens.

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


Re: Dlaczego ten destruktor nie dziala [_LONG_]

2007-02-06 Thread Jacol
Sulsa wrote:

> Mam klase A po ktorej dziedziczy B i jesli w destruktorze klasy B
> wywolam:
> self.__class__.__bases__[0].__del__(self)
> 
> to wszytkos jest ok, i destruktor klasy a jest wywolywany, jesli
> natomiast napisze: A.__del__(self)  to otrzymuje nastepujacy wyjatek:
> Exception exceptions.AttributeError: "'NoneType' object has no
> attribute '__del__'" in  at 0x2b025d04a830>> ignored
> 
> czemu tak sie dzieje?

??

Cześć,
Właściewie to nie rozumiem sensu pytania. :)

Ja zrobiłem tak:

class A:
def __del__(self):
print "Delete A"

class B(A):
def __del__(self):
A.__del__(self)
print "Delete B"

potem sworzyłem instancję: InstanceB=B()

potem uruchomiłem destruktory: del(InstanceB) i moim oczom ukazał się
komunikat:

Delete A
Delete B

1) Czy atrybut A.__del__(self) zosatł zdefiniowany przez Ciebie?? Domyślny
nie jest brany pod uwagę. Sprawdziłem.

class A:
pass
class B(A):
def __del__(self):
A.__del__(self)
print "Cośtam"

potem 

insta=B()
del(insta) daje Exception exceptions.AttributeError: "class A has no
attribute '__del__'" in > ignored

PS.: Python 2.4.4c1
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Dlaczego ten destruktor nie dziala [_LONG_]

2007-02-06 Thread Jacol

>> self.__class__.__bases__[0].__del__(self)
>> 

Swoją drogą to nie masz litości pisząc coś takiego ;)
-- 
http://mail.python.org/mailman/listinfo/python-list

How to detect closing of wx.Panel?

2007-02-18 Thread Jacol
Hi everybody,

I have poblem with detecting closing of wx.Panel by user. How to detect that
event?

The wx.EVT_CLOSE event concerns wx.Frame class only. Neither Close() nor
Destroy() aren't executed if the event occurs (if user close a panel). Thus
extanding these both methods doesn't make sens (I've tested that).

With many thanks &
Best wishes,
Jacek
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to detect closing of wx.Panel?

2007-02-19 Thread Jacol
Morpheus wrote:

> On Mon, 19 Feb 2007 01:18:11 +0000, Jacol wrote:
> 
>> Hi everybody,
>> 
>> I have poblem with detecting closing of wx.Panel by user. How to detect
>> that event?
> 
> Don't know why you want to do that, but you could register with the
> enclosing (hosting) widget.

In my program a panel is related to a plugin's object. I mean if a panel is
closed the object have to be deleted also. Currently it doesn't work & i
have e memory leak. But i think i'll fixed a panel with its object
directly. 

Currently i did it like that:


mainframe(wx.Frame)
subobject---> pluginsmanager -->object (a hash session=>object )
subobject---> panel

The panel send to pluginsmanager its own session no and received from that
XRC. But it is too complicated. I have to do it more simpler.

More @ pentrezy.cvs.sf.net// 

Best wishes,
Jacek
-- 
http://mail.python.org/mailman/listinfo/python-list