Re: [Tutor] while loops causing python.exe to crash on windows

2010-06-07 Thread Alan Gauld
"Alex Hall" wrote I am not sure how else to explain it. I want to loop until the value of a variable changes, but while that loop is taking place, the user should be able to perform actions set up in a wx.AcceleratorTable. And here we have the critical clue. You are trying to write this loop

Re: [Tutor] while loops causing python.exe to crash on windows

2010-06-07 Thread Walter Prins
On 7 June 2010 02:37, Alex Hall wrote: > I am not sure how else to explain it. I want to loop until the value > of a variable changes, but while that loop is taking place, the user > should be able to perform actions set up in a wx.AcceleratorTable. > Looping, though, causes Windows to tell me th

Re: [Tutor] Misc question about scoping

2010-06-07 Thread Tino Dai
>answerDict=dict(map(lambda x: (str(x[1]),x[0]),map(lambda x: \ >> x.values(),Answer.objects.filter(fk_questionSet=1). \ >> filter(fk_question=1).values('widgetAnswer').order_by(). \ >> annotate(widgetCount=Count('widgetAnswer') >> >> > The first time there

[Tutor] a class query

2010-06-07 Thread Payal
Hi all, I know the difference between class Parent : class Parent(object) : But in some softwares i recall seeing, class Parent() : Is this legal syntax? With warm regards, -Payal -- ___ Tutor maillist - Tutor@python.org To unsubscribe or change

Re: [Tutor] a class query

2010-06-07 Thread Robert
lol, for a second I thought this question comes from PayPal On Mon, Jun 7, 2010 at 10:01 AM, Payal wrote: > Hi all, > I know the difference  between > class Parent : > class Parent(object) : > > But in some softwares i recall seeing, > class Parent() : > > Is this legal syntax? > > With warm r

Re: [Tutor] while loops causing python.exe to crash on windows

2010-06-07 Thread Mark Lawrence
On 07/06/2010 01:44, Alex Hall wrote: Further to the other comments that you've had, could you please refer to the following, thanks. http://www.catb.org/~esr/faqs/smart-questions.html Kindest regards. Mark Lawrence ___ Tutor maillist - Tutor@py

Re: [Tutor] a class query

2010-06-07 Thread bob gailer
On 6/7/2010 10:01 AM, Payal wrote: Hi all, I know the difference between class Parent : class Parent(object) : But in some softwares i recall seeing, class Parent() : Is this legal syntax? Teach: To answer that question, just try it at the interactive prompt. If it is not legal syntax y

Re: [Tutor] a class query

2010-06-07 Thread python
Not the OP, but I was surprised to see class Name() work (in Python 2.6.5 at least). Is this equivalent to class Name( object ) or does this create an old style class? Going forward into the 2.7/3.x world, is there a preferred style? Thanks, Malcolm __

Re: [Tutor] a class query

2010-06-07 Thread Mark Lawrence
On 07/06/2010 16:12, pyt...@bdurham.com wrote: Not the OP, but I was surprised to see class Name() work (in Python 2.6.5 at least). Is this equivalent to class Name( object ) or does this create an old style class? Going forward into the 2.7/3.x world, is there a preferred style? Thanks, Malco

Re: [Tutor] a class query

2010-06-07 Thread python
Hi Mark, >> I was surprised to see class Name() work (in Python 2.6.5 at least). Is this >> equivalent to class Name( object ) or does this create an old style class? >> Going forward into the 2.7/3.x world, is there a preferred style? > RTFM? :) I am reading TFM :) Here's why I'm confused. T

Re: [Tutor] a class query

2010-06-07 Thread Steven D'Aprano
On Tue, 8 Jun 2010 01:12:28 am pyt...@bdurham.com wrote: > Not the OP, but I was surprised to see class Name() work (in Python > 2.6.5 at least). > > Is this equivalent to class Name( object ) or does this create an old > style class? In Python 2.x, all classes are old-style unless you directly or

Re: [Tutor] a class query

2010-06-07 Thread Steven D'Aprano
On Tue, 8 Jun 2010 02:03:18 am pyt...@bdurham.com wrote: > Here's why I'm confused. The following paragraph from TFM seems to > indicate that old style classes are the default: Yes, if you don't inherit from object, or another class that inherits from object (like the built-ins), you get an old-

Re: [Tutor] a class query

2010-06-07 Thread Mark Lawrence
On 07/06/2010 17:03, pyt...@bdurham.com wrote: Hi Mark, I was surprised to see class Name() work (in Python 2.6.5 at least). Is this equivalent to class Name( object ) or does this create an old style class? Going forward into the 2.7/3.x world, is there a preferred style? RTFM? :) I am

Re: [Tutor] a class query

2010-06-07 Thread python
> In Python 2.x, all classes are old-style unless you directly or indirectly > inherit from object. If you inherit from nothing, it is an old-style class > regardless of whether you say class Name: pass or class Name(): pass. In > Python 3.x, there are no old-style classes. Thanks Steven! Malc

Re: [Tutor] a class query

2010-06-07 Thread python
Steven, Thanks again for your explanations. I thought I had missed a major change in Python class behavior - relieved to find that I'm up-to-date. Cheers, Malcolm ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: htt

Re: [Tutor] a class query

2010-06-07 Thread python
Hi Mark, > I see that Stephen D'Aprano has already replied twice so I won't bother. > Apart from that no offence meant, I hope none taken. Your RTFM reply actually gave me a good laugh. No (zero) offence taken. And I appreciate your many helpful posts in these forums. Cheers, Malcolm __

[Tutor] Strange range and round behaviour

2010-06-07 Thread Adam Bark
Just out of curiosity does anyone know why you get a deprecation warning if you pass a float to range but if you use round, which returns a float, there is no warning? Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "lice

Re: [Tutor] while loops / listeners

2010-06-07 Thread Francesco Loffredo
Hi all, I think that simply erasing those "continue" statements will let Python respond again. Those statements are both useless and damaging, because the following "time.sleep(.1)" statements will NEVER be executed. And this, in turn, is IMHO the reason why Python stops responding: it lacks t

Re: [Tutor] a class query

2010-06-07 Thread Mark Lawrence
On 07/06/2010 17:30, pyt...@bdurham.com wrote: Hi Mark, I see that Stephen D'Aprano has already replied twice so I won't bother. Apart from that no offence meant, I hope none taken. Your RTFM reply actually gave me a good laugh. No (zero) offence taken. And I appreciate your many helpful pos

Re: [Tutor] Strange range and round behaviour

2010-06-07 Thread Lee Harr
> Just out of curiosity does anyone know why you get a deprecation warning if > you pass a float to range but if you use round, which returns a float, there > is no warning? It has nothing to do with the round. It's just that the warning is only shown once: $ python Python 2.6.5 (r265:79063, Ap

[Tutor] no. of references

2010-06-07 Thread Payal
Hi, If I have a list (or a dict), is there any way of knowing how many other variables are referencing the same object? With warm regards, -Payal -- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.py

Re: [Tutor] a class query

2010-06-07 Thread Payal
On Tue, Jun 08, 2010 at 02:11:10AM +1000, Steven D'Aprano wrote: > In Python 2.x, all classes are old-style unless you directly or > indirectly inherit from object. If you inherit from nothing, it is an > old-style class regardless of whether you say > > class Name: pass > > or > > class Nam

[Tutor] accented characters to unaccented

2010-06-07 Thread KB SU
Hi, I have open url and read like following: $import urllib $txt = urllib.urlopen("http://www.terme-catez.si";).read() $txt Gives output like below: other parts are skipped --- r\n 2010\r\n http://www.terme-catez.si"; target="_blank">Terme \xc4\x8cate\xc5\xbe\r\n Slovenija\r\