greg [EMAIL PROTECTED] wrote:
I've only ever seen identity element in English mathematics.
Neutral element sounds like something my car's gearbox
might have...
I've encountered both. I think `neutral element' is more common when
dealing with the possibility that it might not be unique (in
greg [EMAIL PROTECTED] writes:
Arnaud Delobelle wrote:
Neutral element is correct. But maybe its use is limited to
mathematicians in the english-speaking word.
I've only ever seen identity element in English mathematics.
Neutral element sounds like something my car's gearbox
might
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] writes:
On Tue, 18 Nov 2008 00:18:51 +, Steven D'Aprano wrote:
On Mon, 17 Nov 2008 12:32:35 +, Marc 'BlackJack' Rintsch wrote:
Not such illogical crap like
``a = a + 1`` which must be obviously false unless 1 is defined as the
neutral
En Tue, 18 Nov 2008 16:27:46 -0200, Arnaud Delobelle
[EMAIL PROTECTED] escribió:
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] writes:
On Tue, 18 Nov 2008 00:18:51 +, Steven D'Aprano wrote:
On Mon, 17 Nov 2008 12:32:35 +, Marc 'BlackJack' Rintsch wrote:
Not such illogical crap like
``a
Arnaud Delobelle wrote:
Neutral element is correct. But maybe its use is limited to
mathematicians in the english-speaking word.
I've only ever seen identity element in English mathematics.
Neutral element sounds like something my car's gearbox
might have...
--
Greg
--
On Thu, 13 Nov 2008 12:49:02 -0800 (PST), dpapathanasiou [EMAIL PROTECTED]
wrote:
...
but what's wrong with you original code?
I come from a functional programming school of thought, where you
avoid local variable declarations if at all possible.
I'm not sure that's universal. Using
On Mon, 17 Nov 2008 10:10:16 +, Jorgen Grahn wrote:
On Thu, 13 Nov 2008 12:49:02 -0800 (PST), dpapathanasiou
[EMAIL PROTECTED] wrote: ...
but what's wrong with you original code?
I come from a functional programming school of thought, where you avoid
local variable declarations if at
On Mon, 17 Nov 2008 12:32:35 +, Marc 'BlackJack' Rintsch wrote:
Not such illogical crap like
``a = a + 1`` which must be obviously false unless 1 is defined as the
neutral element for the definition of ``+`` here.
I don't quite know what you mean by neutral element. I think you mean
the
En Mon, 17 Nov 2008 22:18:51 -0200, Steven D'Aprano
[EMAIL PROTECTED] escribió:
On Mon, 17 Nov 2008 12:32:35 +, Marc 'BlackJack' Rintsch wrote:
Not such illogical crap like
``a = a + 1`` which must be obviously false unless 1 is defined as the
neutral element for the definition of ``+``
On Nov 17, 5:12 pm, Gabriel Genellina [EMAIL PROTECTED]
wrote:
En Mon, 17 Nov 2008 22:18:51 -0200, Steven D'Aprano
[EMAIL PROTECTED] escribió:
On Mon, 17 Nov 2008 12:32:35 +, Marc 'BlackJack' Rintsch wrote:
Not such illogical crap like
``a = a + 1`` which must be obviously false
On Mon, 17 Nov 2008 23:12:25 -0200, Gabriel Genellina wrote:
Perhaps you didn't read carefully the above post?
Er, yes, you got me on that.
:(
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 18 Nov 2008 00:18:51 +, Steven D'Aprano wrote:
On Mon, 17 Nov 2008 12:32:35 +, Marc 'BlackJack' Rintsch wrote:
Not such illogical crap like
``a = a + 1`` which must be obviously false unless 1 is defined as the
neutral element for the definition of ``+`` here.
I don't
Paul McGuire:
Really? Looking at randrange, it sure seems to do a lot of work in
pursuit of handling all possible cases for specifying range
boundaries, step values, etc.
Well, randrange is the simpler thing to read and understand here, and
maybe the one less likely to get wrong too.
But I
Chris Mellon [EMAIL PROTECTED] wrote:
Any time you port between languages, it's rarely a good idea to just
convert code verbatim. For example:
import random, string
def random_char():
return random.choice(string.ascii_letters + string.digits)
Note that this code doesn't preserve the
On Nov 14, 12:08 pm, Mark Wooding [EMAIL PROTECTED] wrote:
Chris Mellon [EMAIL PROTECTED] wrote:
Any time you port between languages, it's rarely a good idea to just
convert code verbatim. For example:
import random, string
def random_char():
return
I have some old Common Lisp functions I'd like to rewrite in Python
(I'm still new to Python), and one thing I miss is not having to
declare local variables.
For example, I have this Lisp function:
(defun random-char ()
Generate a random char from one of [0-9][a-z][A-Z]
(if ( 50 (random
On Thu, Nov 13, 2008 at 2:22 PM, dpapathanasiou
[EMAIL PROTECTED] wrote:
I have some old Common Lisp functions I'd like to rewrite in Python
(I'm still new to Python), and one thing I miss is not having to
declare local variables.
For example, I have this Lisp function:
(defun random-char
dpapathanasiou wrote:
I have some old Common Lisp functions I'd like to rewrite in Python
(I'm still new to Python), and one thing I miss is not having to
declare local variables.
For example, I have this Lisp function:
(defun random-char ()
Generate a random char from one of
return chr( random.randrange(0, 26) + (97 if random.randrange(0,
100) 50 else 65)
or
return chr( random.randrange(0, 26) + [26,97][random.randrange(0,
100) 50]
Ah, thanks, these are the syntax examples I was looking for.
but what's wrong with you original code?
I come from a
Any time you port between languages, it's rarely a good idea to just
convert code verbatim. For example:
import random, string
def random_char():
return random.choice(string.ascii_letters + string.digits)
Good point, and thanks for the idiomatic Python example (I like the
conciseness);
Gary Herron [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
return chr( random.randrange(0, 26) + [26,97][random.randrange(0,
100) 50]
return chr(random.randrange(0, 26) + (97 if random.randrange(0,100) 50
else 26))
--
http://mail.python.org/mailman/listinfo/python-list
In article [EMAIL PROTECTED],
dpapathanasiou [EMAIL PROTECTED] wrote:
I come from a functional programming school of thought, where you
avoid local variable declarations if at all possible.
Python is *so* not a functional programming language. There are a number
of functional programming
On Nov 13, 2:32 pm, Chris Mellon [EMAIL PROTECTED] wrote:
On Thu, Nov 13, 2008 at 2:22 PM, dpapathanasiou
[EMAIL PROTECTED] wrote:
I have some old Common Lisp functions I'd like to rewrite in Python
(I'm still new to Python), and one thing I miss is not having to
declare local
Paul McGuire:
coinflip = lambda : int(random.random()*2)
I warmly suggest you to use this instead:
randrange(2)
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 13, 6:47 pm, [EMAIL PROTECTED] wrote:
Paul McGuire:
coinflip = lambda : int(random.random()*2)
I warmly suggest you to use this instead:
randrange(2)
Bye,
bearophile
Really? Looking at randrange, it sure seems to do a lot of work in
pursuit of handling all possible cases for
dpapathanasiou [EMAIL PROTECTED] writes:
but what's wrong with you original code?
I come from a functional programming school of thought, where you
avoid local variable declarations if at all possible.
Holding on to this principle won't help you write nice Python code :)
Although you will
26 matches
Mail list logo