On Mon, 25 Jun 2007 05:08:00 +, Michele Simionato wrote:
On Jun 24, 1:29 pm, Steven D'Aprano
I would like to hear your opinion of whether the
following two functions are equally as wrong:
def f1(gizmo):
global spam # holds the frommet needed for the gizmo
On Jun 25, 1:46 pm, Steven D'Aprano
[EMAIL PROTECTED] wrote:
To me, this code is redundant but not wrong:
def sin(x):
return math.sin(x)
It's not wrong, because it does everything that it is supposed to do, and
nothing that it isn't supposed to do.
I told you,
On Jun 24, 2:51 am, [EMAIL PROTECTED] (Alex Martelli) wrote:
Since that global statement is utterly useless
(it's impossible to read and understand any substantial amount of Python
code without realizing that accessing a variable not locally assigned
means you're accessing a global, so the
On Sat, 23 Jun 2007 21:11:42 -0700, Alex Martelli wrote a lot, with lots
of YELLING.
Wow.
What can I say?
Given the amount of SHOUTING in your post, and the fact that you feel so
strongly about the trivial question of the redundant use of the global
statement that you would fail a student who
In [EMAIL PROTECTED], Steven
D'Aprano wrote:
Perhaps you should consider writing a PEP to make the redundant use of the
global statement a compile-time error?
Sometimes I wished that it would be a compile time error or at least
triggering a warning when ``global`` is used at module level. It
Steven D'Aprano wrote:
On Sat, 23 Jun 2007 21:11:42 -0700, Alex Martelli wrote a lot, with lots
of YELLING.
Given the amount of SHOUTING in your post, and the fact that you feel so
strongly about the trivial question of the redundant use of the global
statement that you would fail a student
Scott David Daniels [EMAIL PROTECTED] wrote:
Steven D'Aprano wrote:
On Sat, 23 Jun 2007 21:11:42 -0700, Alex Martelli wrote a lot, with lots
of YELLING.
Given the amount of SHOUTING in your post, and the fact that you feel so
strongly about the trivial question of the redundant use of
On Jun 24, 1:29 pm, Steven D'Aprano
I would like to hear your opinion of whether the
following two functions are equally as wrong:
def f1(gizmo):
global spam # holds the frommet needed for the gizmo
gizmo.get_frommet(spam)
def f2(gizmo):
# global spam holds the frommet needed
thanks Steven,
Steven D'Aprano wrote:
On Fri, 22 Jun 2007 21:43:40 +0200, Stef Mientki wrote:
This might be a very weird construction,
but it's the most easy way in translating another language into Python (for
simulation).
Although it works, I like to know if this a valid construction:
Stef Mientki wrote:
... I've defined a class, like this, ...
class T6963_device (tDevice):
def __init__ (self):
global LCD
LCD = self
... In the same module I've a function,
that runs a method of the above class instance, ...
def Write_LCD_Data ( data ):
global
On Sat, 23 Jun 2007 11:03:03 -0700, Scott David Daniels wrote:
The global statement in Write_LCD_Data is completely unnecessary. The
only time you need global is if you want to reassociate the global
name to another object (such as LCD = LCD + 1 or whatever).
That's technically true, but
Steven D'Aprano wrote:
On Sat, 23 Jun 2007 11:03:03 -0700, Scott David Daniels wrote:
The global statement in Write_LCD_Data is completely unnecessary. The
only time you need global is if you want to reassociate the global
name to another object (such as LCD = LCD + 1 or whatever).
Steven D'Aprano [EMAIL PROTECTED] wrote:
On Sat, 23 Jun 2007 11:03:03 -0700, Scott David Daniels wrote:
The global statement in Write_LCD_Data is completely unnecessary. The
only time you need global is if you want to reassociate the global
name to another object (such as LCD = LCD + 1
On Sat, 23 Jun 2007 17:51:17 -0700, Alex Martelli wrote:
Steven D'Aprano [EMAIL PROTECTED] wrote:
On Sat, 23 Jun 2007 11:03:03 -0700, Scott David Daniels wrote:
The global statement in Write_LCD_Data is completely unnecessary. The
only time you need global is if you want to reassociate
Steven D'Aprano [EMAIL PROTECTED] wrote:
...
It's never _wrong_ to use the global statement, even if it is strictly
unnecessary for the Python compiler.
So, repeat that global statement ninetyseven times -- that's not
wrong, either, in exactly the same sense in which it's not wrong
This might be a very weird construction,
but it's the most easy way in translating another language into Python (for
simulation).
Although it works, I like to know if this a valid construction:
I've defined a class, like this,
attaching a not yet defined global to itself
class T6963_device
On Fri, 22 Jun 2007 21:43:40 +0200, Stef Mientki wrote:
This might be a very weird construction,
but it's the most easy way in translating another language into Python (for
simulation).
Although it works, I like to know if this a valid construction:
Since it works, how can it NOT be a
17 matches
Mail list logo