Re: [Tutor] designing POOP

2008-02-11 Thread Tiger12506
> "bhaaluu" <[EMAIL PROTECTED]> wrote > >> States, getters-setters, direct access... >> I'm still in toilet-training here/ 8^D >> Can you provide some simple examples that >> illustrate exactly what and why there is any >> contention at all? One clear example I can think of that shows the view

Re: [Tutor] designing POOP

2008-02-11 Thread Alan Gauld
"bhaaluu" <[EMAIL PROTECTED]> wrote > States, getters-setters, direct access... > I'm still in toilet-training here/ 8^D > Can you provide some simple examples that > illustrate exactly what and why there is any > contention at all? I'll try. State is just a bit of jargon to describe the com

Re: [Tutor] [Python-Help] [EMAIL PROTECTED]

2008-02-11 Thread bob gailer
Artur Sousa wrote: > What's the difference between: > > > for a in range(2, 10): > for n in range(2, a): > if a % n == 0: > print a, 'equals', n, '*', a/n > break > else: > print a, 'is a prime number' > > > and > > > for a in range(2, 10

Re: [Tutor] Change dictionary value depending on a conditional statement.

2008-02-11 Thread Steve Willoughby
Kent Johnson wrote: > Try >list.append({'id': 'name', 'link': ('YY','XX')[total > 0]}) I'd caution against that, though. It's clever and cute, sure, but the meaning of it is obfuscated enough to be unpythonic because [total > 0] as a subscript doesn't mean anything unless you know you're ta

Re: [Tutor] Beginner in need

2008-02-11 Thread Kent Johnson
Artur Sousa wrote: > Sorry... forgot to add the code... > > 2008/2/11, Artur Sousa <[EMAIL PROTECTED] >: > > > Hi. Just started on programming, as well on Python. I'm having a > little problem: It helps if you describe the problem. If you are getting an error

[Tutor] Beginner in need

2008-02-11 Thread Artur Sousa
Hi. Just started on programming, as well on Python. I'm having a little problem: What's the difference between: > > ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Beginner in need

2008-02-11 Thread Artur Sousa
Sorry... forgot to add the code... 2008/2/11, Artur Sousa <[EMAIL PROTECTED]>: > > > Hi. Just started on programming, as well on Python. I'm having a little > problem: > What's the difference between: > for n in range(2, 10): for x in range(2, n): if n % x == 0: pri

Re: [Tutor] Change dictionary value depending on a conditional statement.

2008-02-11 Thread Kent Johnson
bob gailer wrote: > The terse version: > > list.append({'id': 'name', 'link': ('XX','YY')[total > 0]}) I think you have it backwards: In [1]: total=0 In [2]: ('XX','YY')[total > 0] Out[2]: 'XX' In [3]: total=1 In [4]: ('XX','YY')[total > 0] Out[4]: 'YY' Try list.append({'id': 'name', 'link':

Re: [Tutor] Change dictionary value depending on a conditional statement.

2008-02-11 Thread bob gailer
Norman Khine wrote: > Hello, > Is there a better way to do this: > > >>> list = [] > >>> total = 0 > >>> if total > 0: > ... x = {'id': 'name', 'link': 'XX'} > ... list.append(x) > ... else: > ... y = {'id': 'name', 'link': 'YY'} > ... list.append(y) > ... > > I would like to cha

Re: [Tutor] designing POOP

2008-02-11 Thread bhaaluu
On Feb 11, 2008 3:49 AM, Alan Gauld <[EMAIL PROTECTED]> wrote: > > I think we are in general agreement, albeit with different levels of > trust/toleration of the technique. Direct access is preferred to > getter/setter methods but is in turn less desirable that higher > level methods where they exi

Re: [Tutor] lan with python

2008-02-11 Thread Luke Paireepinart
Treloar, Nick wrote: > hey i was just wondering if any one could tell me if they know if you > can make multi player games through lan with python heres the code i > want to lan. > > just hash out the sound files > [snip lots of code] Hi Nick. Please don't send huge amounts of code inline in

Re: [Tutor] designing POOP

2008-02-11 Thread Alan Gauld
"Kent Johnson" <[EMAIL PROTECTED]> wrote >> The secondary reason is that a class author should be free >> to change the internal data of a class provided he doesn't change >> the message interface, but allowing direct access greatly increases >> the risk that a change will break some users code. P