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
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 combined
Artur Sousa wrote:
Sorry... forgot to add the code...
2008/2/11, Artur Sousa [EMAIL PROTECTED] mailto:[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
message,
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:
print n,
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':
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 change the key 'link'
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 views is this:
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
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 an
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. Particularly
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 exist.
Artur Sousa wrote:
What's the difference between:
code
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'
/code
and
code
for a in range(2, 10):
12 matches
Mail list logo