Re: custom classes in sets

2005-02-13 Thread Steven Bethard
vegetax wrote: How can i make my custom class an element of a set? class Cfile: def __init__(s,path): s.path = path def __eq__(s,other): print 'inside equals' return not os.popen('cmp %s %s' % (s.path,other.path)).read() def __hashcode__(s): return s.path.__hashcode__() the idea is that

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-13 Thread Miki Tebeka
Hello Ilias, > d) Is it really neccessary that I dive into such adventures, to be able > to do the most natural thing like: "developing python extensions with > MinGW"? Writing a setup.py and running python setup.py build_ext --compiler=mingw32 works for me *without* any more work. Things c

RE: custom classes in sets

2005-02-13 Thread vegetax
Delaney, Timothy C (Timothy) wrote: > vegetax wrote: > >> def __hashcode__(s): return s.path.__hashcode__() > > Try __hash__ ... > > Tim Delaney sorry about the typo, it is indead __hash__() that i tried -- http://mail.python.org/mailman/listinfo/python-list

RE: custom classes in sets

2005-02-13 Thread Delaney, Timothy C (Timothy)
vegetax wrote: > def __hashcode__(s): return s.path.__hashcode__() Try __hash__ ... Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

custom classes in sets

2005-02-13 Thread vegetax
How can i make my custom class an element of a set? class Cfile: def __init__(s,path): s.path = path def __eq__(s,other): print 'inside equals' return not os.popen('cmp %s %s' % (s.path,other.path)).read() def __hashcode__(s): return s.path.__hashcode__() the idea is that it accepts

FS: O'Reilly Python Pocket Reference

2005-02-13 Thread Christopher Culver
I am offering for sale a copy of O'Reilly's _Python Pocket Reference_. It is the second edition, covering Python 2. It is in fine condition, with no broken spine or dog-earned pages. One might even believe it just came out of the bookstore. Asking price is US$4 plus shipping (USPS Media Mail within

Wow!, This chick is HOT! LZl6:Tu

2005-02-13 Thread Hottime
. -- Want to get laid tonight?? Find local girls now http://www.youandmeswing.com/index.php?ref_id=130 -- ,iy^3aQvw -- http://mail.python.org/mailman/listinfo/python-list

[FREE!] Swingers Websites! U@wvqqN

2005-02-13 Thread Hottime
. -- Want to get laid tonight?? Find local girls now http://www.youandmeswing.com/index.php?ref_id=130 -- ,iy^3aQvw -- http://mail.python.org/mailman/listinfo/python-list

Re: Kill GIL

2005-02-13 Thread Donn Cave
Quoth Dave Brueck <[EMAIL PROTECTED]>: ... | Another related benefit is that a lot of application state is implicitly and | automatically managed by your local variables when the task is running in a | separate thread, whereas other approaches often end up forcing you to think in | terms of a sta

FCGI Help?

2005-02-13 Thread Kevin T. Ryan
Hi All - I'm trying to develop web applications using python / Cheetah. I'm also trying to experiment with lighttpd (see www.lighttpd.net), which supports fast-cgi. So, I downloaded Robin Dunn's fcgi.py file (http://alldunn.com/python/fcgi.py), and everything is up and running nicely. Except,

Re: OS env for Windows

2005-02-13 Thread python newbie
Cool thanks a lot. Always wanted to use win32api module too. "Tony Meyer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> Is there any other way >> of distinguishing between XP and 2000 I wonder? > > WinXP SP2: > import win32api major, minor, spack, platform, ver_str = win

Re: For American numbers

2005-02-13 Thread JanC
Peter Hansen schreef: > Given the clear "units='bytes'" default above, and my restricting > my comments to "the rest of the computer world", it should be > clear I was talking about a very limited subset of the planet. > > A subset, however, which has an extremely strong attachment to > 1024 inst

Re: Newbie help

2005-02-13 Thread Michael Hartl
Sorry about the code: Google Groups screwed up the formatting, but I hope you get the picture. -- http://mail.python.org/mailman/listinfo/python-list

Re: For American numbers

2005-02-13 Thread Dave Brueck
Peter Hansen wrote: Martin v. Löwis wrote: Peter Hansen wrote: For the rest of the computer world, unless I've missed a changing of the guard or something, "kilo" is 1024 and "mega" is 1024*1024 and so forth... In case this isn't clear yet: you have missed a changing of the guard or something. "kib

Re: Newbie help

2005-02-13 Thread Michael Hartl
You need to put the "You guessed it..." block inside a conditional (if guess == number) so that it only executes if the guess is right. (You also need to break out of the loop in that case.) As written, the "You guessed it..." block executes the first time through the loop regardless of the guess

Re: Kill GIL

2005-02-13 Thread Dave Brueck
Mike Meyer wrote: [EMAIL PROTECTED] (Aahz) writes: In article <[EMAIL PROTECTED]>, Mike Meyer <[EMAIL PROTECTED]> wrote: Here here. I find that threading typically introduces worse problems than it purports to solve. Threads are also good for handling blocking I/O. Actually, this is one of the c

Help with embedding fully qualified script name

2005-02-13 Thread Jim Wallace
I'm trying to call a method in a script file given a fully qualified file name, e.g. c:\myscript\test.py. I find that PyImport_Import("test") works fine, with c:\myscript is set as the first item in the PYTHONPATH. I tried PyRun_Simple and that does run my specific file, but then when I try to

Re: SCons build tool speed

2005-02-13 Thread Jeff Epler
On Sun, Feb 13, 2005 at 08:39:10PM -0500, Peter Hansen wrote: > That answer, combined with Mike's response pointing out > that tools more sophisticated than basic "make" actually > can delve into the source and identify the dependencies, Argh argh argh. Of course you can write a makefile to "delv

Newbie help

2005-02-13 Thread Chad Everett
Hey guys, Hope you can help me again with another problem. I am trying to learn Python on my own and need some help with the following. I am writing a program that lets has the pc pick a number and the user has five guess to get the number. 1. BUG: If the number is say 35 and I guess 41 the pr

Re: Kill GIL

2005-02-13 Thread Nick Coghlan
Mike Meyer wrote: [EMAIL PROTECTED] (Aahz) writes: Threads are also good for handling blocking I/O. Actually, this is one of the cases I was talking about. I find it saner to convert to non-blocking I/O and use select() for synchronization. That solves the problem, without introducing any of the he

Re: For American numbers

2005-02-13 Thread Erik Max Francis
Peter Hansen wrote: I'll be one of the last holdouts, too... it's really not so hard to work in powers of two if you try... The difficulty isn't with working in powers of 1024, it's that the terms are used inconsistently even within the computing industry. Memory is measured in kibibytes, but d

Re: For American numbers

2005-02-13 Thread Michael Hoffman
Nick Coghlan wrote: My mistake - IEC, not ISO :) For all intents and purposes an IEC standard should be as good as an ISO one. They usually develop standards for different areas, or jointly if it is an overlapping area (but ISO/IEC standards are usually referred to as "ISO standards"). -- Michael H

Re: builtin functions for and and or?

2005-02-13 Thread Nick Coghlan
Roose wrote: It would be a lot simpler if it was included in the distribution. I would be willing to add it (even though it is completely trivial). I think it would go fine in itertools (I would even put them as builtins, but I'm not going to go there because probably not everyone uses it as ofte

Re: Considering python - have a few questions.

2005-02-13 Thread Grumman
I would want the program to run in Windows for sure. If it could work on a Mac and other systems, that would be a plus. btw - I have the database designed (and the program info database filled) in Access If running on a Mac really is a goal, ditch Access, its windows only. You'd want to lo

Re: Alternative to raw_input ?

2005-02-13 Thread Michael Hoffman
Francis Girard wrote: [den]: import msvcrt msvcrt.getch() I frequently had the problem to have something similar but *portable*. Something as short and simple. This has been brought up many times on this newsgroup. The answer is that there is no simple way to do this portably. You could use Python'

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-13 Thread Michael Hoffman
Ilias Lazaridis wrote: a) Why does the Python Foundation not provide additionally a binary version, compiled with MinGW or another open-source compiler? I use a binary version of Python compiled with an open-source compiler on Windows that was provided by someone else. b) Why does the Python Found

Re: OS env for Windows

2005-02-13 Thread StvB
If Cary Grant's ghost was into Python and saw this good info, he'd say: "That's just ducky." But he's probably not. Ok Thanks Tony - I've always wanted to try out win32api module. Just what I need. "Tony Meyer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> Is there any other w

Re: Kill GIL

2005-02-13 Thread Aahz
In article <[EMAIL PROTECTED]>, Frans Englich <[EMAIL PROTECTED]> wrote: > >Personally I need a solution which touches this discussion. I need to run >multiple processes, which I communicate with via stdin/out, simultaneously, >and my plan was to do this with threads. Any favorite document point

Re: [PATCH] Re: frozenset() without arguments should return a singleton

2005-02-13 Thread Raymond Hettinger
"Stefan Behnel" > I generally believe that many programmers will > silently expect frozenset() to be (and become) more efficient than set() - in > whatever regard: processing, memory, etc. That belief is without foundation. Except for mutating methods and hashing methods, both set() and frozenset

Re: For American numbers

2005-02-13 Thread Peter Hansen
Martin v. Löwis wrote: Peter Hansen wrote: For the rest of the computer world, unless I've missed a changing of the guard or something, "kilo" is 1024 and "mega" is 1024*1024 and so forth... In case this isn't clear yet: you have missed a changing of the guard or something. "kibi" is 1024, "mebi"

Re: For American numbers

2005-02-13 Thread Peter Hansen
Alan Kennedy wrote: [Peter Hansen] For the rest of the computer world, unless I've missed a changing of the guard or something, "kilo" is 1024 and "mega" is 1024*1024 and so forth... Maybe you missed these? http://en.wikipedia.org/wiki/Kibibyte http://en.wikipedia.org/wiki/Mebibyte http://en.wikipe

Re: Second posting - Howto connect to MsSQL

2005-02-13 Thread ech0
You can also use pymssql. I've used it before on a little project. It looks like it works on linux too. http://pymssql.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: SCons build tool speed

2005-02-13 Thread Peter Hansen
[EMAIL PROTECTED] wrote: You're right that build times are dominated by the external commands when rebuilds occur. If nothing needs to be rebuilt, though, the wall-clock time is obviously dominated by how long it takes for the build tool to decide that. A build tool that doesn't decide whether or

Re: For American numbers

2005-02-13 Thread Nick Coghlan
Mike Meyer wrote: From what I found http://physics.nist.gov/cuu/Units/binary.html , it's not clear those are ISO prefixes yet - but they have been adapted by some standards agencies. Possibly you have better references? My mistake - IEC, not ISO :) And I did get one wrong in my sample code - it'

Re: win32 extension install hiccup

2005-02-13 Thread Kartic
MM said the following on 2/13/2005 4:50 PM: Hi, I downloaded the latest win32all build 202 and tried to install under win2000 with Py2.4. Install complains about 'couldn't open py2.4 to run script pywin32-preinstall.py'. I checked the directories and there was no sign of this file (preinstall.py

RE: OS env for Windows

2005-02-13 Thread Tony Meyer
> Is there any other way > of distinguishing between XP and 2000 I wonder? WinXP SP2: >>> import win32api >>> major, minor, spack, platform, ver_str = win32api.GetVersionEx() >>> print major, minor, spack, platform, ver_str 5 1 2600 2 Service Pack 2 WinNT SP4: >>> import win32api >>> major, min

Re: help please

2005-02-13 Thread Steven Bethard
gargonx wrote: let's take the word "dogs" ext = dict("D":"V1", "O":"M1", "G":"S1") std = dict("S":"H") encode("DOGS") # proc() we'll get: "V1M1S1H" let's say i want to do just the opposite word: "V1M1S1H" decode("V1M1S1H") #how do i decode "V1" to "D", how do i keep the "V1" together? an

OS env for Windows

2005-02-13 Thread StvB
Hi, have wxHtmlWindow question here. On my OnLinkClicked handler, I do the following: --- def OnLinkClicked(self,linkinfo): f = wx.TheMimeTypesManager.GetFileTypeFromExtension('.html') if not f: return try: cmd = wx.FileType.GetOpenCommand(f,linkinfo.GetHre

Re: Kill GIL

2005-02-13 Thread Frans Englich
On Monday 14 February 2005 00:53, Aahz wrote: > In article <[EMAIL PROTECTED]>, Mike Meyer <[EMAIL PROTECTED]> wrote: > >[EMAIL PROTECTED] (Aahz) writes: > >> In article <[EMAIL PROTECTED]>, Mike Meyer <[EMAIL PROTECTED]> wrote: > >>>Here here. I find that threading typically introduces worse p

Re: Pythonic poker client

2005-02-13 Thread Paul Rubin
[EMAIL PROTECTED] writes: > I'm assuming that I need to figure out the port it uses, find the > server, analyze the packets for commands, and then build an app that > masquerades as the real client. > > Anyone have any experience with this? If you mean you want to write your own real-money poker

Re: Kill GIL

2005-02-13 Thread Aahz
In article <[EMAIL PROTECTED]>, Mike Meyer <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] (Aahz) writes: >> In article <[EMAIL PROTECTED]>, Mike Meyer <[EMAIL PROTECTED]> wrote: >>> >>>Here here. I find that threading typically introduces worse problems >>>than it purports to solve. >> >> Threads

Re: Kill GIL

2005-02-13 Thread Paul Rubin
Mike Meyer <[EMAIL PROTECTED]> writes: > > Threads are also good for handling blocking I/O. > > Actually, this is one of the cases I was talking about. I find it > saner to convert to non-blocking I/O and use select() for > synchronization. That solves the problem, without introducing any of > the

Re: builtin functions for and and or?

2005-02-13 Thread Michael Spencer
Roose wrote: Previous discussion on this topic: http://groups-beta.google.com/group/comp.lang.python/msg/a76b4c2caf6c435c Michael OK, well then. That's really the exact same thing, down to the names of the functions. So what ever happened to that? I don't recall: probably http://www.google.c

Re: Pythonic poker client

2005-02-13 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: I'm assuming that I need to figure out the port it uses, find the server, analyze the packets for commands, and then build an app that masquerades as the real client. Anyone have any experience with this? If you're using one of the major sites, what you are trying to do is

Re: PyQt and Python 2.4 - also WinXP LnF?

2005-02-13 Thread Simon John
After building with MSVC6 (Python 2.3.5 and 2.4 versions) I've noticed that the ToolTips don't seem to work in the GPL version. MSVC6 is about twice as fast to build as MinGW. -- http://mail.python.org/mailman/listinfo/python-list

Re: Kill GIL

2005-02-13 Thread Courageous
>Actually, this is one of the cases I was talking about. I find it >saner to convert to non-blocking I/O and use select() for >synchronization. That solves the problem, without introducing any of >the headaches related to shared access and locking that come with >threads. Threads aren't always th

Re: builtin functions for and and or?

2005-02-13 Thread Roose
> Previous discussion on this topic: > http://groups-beta.google.com/group/comp.lang.python/msg/a76b4c2caf6c435c > > Michael > OK, well then. That's really the exact same thing, down to the names of the functions. So what ever happened to that? That was over a year ago! I don't see any mention

Re: Iterator / Iteratable confusion

2005-02-13 Thread Michael Spencer
"Francis Girard" <[EMAIL PROTECTED]> wrote in message an "iterator" doesn't have to support the "__iter__" method Terry Reedy wrote: Yes it does. iter(iterator) is iterator is part of the iterater protocol for the very reason you noticed... But, notwithstanding the docs, it is not essential t

Your message to RT-Announce awaits moderator approval

2005-02-13 Thread rt-announce-bounces
Your mail to 'RT-Announce' with the subject Delivery service mail Is being held until the list moderator can review it for approval. The reason it is being held: Post by non-member to a members-only list Either the message will get posted to the list, or you will receive notification o

Re: builtin functions for and and or?

2005-02-13 Thread Michael Spencer
Roose wrote: Yeah, as we can see there are a million ways to do it. But none of them are as desirable as just having a library function to do the same thing. I'd argue that since there are so many different ways, we should just collapse them into one: any() and all(). That is more in keeping wit

Re: Second posting - Howto connect to MsSQL

2005-02-13 Thread John Fabiani
John Fabiani wrote: > Hi, > Since this is (sort of) my second request it must not be an easy solution. > Are there others using Python to connect MsSQL? At the moment I'd accept > even a windows solution - although, I'm looking for a Linux solution. > > John Thanks all - it looks like it will wo

Re: Iterator / Iteratable confusion

2005-02-13 Thread Michael Spencer
Francis Girard wrote: """ Example 8 Running after your tail with itertools.tee The beauty of it is that recursive running after their tai

Re: builtin functions for and and or?

2005-02-13 Thread Roose
Yeah, as we can see there are a million ways to do it. But none of them are as desirable as just having a library function to do the same thing. I'd argue that since there are so many different ways, we should just collapse them into one: any() and all(). That is more in keeping with the python

Re: builtin functions for and and or?

2005-02-13 Thread Roose
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > So usually I just write a little function any( L, boolean_function = > > identity ) or all( ... ). But I am kind of sick of doing that all the > > time -- does it exist anywhere in the Python libraries? It seems r

Re: win32 extension install hiccup

2005-02-13 Thread steen
MM wrote: > Hi, > > I downloaded the latest win32all build 202 and tried to install under > win2000 with Py2.4. Install complains about 'couldn't open py2.4 to run > script pywin32-preinstall.py'. I checked the directories and there was > no sign of this file (preinstall.py) so I presume this is

Re: builtin functions for and and or?

2005-02-13 Thread Brian Beck
George Sakkis wrote: You're right, it doesn't short circuit, as most of the examples posted above. Here's one that it does: ... I also looked into taking advantage of itertools' dropwhile, but the all and any recipes included in the itertools documentation do short-circuit and don't require the

Re: Iterator / Iteratable confusion

2005-02-13 Thread Terry Reedy
"Francis Girard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > An ""iteratable"" class is a class supporting the __iter__ method which > should > return an ""iterator"" instance, that is, an instance of a class > supporting > the "next" method. Not quite right, see below. > An

Re: builtin functions for and and or?

2005-02-13 Thread bearophileHUGS
In Python there are so many ways to do things... This looks like another one, I haven't tested it: not False in imap(pred, iterable) As usual tests are required to measure the faster one. I agree with Roose, there are are some "primitive" operations (like this, and flatten, partition, mass remova

Pythonic poker client

2005-02-13 Thread hardieca
Hi all, My PC finally went belly up last week and I'm looking forward to playing with my new Mac. However, I play a bit of online poker, and there is no Mac client for my poker room. Ideally, instead of running Virtual PC, I'd much rather build a custom poker client with Python. It's an idea I've

Re: AES crypto in pure Python?

2005-02-13 Thread Lucas Raab
[EMAIL PROTECTED] wrote: I'm looking for an implementation of AES (the Advanced Encryption Standard) in pure Python. I'm aware of pycrypto, but that uses C code. I'm hoping to find something that only uses Python...I'm willing to trade speed for portability, since my application is designed for s

Your message to RT-Announce awaits moderator approval

2005-02-13 Thread rt-announce-bounces
Your mail to 'RT-Announce' with the subject You are made active Is being held until the list moderator can review it for approval. The reason it is being held: Post by non-member to a members-only list Either the message will get posted to the list, or you will receive notification of

Re: win32 extension install hiccup

2005-02-13 Thread John Machin
MM wrote: > Hi, > > I downloaded the latest win32all build 202 and tried to install under > win2000 with Py2.4. Install complains about 'couldn't open py2.4 to run > script pywin32-preinstall.py'. I checked the directories and there was > no sign of this file (preinstall.py) so I presume this is

Re: help please

2005-02-13 Thread gargonx
let's take the word "dogs" ext = dict("D":"V1", "O":"M1", "G":"S1") std = dict("S":"H") encode("DOGS") # proc() we'll get: "V1M1S1H" let's say i want to do just the opposite word: "V1M1S1H" decode("V1M1S1H") #how do i decode "V1" to "D", how do i keep the "V1" together? and get: "DOGS

Tkinter option_add for menu radiobutton

2005-02-13 Thread Bob Greschke
Root.option_add("*Menu.Font", "Veranda 9") as an example, works fine in my program. Root.option_add("*Radiobutton*selectColor", "black") also works fine for regular radiobuttons. What I can't do is get the selectColor of the radiobutton's in the menu to be black...the x.add_radiobutton() ones.

Re: builtin functions for and and or?

2005-02-13 Thread George Sakkis
"Roose" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I need this a lot: a one line way to do a n-ary and or 'or'. > > e.g., > > result = True > for x in L: > if not boolean_function(x): > result = False > > or > > >>> reduce(operator.__and__, [boolean_function(x) for x in L)

AES crypto in pure Python?

2005-02-13 Thread andrew . fabbro
I'm looking for an implementation of AES (the Advanced Encryption Standard) in pure Python. I'm aware of pycrypto, but that uses C code. I'm hoping to find something that only uses Python...I'm willing to trade speed for portability, since my application is designed for several different platform

Re: builtin functions for and and or?

2005-02-13 Thread Brian Beck
Steven Bethard wrote: Another alternative: not False in (bool(x) for x in L) Note that this should short-circuit, where min won't. Steve Whoops, for some reason the thought that short-circuiting didn't apply to And entered my mind while trying to post a nice solution. Hard to say why considering

Re: builtin functions for and and or?

2005-02-13 Thread John Machin
Michael Hartl wrote: > I warmly recommend downloading Peter Norvig's Python utilities file > (http://aima.cs.berkeley.edu/python/utils.py) and putting it on your > Python path. (E.g., in bash, put a line like > > export PYTHONPATH="/path/to/utilities_directory" > > in your .bashrc file.) The uti

Re: builtin functions for and and or?

2005-02-13 Thread Steven Bethard
Brian Beck wrote: Roose wrote: I need this a lot: a one line way to do a n-ary and or 'or'. Here's a one-liner for the n-ary and: bool(min(bool(x) for x in L)) py> bool(min(bool(x) for x in [1, 1, 1, 0])) False py> bool(min(bool(x) for x in [1, 1, 1, 1])) True py> bool(min(bool(x) for x in ['a', ''

Re: Second posting - Howto connect to MsSQL

2005-02-13 Thread Martin Bless
On Sun, 13 Feb 2005 17:57:34 GMT, John Fabiani <[EMAIL PROTECTED]> wrote: >Are there others using Python to connect MsSQL? Hi, direct your attention to http://www.object-craft.com.au/projects/mssql/ I once tried it as a little test - it worked. I would love to use it these days - unfortunately

Re: Kill GIL

2005-02-13 Thread Mike Meyer
[EMAIL PROTECTED] (Aahz) writes: > In article <[EMAIL PROTECTED]>, Mike Meyer <[EMAIL PROTECTED]> wrote: >> >>Here here. I find that threading typically introduces worse problems >>than it purports to solve. > Threads are also good for handling blocking I/O. Actually, this is one of the cases I

Re: win32 extension install hiccup

2005-02-13 Thread "Martin v. Löwis"
MM wrote: I downloaded the latest win32all build 202 and tried to install under win2000 with Py2.4. Install complains about 'couldn't open py2.4 to run script pywin32-preinstall.py'. I checked the directories and there was no sign of this file (preinstall.py) so I presume this is why it bombed.

Re: For American numbers

2005-02-13 Thread Mike Meyer
Nick Coghlan <[EMAIL PROTECTED]> writes: > Peter Hansen wrote: >> Only for hard drive manufacturers, perhaps. >> For the rest of the computer world, unless I've missed >> a changing of the guard or something, "kilo" is 1024 >> and "mega" is 1024*1024 and so forth... > > Given that there are perfec

Re: help please

2005-02-13 Thread Steven Bethard
gargonx wrote: Well that seems to work like a champion, but my prob then would be; how do i get the double character values of ext to turn back to the single character keys. The reversed (decode if you will). It's unclear what you want to do here. If you have say: ext = dict(aa='A', ab='B', bb='C'

Re: builtin functions for and and or?

2005-02-13 Thread Brian Beck
Roose wrote: I need this a lot: a one line way to do a n-ary and or 'or'. Here's a one-liner for the n-ary and: bool(min(bool(x) for x in L)) py> bool(min(bool(x) for x in [1, 1, 1, 0])) False py> bool(min(bool(x) for x in [1, 1, 1, 1])) True py> bool(min(bool(x) for x in ['a', '', 'b', 'c'])) Fals

Re: builtin functions for and and or?

2005-02-13 Thread Brian Beck
Brian Beck wrote: def all(seq, pred=bool): "Returns True if pred(x) is True for every element in the iterable" for elem in ifilterfalse(pred, seq): return False return True def any(seq, pred=bool): "Returns True if pred(x) is True for at least one element in the iterable"

Re: builtin functions for and and or?

2005-02-13 Thread Steven Bethard
Roose wrote: I need this a lot: a one line way to do a n-ary and or 'or'. e.g., result = True for x in L: if not boolean_function(x): result = False or reduce(operator.__and__, [boolean_function(x) for x in L) Can you use itertools? py> def boolfn(x): ... print "boolfn: %r" % x ... re

Re: builtin functions for and and or?

2005-02-13 Thread Brian Beck
Roose wrote: I need this a lot: a one line way to do a n-ary and or 'or'. Looks like there are itertools recipes for those, similar to what Michael just posted. Taken from here: http://docs.python.org/lib/itertools-recipes.html def all(seq, pred=bool): "Returns True if pred(x) is True for ev

Re: builtin functions for and and or?

2005-02-13 Thread Michael Hartl
I warmly recommend downloading Peter Norvig's Python utilities file (http://aima.cs.berkeley.edu/python/utils.py) and putting it on your Python path. (E.g., in bash, put a line like export PYTHONPATH="/path/to/utilities_directory" in your .bashrc file.) The utils.py file defines many useful fun

win32 extension install hiccup

2005-02-13 Thread MM
Hi, I downloaded the latest win32all build 202 and tried to install under win2000 with Py2.4. Install complains about 'couldn't open py2.4 to run script pywin32-preinstall.py'. I checked the directories and there was no sign of this file (preinstall.py) so I presume this is why it bombed. How d

Re: Q: Portable Way to Make Files Read Only

2005-02-13 Thread Christopher De Vries
On Sun, Feb 13, 2005 at 01:25:02PM -0600, Efrat Regev wrote: > I would like to recurse through a directory and make files (which match > a specific criteria) read only. From searching the Internet, I found > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303343 > which shows how to

Re: help please

2005-02-13 Thread gargonx
Well that seems to work like a champion, but my prob then would be; how do i get the double character values of ext to turn back to the single character keys. The reversed (decode if you will). Thanks a lot Steve this has been a great learning! -- http://mail.python.org/mailman/listinfo/python-li

Re: sre is broken in SuSE 9.2

2005-02-13 Thread "Martin v. Löwis"
Denis S. Otkidach wrote: You are right. But isalpha behavior looks strange for me anyway: why cyrillic character '\u0430' is recognized as alpha one for de_DE locale, but is not for C? In glibc, all "real" locales are based on /usr/share/locale/i18n/locales/i18n, e.g. for de_DE through LC_CTYPE co

Re: For American numbers

2005-02-13 Thread Erik Max Francis
Dan Bishop wrote: They must have gotten the idea from floppy disks, which also use a 1024000-byte "megabyte". It's pretty common industry-wide. Memory is measured in binary prefixes (x 1024), but disk space and bandwidth are measured in decimal prefixes (x 1000). -- Erik Max Francis && [EMAIL P

Re: builtin functions for and and or?

2005-02-13 Thread Diez B. Roggisch
> So usually I just write a little function any( L, boolean_function = > identity ) or all( ... ). But I am kind of sick of doing that all the > time -- does it exist anywhere in the Python libraries? It seems really > common to me. Put things into your own module and add it to your python path.

builtin functions for and and or?

2005-02-13 Thread Roose
I need this a lot: a one line way to do a n-ary and or 'or'. e.g., result = True for x in L: if not boolean_function(x): result = False or >>> reduce(operator.__and__, [boolean_function(x) for x in L) So usually I just write a little function any( L, boolean_function = identity ) or all(

Re: changing __call__ on demand

2005-02-13 Thread Alan McIntyre
Thanks; I didn't read close enough. :) -- Alan McIntyre ESRG LLC http://www.esrgtech.com Michael Hoffman wrote: Alan McIntyre wrote: >>>class test(object): ...def __call1(self): ...print 1 ...__call__ = __call1 Is that what you were looking for? That still only allows him to have o

Re: RFC 2965 cookies, cookielib, and mailman.

2005-02-13 Thread Titus Brown
For the record, re http://mail.python.org/pipermail/python-list/2004-December/257422.html and http://www.gossamer-threads.com/lists/python/python/380607 cheers, --titus - Forwarded message from John J Lee <[EMAIL PROTECTED]> - X-Original-To: [EMAIL PROTECTED] From: John J Lee <[EMAIL

Re: help please

2005-02-13 Thread Steven Bethard
gargonx wrote: yes the items in std are always single to single, and ext single to double. basicly the ext are refernce to the std itmes. the second character in ext is a number depending on how far it is from the item in std. this is just a simple encoding program. If your keys are always single c

Re: For American numbers

2005-02-13 Thread Jong dejongconsunet
Dan Bishop schreef: Nick Craig-Wood wrote: Peter Hansen <[EMAIL PROTECTED]> wrote: Only for hard drive manufacturers, perhaps. For the rest of the computer world, unless I've missed a changing of the guard or something, "kilo" is 1024 and "mega" is 1024*1024 and so forth... Yes. Unless you work in

Re: For American numbers

2005-02-13 Thread "Martin v. Löwis"
Peter Hansen wrote: For the rest of the computer world, unless I've missed a changing of the guard or something, "kilo" is 1024 and "mega" is 1024*1024 and so forth... In case this isn't clear yet: you have missed a changing of the guard or something. "kibi" is 1024, "mebi" is 1024*1024 and so fort

Re: help please

2005-02-13 Thread gargonx
yes the items in std are always single to single, and ext single to double. basicly the ext are refernce to the std itmes. the second character in ext is a number depending on how far it is from the item in std. this is just a simple encoding program. -- http://mail.python.org/mailman/listinfo/py

Re: sre is broken in SuSE 9.2

2005-02-13 Thread "Martin v. Löwis"
Serge Orlov wrote: Emphasis is mine. So how many libc implementations with non-unicode wide-character codes do we have in 2005? Solaris has supported 2-byte wchar_t implementations for many years, and so I believe did HP-UX and AIX. ISO C99 defines a constant __STDC_ISO_10646__ which an implementat

Re: Second posting - Howto connect to MsSQL

2005-02-13 Thread Kent Johnson
John Fabiani wrote: Hi, Since this is (sort of) my second request it must not be an easy solution. Are there others using Python to connect MsSQL? At the moment I'd accept even a windows solution - although, I'm looking for a Linux solution. On Windows, you can use http://sourceforge.net/projects

Re: changing __call__ on demand

2005-02-13 Thread Kent Johnson
Stefan Behnel wrote: Hi! This somewhat puzzles me: Python 2.4 (#1, Feb 3 2005, 16:47:05) [GCC 3.3.4 (pre 3.3.5 20040809)] on linux2 Type "help", "copyright", "credits" or "license" for more information. .>>> class test(object): ... def __init__(self): ... self.__call__ = self.__call1 ... d

Re: A great Alan Kay quote

2005-02-13 Thread Francis Girard
Le dimanche 13 Février 2005 19:05, Arthur a écrit : > On Sun, 13 Feb 2005 18:48:03 +0100, Francis Girard > > > >My deepest apologies, > > > >Francis Girard > > Sorry if I helped get you into this, Francis. > No, no, don't worry. I really expressed my own opinions and feelings. At the same time, I

Re: Second posting - Howto connect to MsSQL

2005-02-13 Thread Diez B. Roggisch
John Fabiani wrote: > Hi, > Since this is (sort of) my second request it must not be an easy solution. > Are there others using Python to connect MsSQL? At the moment I'd accept > even a windows solution - although, I'm looking for a Linux solution. Use unix-odbc and a mssql driver for unxi-odb

Iterator / Iteratable confusion

2005-02-13 Thread Francis Girard
Hi, I wrote simple dummy examples to teach to myself iterators and generators. I think that the iteration protocol brings a very neat confusion between the iterator and what it iterates upon (i.e. the iteratable). This is outlined in "example 3" in my dummy examples. What are your feelings abo

Re: Zope: Adding a layer causes valid output to become an object reference?

2005-02-13 Thread Dieter Maurer
"Junkmail" <[EMAIL PROTECTED]> writes on 10 Feb 2005 18:26:52 -0800: > I've been playing with Zope for about a year and took the plunge last > week into making a product. You should send Zope related questions to the Zope mailing list. You will need to subcribe. You can do this at "http://www.zope

[EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-13 Thread Ilias Lazaridis
I'm a newcomer to python: [EVALUATION] - E01: The Java Failure - May Python Helps? http://groups-beta.google.com/group/comp.lang.python/msg/75f0c5c35374f553 - I've download (as suggested) the python 2.4 installer for windows. Now I have problems to compile python extension that some packages depen

  1   2   >