Dear Jean-Michel,
On Aug 18, 2010, at 10:57 AM, Jean-Michel Pichavant wrote:
At least, if you still want to stick with 79 chars, do something like
text = find(response, 'MPNExpirationDate', ).text
self.expiration_date = translate_date(text,'%Y-%m-%d', '%m%d%Y')
I don't necessarily like this e
On Aug 16, 2010, at 5:04 PM, Ian Kelly wrote:
On Mon, Aug 16, 2010 at 4:23 AM, Roald de Vries
wrote:
I suspect that there exists a largest unpurchasable quantity iff at
least two of the pack quantities are relatively prime, but I have
made
no attempt to prove this.
That for sure is not
On Aug 15, 2010, at 11:51 PM, Ian Kelly wrote:
On Sun, Aug 15, 2010 at 4:36 PM, Baba wrote:
Hi Mel,
indeed i thought of generalising the theorem as follows:
If it is possible to buy n, n+1,…, n+(x-1) sets of McNuggets, for
some
x, then it is possible to buy any number of McNuggets >= x, give
On Aug 15, 2010, at 2:16 PM, geremy condra wrote:
On Sun, Aug 15, 2010 at 4:55 AM, Roald de Vries
wrote:
On Aug 15, 2010, at 1:00 PM, Lawrence D'Oliveiro wrote:
It would be if pointers and arrays were the same thing in C. Only
they’re
not, quite. Which somewhat defeats the point of t
On Aug 7, 2010, at 9:14 PM, John Nagle wrote:
FORTRAN, MATLAB, and Octave all use 1-based subscripts.
The languages which have real multidimensional arrays, rather
than arrays of arrays, tend to use 1-based subscripts. That
reflects standard practice in mathematics.
True, but that somethi
On Aug 15, 2010, at 1:00 PM, Lawrence D'Oliveiro wrote:
It would be if pointers and arrays were the same thing in C. Only
they’re
not, quite. Which somewhat defeats the point of trying to make them
look the
same, don’t you think?
How are they not the same?
The code snippet (in C/C++) below
On Aug 13, 2010, at 12:25 PM, Roald de Vries wrote:
My previous algorithm was more efficient, but for those who like one-
liners:
[x for x in range(120) if any(20*a+9*b+6*c == x for a in range(x/20)
for b in range(x/9) for c in range(x/6))][-1]
OK, I did some real testing now, and there
On Aug 12, 2010, at 10:51 PM, John Posner wrote:
On 8/12/2010 9:22 AM, Dave Angel wrote:
Now you have to find the largest number below 120, which you can
easily do with brute force
tgt = 120 # thanks, Dave Angel
Anytime, but I'm not Dave Angel.
My previous algorithm was more efficient, b
On Aug 12, 2010, at 9:02 PM, Peter Otten wrote:
Baba wrote:
Thank You for helping me out. Indeed i am not looking for the code
but
rather for hints that direct my reasoning as well as hints as to how
to write basic programs like this.
You have broken down the approach into 2 parts. I have
On Aug 12, 2010, at 11:33 AM, Paul Rubin wrote:
Baba writes:
exercise: given that packs of McNuggets can only be bought in 6, 9 or
20 packs, write an exhaustive search to find the largest number of
McNuggets that cannot be bought in exact quantity.
Is that a homework problem? Hint: first con
Hi Bhanu,
On Aug 12, 2010, at 4:15 AM, Bhanu Kumar wrote:
Hi All,
Is there any good free python IDE available in Ubuntu?
See a similar discussion at django-users mailing list:
http://groups.google.com/group/django-users/browse_thread/thread/562189578285211
Cheers, Roald
--
http://mail.python
he 'a' variable in c2 it has the same
value as the 'a' variable in c1. Am I missing something?
I can't reproduce this. Which version are you using?
On Sun, Aug 8, 2010 at 4:59 PM, Roald de Vries
wrote:
Your problem probably is that a and b are class variables;
On Aug 8, 2010, at 3:32 PM, Costin Gament wrote:
Hi there.
I'm kind of a beginner with Python (and programming in general). My
problem is with initializing a class. Let's say I've defined it like
this:
class foo:
a = 0
b = 0
and later I'm trying to initialize two different classes like this
On Aug 7, 2010, at 5:24 PM, Nobody wrote:
On Sat, 07 Aug 2010 13:48:32 +0200, News123 wrote:
"Common sense" is wrong. There are many compelling advantages to
numbering from zero instead of one:
http://lambda-the-ultimate.org/node/1950
It makes sense in assembly language and even in many by
On Aug 7, 2010, at 3:53 PM, D'Arcy J.M. Cain wrote:
On Sat, 7 Aug 2010 15:37:23 +0200
Roald de Vries wrote:
Would said beginner also be surprised that a newborn baby is zero
years
old or would it be more natural to call them a one year old? Zero
based counting is perfectly natural.
Hi all,
I have a list that I'm iterating over, and during the iteration items
are appended. Moreover, it is iterated over in two nested loops. If
the inner loop comes to the end, I want the outer loop to append an
item. Is there a way to do this? Because once an iterator has raised a
Sto
On Aug 7, 2010, at 2:54 PM, D'Arcy J.M. Cain wrote:
On Sat, 07 Aug 2010 13:48:32 +0200
News123 wrote:
It makes sense in assembly language and even in many byte code
languages.
It makes sense if you look at the internal representation of unsigned
numbers (which might become an index)
For a co
On Aug 7, 2010, at 5:46 AM, Vito 'ZeD' De Tullio wrote:
Default User wrote:
From "the emperor's new clothes" department:
1) Why do Python lists start with element [0], instead of element
[1]?
"Common sense" would seem to suggest that lists should start with
[1].
http://userweb.cs.utexa
On Aug 6, 2010, at 9:25 AM, Bruno Desthuilliers wrote:
Roald de Vries a écrit :
'not None' first casts None to a bool, and then applies 'not', so
'x is not None' means 'x is True'.
Obviously plain wrong :
Python 2.6.2 (release26-maint, Apr 19 2009, 01
On Aug 5, 2010, at 6:11 PM, Chris Rebert wrote:
On Thu, Aug 5, 2010 at 8:56 AM, Roald de Vries
wrote:
On Aug 5, 2010, at 5:42 PM, wheres pythonmonks wrote:
How does "x is not None" make any sense? "not x is None" does
make sense.
I can only surmise that in this c
On Aug 5, 2010, at 5:42 PM, wheres pythonmonks wrote:
How does "x is not None" make any sense? "not x is None" does make
sense.
I can only surmise that in this context (preceding is) "not" is not a
unary right-associative operator, therefore:
x is not None === IS_NOTEQ(X, None)
Beside "not
Hi all,
I'm trying to create a metaclass that keeps track of its objects, and
implement this as a collections.MutableMapping. That is, something
like this:
class type2(type, MutableMapping):
...
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/abc.pyc in __n
Hi Andreas,
On Aug 3, 2010, at 1:52 AM, Andreas Pfrengle wrote:
I'm trying to define a subclass of int called int1. An int1-object
shall behave exactly like an int-object, with the only difference that
the displayed value shall be value + 1 (it will be used to display
array indices starting at 1
Hi W,
On Aug 3, 2010, at 4:38 PM, wheres pythonmonks wrote:
I think that the crux of the matter is in points #3, #4, and #5 that
you raised:
I think #2 is important too: a program is supposed to do what you
expect, and I don't expect instantiation of an ABC.
On #3: Not clear that all po
On Aug 3, 2010, at 2:46 PM, wheres pythonmonks wrote:
Hi!
I have a class (supposed to be an abstract base class):
In python (as opposed to static languages like C++) I don't seed to
subclass the base class, but instead I can simply override the
behavior of stub methods and values.
Is there a pre
On Jul 14, 2010, at 3:53 AM, Steven D'Aprano wrote:
On Tue, 13 Jul 2010 19:26:34 +0200, Roald de Vries wrote:
Hi all,
I have two objects that should both be able to alter a shared
float. So
i need something like a mutable float object, or a float reference
object. Does anybody kn
On Jul 14, 2010, at 3:53 AM, Steven D'Aprano wrote:
On Tue, 13 Jul 2010 19:26:34 +0200, Roald de Vries wrote:
Hi all,
I have two objects that should both be able to alter a shared
float. So
i need something like a mutable float object, or a float reference
object. Does anybody kn
On Jul 14, 2010, at 1:26 AM, Gary Herron wrote:
On 07/13/2010 03:02 PM, Roald de Vries wrote:
Hi Gary,
On Jul 13, 2010, at 8:54 PM, Gary Herron wrote:
On 07/13/2010 10:26 AM, Roald de Vries wrote:
Hi all,
I have two objects that should both be able to alter a shared
float.
So i need
Hi all,
I have two objects that should both be able to alter a shared float.
So i need something like a mutable float object, or a float reference
object. Does anybody know if something like that exists? I know it's
not hard to build, but I have a feeling that there should be a
standard s
On Jun 6, 2010, at 5:16 PM, rantingrick wrote:
Everyone knows i'm a Python fanboy so nobody can call me a troll for
this...
Python map is just completely useless. For one it so damn slow why
even bother putting it in the language? And secondly, the total "girl-
man" weakness of lambda renders it
On Apr 26, 2010, at 8:04 PM, gopi krishna wrote:
When I give a dictionary with key and value in order how can get
back iy in same order
I use YAML a lot, which supports ordered dicts, and these are
interpreted as lists of pairs by Python, so that might be a good choice.
--
http://mail.pyth
Dear all,
PEP 245 and 246 about interfaces for python are both rejected for
'something much better' (GvR in 246's rejection notice). Does anybody
know what this is? I am *very* curious!
Kind regards, Roald
--
http://mail.python.org/mailman/listinfo/python-list
Hi Luca,
On Feb 26, 2010, at 12:41 AM, Luca wrote:
MRAB wrote:
Perhaps you could use a different extension, eg ".pyn", so existing
".py" files are handled as-is but ".pyn" files are read through a
translator.
This could be a good idea... especially since i could make my own
extension since
On Feb 22, 2010, at 10:56 PM, AON LAZIO wrote:
That will be superb
I guess static typing will have to be added, so that tools like
eclipse can inspect (and autocomplete) your programs [better].
--
http://mail.python.org/mailman/listinfo/python-list
This pipeline idea has actually been implemented further, see .
from stream import map, filter, cut
range(10) >> map(lambda x: [x**2, x**3]) >> filter(lambda t: t[0]!
=25 and t[1]!=64) >> cut[1] >> list
[0, 1, 8, 27, 216, 343, 512, 729]
Wow, cool!
Just to show that you can easily add the itera
On Feb 18, 2010, at 5:28 PM, Stephen Hansen wrote:
On Thu, Feb 18, 2010 at 8:19 AM, Andrey Fedorov
wrote:
It seems intuitive to me that the magic methods for overriding the
+, -, <, ==, >, etc. operators should have no sideffects on their
operands. Also, that == should be commutative and tra
On Feb 5, 2010, at 12:03 AM, Julian wrote:
Hello,
I've asked this question at stackoverflow a few weeks ago, and to make
it clear: this should NOT be a copy of the stackoverflow-thread
"hidden features of Python".
I want to design a poster for an open source conference, the local
usergroup wil
On Jan 29, 2010, at 2:30 AM, Steven D'Aprano wrote:
On Thu, 28 Jan 2010 17:01:38 +0100, Roald de Vries wrote:
Question out of general interest in the language: If I would want to
generate such functions in a for-loop, what would I have to do? This
doesn't work:
class Move(object):
On Jan 22, 2010, at 11:56 AM, Roald de Vries wrote:
Hi Martin,
On Jan 21, 2010, at 8:43 AM, Martin Drautzburg wrote:
Hello all,
When passing parameters to a function, you sometimes need a paramter
which can only assume certain values, e.g.
def move (direction):
...
If
On Jan 27, 2010, at 2:01 PM, Jean Guillaume Pyraksos wrote:
What are the arguments for choosing Python against Ruby
for introductory programming ? Python has no provisions
for tail recursion, Ruby is going to... So what ?
Thanks,
I think the main difference is in culture, especially for
*in
On Jan 23, 2010, at 3:58 PM, Mark Dickinson wrote:
On Jan 23, 2:44 pm, Roald de Vries wrote:
I assume a function like 'naturals' already exists, or a similar
construction for the same purpose. But what is it called?
itertools.count()
On Jan 23, 2010, at 4:04 PM, Jan Kalisze
On Jan 23, 2010, at 3:49 PM, Diez B. Roggisch wrote:
Am 23.01.10 15:44, schrieb Roald de Vries:
Dear all,
I sometimes want to use an infinite while loop with access to the
loop
index, like this:
def naturals():
i = 0
while True:
yield i
y += 1
for i in naturals():
print(i)
I assume a
On Jan 23, 2010, at 3:50 PM, Grant Edwards wrote:
On 2010-01-23, Roald de Vries wrote:
Dear all,
I sometimes want to use an infinite while loop with access to the
loop
index, like this:
def naturals():
i = 0
while True:
yield i
y += 1
for i in naturals():
print(i
Dear all,
I sometimes want to use an infinite while loop with access to the loop
index, like this:
def naturals():
i = 0
while True:
yield i
y += 1
for i in naturals():
print(i)
I assume a function like 'naturals' already exists, or a similar
construction for the same
On Jan 22, 2010, at 1:06 PM, Martin Drautzburg wrote:
On 22 Jan., 11:56, Roald de Vries wrote:
Hi Martin,
On Jan 21, 2010, at 8:43 AM, Martin Drautzburg wrote:
Hello all,
When passing parameters to a function, you sometimes need a paramter
which can only assume certain values, e.g
Hi Martin,
On Jan 21, 2010, at 8:43 AM, Martin Drautzburg wrote:
Hello all,
When passing parameters to a function, you sometimes need a paramter
which can only assume certain values, e.g.
def move (direction):
...
If direction can only be "up", "down", "left" or "right",
On Dec 30, 2009, at 4:10 AM, Steve Holden wrote:
Roald de Vries wrote:
On Dec 30, 2009, at 2:28 AM, Dave Angel wrote:
Roald de Vries wrote:
On Dec 29, 2009, at 8:34 PM, Dave Angel wrote:
Antoine Pitrou wrote:
Le Tue, 29 Dec 2009 16:09:58 +0100, Roald de Vries a écrit :
Dear all,
Is it
On Dec 30, 2009, at 2:28 AM, Dave Angel wrote:
Roald de Vries wrote:
On Dec 29, 2009, at 8:34 PM, Dave Angel wrote:
Antoine Pitrou wrote:
Le Tue, 29 Dec 2009 16:09:58 +0100, Roald de Vries a écrit :
Dear all,
Is it possible for a Python script to detect whether it is running
On Dec 30, 2009, at 1:52 AM, Steven D'Aprano wrote:
On Tue, 29 Dec 2009 16:09:58 +0100, Roald de Vries wrote:
Dear all,
Is it possible for a Python script to detect whether it is running
interactively? It can be useful for e.g. defining functions that are
only useful in interactive mode.
On Dec 29, 2009, at 8:34 PM, Dave Angel wrote:
Antoine Pitrou wrote:
Le Tue, 29 Dec 2009 16:09:58 +0100, Roald de Vries a écrit :
Dear all,
Is it possible for a Python script to detect whether it is running
interactively? It can be useful for e.g. defining functions that are
only useful in
Dear all,
Is it possible for a Python script to detect whether it is running
interactively? It can be useful for e.g. defining functions that are
only useful in interactive mode.
Kind regards, Roald
--
http://mail.python.org/mailman/listinfo/python-list
51 matches
Mail list logo