Problem with my nose test plugin

2013-02-02 Thread Roald
although I see the configure() and option() get called and also see that nose runs my tests. What boggles my mind is that none of my plugins functions get called. Do I need to configure something? Roald the code is on pastbin: http://pastebin.com/rcXh2VAy -- http://mail.python.org/mailman/listinfo

Re: 79 chars or more?

2010-08-19 Thread Roald de Vries
her ) Moreover, the 'text = ...'-like statement, that are only used in the one statement after it, often interrupt a (more) logical sequence of variable assignments, and make your program a bit less readable. Cheers, Roald -- http://mail.python.org/mailman/listinfo/python-list

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-16 Thread Roald de Vries
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

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-16 Thread Roald de Vries
chasable quantity. I'm pretty sure that if there's no common divisor for all three (or more) packages (except one), there is a largest unpurchasable quantity. That is: ∀ i>1: ¬(i|a) ∨ ¬(i|b) ∨ ¬(i|c), where ¬(x| y) means "x is no divider of y" Cheers, Roald -- http://m

Re: Python "why" questions

2010-08-15 Thread Roald de Vries
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

Re: Python "why" questions

2010-08-15 Thread Roald de Vries
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

Re: Python "why" questions

2010-08-15 Thread Roald de Vries
n C/C++) below is valid, so arrays are just pointers. The only difference is that the notation x[4] reserves space for 4 (consecutive) ints, and the notation *y doesn't. int x[4]; int *y = x; Moreover, the following is valid (though unsafe) C/C++: int *x; int y = x[4]; Cheers, Roal

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-13 Thread Roald de Vries
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&#

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-13 Thread Roald de Vries
cient, 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] Cheers, Roald -- http://mail.python.org/mailman/listinfo/python-list

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-12 Thread Roald de Vries
ed. Second, can_buy(0) should return True, but the solution 0*6 + 0*9 + 0*20 is never tried; fix your ranges accordingly. Moreover: a, b and c can range over n_nuggets/6, n_nuggets/9 and n_nuggets/20 respectively. This will work, but does too much work. Cheers, Roald -- http://mail.python.

Re: looping through possible combinations of McNuggets packs of 6, 9 and 20

2010-08-12 Thread Roald de Vries
s in range(20): can_be_bought[twenties*20+nines*9+sixes*6] = True for i in reverse(range(120)): if not can_be_bought[i]: return i Cheers, Roald -- http://mail.python.org/mailman/listinfo/python-list

Re: python ide for ubuntu

2010-08-12 Thread Roald de Vries
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

Re: Class initialization

2010-08-08 Thread Roald de Vries
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;

Re: Class initialization

2010-08-08 Thread Roald de Vries
ology: they point to different instances). See http://docs.python.org/tutorial/classes.html#class-objects for more info. Cheers, Roald -- http://mail.python.org/mailman/listinfo/python-list

Re: Python "why" questions

2010-08-07 Thread Roald de Vries
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

Re: Python "why" questions

2010-08-07 Thread Roald de Vries
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.

iterators and continuing after a StopIteration

2010-08-07 Thread Roald de Vries
edges += edge.head.leaving_edges except StopIteration: pass Thanks in advance, cheers, Roald -- http://mail.python.org/mailman/listinfo/python-list

Re: Python "why" questions

2010-08-07 Thread Roald de Vries
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

Re: Python "why" questions

2010-08-07 Thread Roald de Vries
x27;m in favor of 1-based indices) One of the reasons I like python so much, is that you (almost) never have to use indices. Normally you just iterate over the elements. If I ever need indices, it's a strong indication that I actually want a dictionary. Cheers, Roald -- http://mail.python.org/mailman/listinfo/python-list

Re: easy question on parsing python: "is not None"

2010-08-06 Thread Roald de Vries
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

Re: easy question on parsing python: "is not None"

2010-08-05 Thread Roald de Vries
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

Re: easy question on parsing python: "is not None"

2010-08-05 Thread Roald de Vries
IS_NOTEQ(X, None) Beside "not in" which seems to work similarly, is there other syntactical sugar like this that I should be aware of? 'not None' first casts None to a bool, and then applies 'not', so 'x is not None' means 'x is True

abstract metaclass

2010-08-05 Thread Roald de Vries
ttr(cls, name, None) 87 if getattr(value, "__isabstractmethod__", False): TypeError: Error when calling the metaclass bases 'getset_descriptor' object is not iterable Anybody knows why? Every type is just an object, isn't it? Thanks in adva

Re: simple integer subclass

2010-08-03 Thread Roald de Vries
ased indices. class list1(list): def __new__(cls, *args, **kwargs): return list.__new__(cls, *args, **kwargs) def __getitem__(self, key): return list.__getitem__(self, key-1) ... etcetera Cheers, Roald -- http://mail.python.org/mailman/listinfo/python-list

Re: subclassing versus object redefinition

2010-08-03 Thread Roald de Vries
n me? http://docs.python.org/library/abc.html http://www.doughellmann.com/PyMOTW/abc/ Cheers, Roald PS: most people in this list prefer not top posting -- http://mail.python.org/mailman/listinfo/python-list

Re: subclassing versus object redefinition

2010-08-03 Thread Roald de Vries
you want a thinner class hierarchy? So I would go for inheritance. Cheers, Roald -- http://mail.python.org/mailman/listinfo/python-list

Re: floatref

2010-07-14 Thread Roald de Vries
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

Re: floatref

2010-07-14 Thread Roald de Vries
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

Re: floatref

2010-07-14 Thread Roald de Vries
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

floatref

2010-07-13 Thread Roald de Vries
ndard solution to it. Roald -- http://mail.python.org/mailman/listinfo/python-list

Re: map is useless!

2010-06-06 Thread Roald de Vries
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

Re: dictionary

2010-04-27 Thread Roald de Vries
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

Interfaces

2010-04-05 Thread Roald de Vries
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

Re: Renaming identifiers & debugging

2010-02-26 Thread Roald de Vries
n. I would be curious to hear about your results. Kind regards, Roald -- http://mail.python.org/mailman/listinfo/python-list

Re: When will Python go mainstream like Java?

2010-02-23 Thread Roald de Vries
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

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Roald de Vries
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

Re: Constraints on __sub__, __eq__, etc.

2010-02-19 Thread Roald de Vries
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

Re: Your beloved python features

2010-02-05 Thread Roald de Vries
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

Re: Symbols as parameters?

2010-01-29 Thread Roald de Vries
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):

Re: Symbols as parameters?

2010-01-28 Thread Roald de Vries
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

Re: Python and Ruby

2010-01-27 Thread Roald de Vries
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

Re: enumerated while loop

2010-01-23 Thread Roald de Vries
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

Re: enumerated while loop

2010-01-23 Thread Roald de Vries
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

Re: enumerated while loop

2010-01-23 Thread Roald de Vries
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

enumerated while loop

2010-01-23 Thread Roald de Vries
r the same purpose. But what is it called? Kind regards, Roald -- http://mail.python.org/mailman/listinfo/python-list

Re: Symbols as parameters?

2010-01-22 Thread Roald de Vries
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

Re: Symbols as parameters?

2010-01-22 Thread Roald de Vries
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",

Re: detect interactivity

2009-12-30 Thread Roald de Vries
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

Re: detect interactivity

2009-12-29 Thread Roald de Vries
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

Re: detect interactivity

2009-12-29 Thread Roald de Vries
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.

Re: detect interactivity

2009-12-29 Thread Roald de Vries
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

detect interactivity

2009-12-29 Thread Roald de Vries
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