Re: Usefulness of the "not in" operator

2011-10-10 Thread Steven D'Aprano
Tim Roberts wrote: > Westley Martínez wrote: >>On Sat, Oct 08, 2011 at 12:34:42PM -0400, Roy Smith wrote: >>> >>> Here's my take on parenthesis: If you need to look up whether they're >>> necessary or not, they are :-) >> >>So we don't need precedence charts in the bathroom? > > Yes, we do, be

Re: Usefulness of the "not in" operator

2011-10-10 Thread Tim Roberts
Westley Martínez wrote: >On Sat, Oct 08, 2011 at 12:34:42PM -0400, Roy Smith wrote: >> >> Here's my take on parenthesis: If you need to look up whether they're >> necessary or not, they are :-) > >So we don't need precedence charts in the bathroom? Yes, we do, because I'm always reading code f

Re: Question: Optional Regular Expression Grouping

2011-10-10 Thread galyle
On Oct 10, 4:59 pm, Vlastimil Brom wrote: > 2011/10/10 galyle : > > > > > > > > > > > HI, I've looked through this forum, but I haven't been able to find a > > resolution to the problem I'm having (maybe I didn't look hard enough > > -- I have to believe this has come up before).  The problem is t

Any tradeoffs or cautions in using virtualenv?

2011-10-10 Thread python
We're thinking about using virtualenv to isolate our development enivronments. Are there any tradeoffs or cautions we should consider before going this route? Are there other alternatives to virtualenv that we should consider? We are using Python 2.7 (32-bit) on Windows 7 Professional and Window

Re: Question: Optional Regular Expression Grouping

2011-10-10 Thread Ian Kelly
On Mon, Oct 10, 2011 at 4:49 PM, MRAB wrote: > Instead of "\S" I'd recommend using "[^\]]", or using a lazy repetition > "\S+?". Preferably the former. The core problem is that the regex matches ambiguously on the problem string. Lazy repetition doesn't remove that ambiguity; it merely attempts

Re: Question: Optional Regular Expression Grouping

2011-10-10 Thread Vlastimil Brom
2011/10/10 galyle : > HI, I've looked through this forum, but I haven't been able to find a > resolution to the problem I'm having (maybe I didn't look hard enough > -- I have to believe this has come up before).  The problem is this: > I have a file which has 0, 2, or 3 groups that I'd like to rec

Re: Question: Optional Regular Expression Grouping

2011-10-10 Thread MRAB
On 10/10/2011 22:57, galyle wrote: HI, I've looked through this forum, but I haven't been able to find a resolution to the problem I'm having (maybe I didn't look hard enough -- I have to believe this has come up before). The problem is this: I have a file which has 0, 2, or 3 groups that I'd li

Re: Regex to match all trailing whitespace _and_ newlines.

2011-10-10 Thread Dotan Cohen
On Thu, Sep 1, 2011 at 13:30, Peter Otten <__pete...@web.de> wrote: > Dotan Cohen wrote: > >> In the terrific Anki [1] application I am trying to remove trailing >> whitespace from form fields. This is my regex: >> [\n+\s+]$ > > My attempt: > sub = re.compile(r"\s*?(\n|$)").sub sub("", "a

Question: Optional Regular Expression Grouping

2011-10-10 Thread galyle
HI, I've looked through this forum, but I haven't been able to find a resolution to the problem I'm having (maybe I didn't look hard enough -- I have to believe this has come up before). The problem is this: I have a file which has 0, 2, or 3 groups that I'd like to record; however, in the case of

Re: Usefulness of the "not in" operator

2011-10-10 Thread Terry Reedy
On 10/10/2011 1:55 PM, Ian Kelly wrote: On Mon, Oct 10, 2011 at 11:33 AM, Chris Angelico wrote: On Tue, Oct 11, 2011 at 4:29 AM, Nobody wrote: The Church numeral for N is a function of two arguments which applies its first argument N times to its second, i.e. (f^N)(x) = f(f(...(f(x))...)).

Re: Python Migration Error: TypeError: exceptions must be old-style classes or derived from BaseException, not str

2011-10-10 Thread Terry Reedy
On 10/10/2011 11:13 AM, 8 dihedral wrote: I am thinking with the power of python evolving in different versions, if a feature is not desired in the new version, then the new version could also provide some script tools, of course in python, to convert codes in old styles into new styles auto

Re: [NUMPY] "ValueError: total size of new array must be unchanged" just on Windows

2011-10-10 Thread Paolo Zaffino
On Mac OS there is numpy 1.2.1, on Fedora 14 64bits numpy 1.4.1 and on Ubuntu 10.04 64bits numpy 1.3.0. On these platforms my function runs without problems. Just on Windows it doesn't works. 2011/10/9 Yaşar Arabacı > I don't know about your problem, but did you compare numpy versions in > wind

Re: Usefulness of the "not in" operator

2011-10-10 Thread Ian Kelly
On Mon, Oct 10, 2011 at 11:33 AM, Chris Angelico wrote: > On Tue, Oct 11, 2011 at 4:29 AM, Nobody wrote: >> >> The Church numeral for N is a function of two arguments which applies its >> first argument N times to its second, i.e. (f^N)(x) = f(f(...(f(x))...)). >> > > Thanks - nice clear explanat

Re: Usefulness of the "not in" operator

2011-10-10 Thread Chris Angelico
On Tue, Oct 11, 2011 at 4:29 AM, Nobody wrote: > > The Church numeral for N is a function of two arguments which applies its > first argument N times to its second, i.e. (f^N)(x) = f(f(...(f(x))...)). > Thanks - nice clear explanation. Appreciated. For an encore, can you give an example of where

Re: Usefulness of the "not in" operator

2011-10-10 Thread Nobody
On Sun, 09 Oct 2011 02:25:27 +0200, Alexander Kapps wrote: > Even if it's off-topic, could you add some similar explanations for > Church numerals (maybe Lambda calculus it isn't too much?) The Church numeral for N is a function of two arguments which applies its first argument N times to its se

Re: Python Migration Error: TypeError: exceptions must be old-style classes or derived from BaseException, not str

2011-10-10 Thread 88888 dihedral
I am thinking with the power of python evolving in different versions, if a feature is not desired in the new version, then the new version could also provide some script tools, of course in python, to convert codes in old styles into new styles automatically. -- http://mail.python.org/mailma

Re: OpenGL.GLU.gluNewQuadric() segmentation fault on 64 bit systems

2011-10-10 Thread Ulrich Eckhardt
Am 10.10.2011 14:18, schrieb X1: has this bug been resolved? if yes, which version on files to install? That seems to be part of PyOpenGL, so I'd check their bugtracking system. Uli -- http://mail.python.org/mailman/listinfo/python-list

Re: Usefulness of the "not in" operator

2011-10-10 Thread candide
Le 10/10/2011 10:06, John Ladasky a écrit : Who like that second one speaks? Yoda his name is. Programs in Forth he must. ;) We can add to the list : -- Tarzan -- Geronimo -- don Alexandro de la Vega dying in the arms of Zorro ... -- http://mail.python.org/mailman/listinfo/python-list

Re: Usefulness of the "not in" operator

2011-10-10 Thread Alec Taylor
Unfortunately I don't know lambda [or for that matter, regular] calculus... On Tue, Oct 11, 2011 at 12:01 AM, Alain Ketterlin wrote: > Alec Taylor writes: > >> On Sun, Oct 9, 2011 at 3:08 AM, Steven D'Aprano >> wrote: > >>> def true(x, y): >>>    return x >>> >>> def false(x, y): >>>    return

Re: Usefulness of the "not in" operator

2011-10-10 Thread Alain Ketterlin
Alec Taylor writes: > On Sun, Oct 9, 2011 at 3:08 AM, Steven D'Aprano > wrote: >> def true(x, y): >>    return x >> >> def false(x, y): >>    return y [...] >> def Nand(a, b): >>    return (lambda c: lambda x, y: c(y, x))(a(b, a)) >> >> and we're done. [...] > Awesome Yes, that's how Church d

Re: Usefulness of the "not in" operator

2011-10-10 Thread Alec Taylor
On Sun, Oct 9, 2011 at 3:08 AM, Steven D'Aprano wrote: > Roy Smith wrote: > >> If you want to take it one step further, all the boolean operators can >> be derived from nand (the dualists would insist on using nor). > > Let's define the boolean values and operators using just two functions: > > de

Re: Usefulness of the "not in" operator

2011-10-10 Thread John Ladasky
On Oct 8, 5:01 am, Steven D'Aprano wrote: > Who like that second one speaks? Yoda his name is. Programs in Forth he must. -- http://mail.python.org/mailman/listinfo/python-list

Re: Usefulness of the "not in" operator

2011-10-10 Thread Alexander Kapps
On 08.10.2011 18:08, Steven D'Aprano wrote: Let's define the boolean values and operators using just two functions: [SNIP] Have you just explained Church booleans in an understandable language? Awesome. I still have to chew on this, but I think this is the first time where I might understan