Re: writing unicode apps in python - some beginner questions.

2005-02-13 Thread Fredrik Lundh
WX wrote: The character set I am using is the Hindi/Devanagari character set at unicode range U+901.) (#1) If I paste some unicode stuff from the clipboard into IDLE, it accepts it, but it can't execute a PRINT command like this: print u?? ?? Unsupported characters in input

Re: writing unicode apps in python - some beginner questions.

2005-02-13 Thread News M Claveau /Hamster-P
Hi! XP unicode view depend, also, of the uniscribe motor version. The last version come with SP-2. Other element : is the font Arial Unicode MS installed ? @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: dos box appears when clicking .pyc

2005-02-13 Thread Tim Roberts
Philippe C. Martin [EMAIL PROTECTED] wrote: For a few months now, I have been used .pyc script under XP without getting the DOS box. You don't usually click on .pyc scripts. You click on .py and .pyw scripts. .pyw files will not bring up a DOS box. If you really want .pyc files to run without

Re: Considering python - have a few questions.

2005-02-13 Thread Tim Roberts
Heather Stovold [EMAIL PROTECTED] wrote: I need to make a GUI interface. Some of the screens need to be dynamically created, with the screen information in a database. Included in the database will be pictures (.gif or .jpg) that need to be displayed. A second database would hold the user's

[NooB] a Variable in multiple quotes...

2005-02-13 Thread administrata
Is it possible? I tried... I = John print \ I used to love pizza Error occurs!!! But, I don't know how to fix... HELP thx 4 reading. -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: pyMinGW support for Python 2.3.5 (final) is available

2005-02-13 Thread Nick Craig-Wood
Simon John [EMAIL PROTECTED] wrote: [snip] Ha anyone tried cross compiling python with mingw? At work we compile our software for lots of platforms (including windows) on a linux build host. The windows builds are done with a mingw cross compiler. It would be interesting if we could do

Re: [NooB] a Variable in multiple quotes...

2005-02-13 Thread Do Re Mi chel La Si Do
It's OK for me @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: For American numbers

2005-02-13 Thread Nick Craig-Wood
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 the telcoms industry, where, for

Re: [NooB] a Variable in multiple quotes...

2005-02-13 Thread Leif K-Brooks
administrata wrote: Is it possible? I tried... I = John print \ I used to love pizza Error occurs!!! No error occurs; it prints I used to love pizza, as would be expected. Oh: from the subject line, I'm guessing that you want it to say John used to love pizza instead? In that case, try doing

Re: [EVALUATION] - E01: The Java Failure - May Python Helps?

2005-02-13 Thread Diez B. Roggisch
If this is goodbye I can't say I'm sorry. Don't feed the trolls - as tempting as it is -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list

[VERDICT] - V01: The Lazaridis Failure - No One Can Help!

2005-02-13 Thread PA
On Feb 13, 2005, at 11:44, Diez B. Roggisch wrote: If this is goodbye I can't say I'm sorry. Don't feed the trolls - as tempting as it is 8^) Cheers -- PA, Onnay Equitursay http://alt.textdrive.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: SCons build tool speed

2005-02-13 Thread Neil Hodgson
ted: How does the speed of the Scons build tool compare with Ant? Right now with out Ant builds take around an hour. Hoping to speed that up. Scons emphasises accuracy over speed and is normally a little slower than other build tools although still fast enough for most purposes. One

Re: SCons build tool speed

2005-02-13 Thread PA
On Feb 13, 2005, at 12:20, Neil Hodgson wrote: http://www.scons.org/cgi-bin/wiki/GoFastButton Out of curiosity, why does scons uses MD5 by default? Is that not, er, somewhat heavy handed for most practical purpose? Would not some sort of lightweight CRC be good enough to start with?

Python-list@python.org

2005-02-13 Thread nsucvtw2module
This message was not delivered due to the following reason: Your message was not delivered because the destination computer was unreachable within the allowed queue period. The amount of time a message is queued before it is returned depends on local configura- tion parameters. Most likely there

Re: a Variable in multiple quotes...

2005-02-13 Thread John Machin
administrata wrote: Is it possible? I tried... I = John print \ I used to love pizza Error occurs!!! But, I don't know how to fix... HELP thx 4 reading. Point 0: It helps if you post a copy of what the actual screen display looked like, instead of just saying Error occurs!!!. It

Re: For American numbers

2005-02-13 Thread Dan Bishop
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 the

Re: writing unicode apps in python - some beginner questions.

2005-02-13 Thread Serge Orlov
WX wrote: (#2) Hindi is not displayed correctly on the screen when the Suplemental language support parts for Windows XP are not installed, in particular in the Regional and Languages Options panel in the Control Panel, you have to check Install files for complex script and right-to-left

Re: writing unicode apps in python - some beginner questions.

2005-02-13 Thread Serge Orlov
WX wrote: (#2) Hindi is not displayed correctly on the screen when the Suplemental language support parts for Windows XP are not installed, in particular in the Regional and Languages Options panel in the Control Panel, you have to check Install files for complex script and right-to-left

Probel with socket recv function on Win2000

2005-02-13 Thread Guy Machlev (gmachlev)
Hi, I have a problem with the socket recv() function while using it on win-2000, the problem accrue while receiving data from socket in a constant format (e.g. 1Byte then 4Bytes and then number of bytes according to the previous 4Bytes number), this receiving action "fail" after a bout

Re: Considering python - have a few questions.

2005-02-13 Thread Maurice LING
Hi, I feel that you have a consideration if Python is suitable from the perspective that you hadn't programmed for a long time. Assuming that you had been convinced that Python is a suitable language in terms of functionalities you need, please allow me to ensure that Python is simple enough

Re: For American numbers

2005-02-13 Thread Peter Hansen
Roel Schroeven wrote: Peter Hansen wrote: Scott David Daniels wrote: Kind of fun exercise (no good for British English). def units(value, units='bytes'): magnitude = abs(value) if magnitude = 1000: for prefix in ['kilo mega giga tera peta '

Re: For American numbers

2005-02-13 Thread Peter Hansen
Pierre Hanser wrote: Peter Hansen wrote: Scott David Daniels wrote: Kind of fun exercise (no good for British English). def units(value, units='bytes'): magnitude = abs(value) if magnitude = 1000: for prefix in ['kilo mega giga tera peta '

Re: Considering python - have a few questions.

2005-02-13 Thread Cameron Laird
In article [EMAIL PROTECTED], Tim Roberts [EMAIL PROTECTED] wrote: Heather Stovold [EMAIL PROTECTED] wrote: I need to make a GUI interface. Some of the screens need to be dynamically created, with the screen information in a database. Included in the database will be pictures (.gif or .jpg)

Re: [NooB] a Variable in multiple quotes...

2005-02-13 Thread Nick Coghlan
Michael Hoffman wrote: This is a fairly friendly group and they will answer even newbie questions amicably. Albeit with the occasional pointed comment about not at least skimming the tutorial when it covers the question asked ;) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] |

Re: goto, cls, wait commands

2005-02-13 Thread Fredrik Lundh
Mike Meyer wrote: Secondly, how do I clear screen (cls) from text and other content ? That depends on A: What type of display device you're using B: What type of interface is being rendered on that display (command line, GUI, IDE, etc) C: Perhaps what operating system you are using. D:

Re: For American numbers

2005-02-13 Thread Alan Kennedy
[Scott David Daniels] Kind of fun exercise (no good for British English). def units(value, units='bytes'): magnitude = abs(value) if magnitude = 1000: for prefix in ['kilo mega giga tera peta ' 'exa zetta yotta').split():

Re: Commerical graphing packages?

2005-02-13 Thread John J. Lee
[EMAIL PROTECTED] writes: If you're generating lots of graphs programatically, eg. on a web server, grace is not what you want. Yes, it has a command language, but IIRC it depends on X11, and windows even pop up as it runs in batch mode. Bleh. I don't understand what you're talking

Re: Considering python - have a few questions.

2005-02-13 Thread sjm
Heather Stovold wrote: I am a retired programmer, that started in the DOS world. (Well, I guess I started pre-DOS...). I learned C++ (for DOS), and Pascal (for DOS) when I was in school - and programmed for several years in Basic. (Ok - it wasn't my choice - but it was what I was hired to

Re: Alternative to raw_input ?

2005-02-13 Thread BOOGIEMAN
On Sun, 13 Feb 2005 12:08:26 +1000, Nick Coghlan wrote: Try this: print Hit a key! cekaj() print Nap time! time.sleep(15) print Hit another key! cekaj() with the two different implementations, and see what happens if you hit a key when the 'Nap Time!' prompt appears. I see the

Re: SCons build tool speed

2005-02-13 Thread knight
Hi Neil, ted, et al.-- How does the speed of the Scons build tool compare with Ant? Right now with out Ant builds take around an hour. Hoping to speed that up. Scons emphasises accuracy over speed and is normally a little slower than other build tools although still fast enough for most

Re: SCons build tool speed

2005-02-13 Thread knight
Hi Peter-- How does the speed of the Scons build tool compare with Ant? Right now with out Ant builds take around an hour. Hoping to speed that up. Don't tools like Scons, Ant, and for that matter make just execute other programs? So that 99% of the time is consumed external to the

changing __call__ on demand

2005-02-13 Thread Stefan Behnel
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 ... def __call1(self): ... print

ANN: Pyro 3.5 beta (remote objects)

2005-02-13 Thread Irmen de Jong
I'm glad to announce the new version of Python's own powerful remote method invocation technology -- Pyro 3.5 (beta)! You can get it via http://pyro.sourceforge.net, then go to the SF project homepage download area. It has many new features and improvements over Pyro 3.4, which was released almost

Re: changing __call__ on demand

2005-02-13 Thread Alan McIntyre
I tried this: class test(object): ... def __call1(self): ... print 1 ... __call__ = __call1 ... t = test() t() 1 Is that what you were looking for? -- Alan McIntyre ESRG LLC http://www.esrgtech.com Stefan Behnel wrote: Hi! This somewhat puzzles me: Python 2.4 (#1, Feb 3 2005,

Re: goto, cls, wait commands

2005-02-13 Thread Lars
You sir are a troll for sure. QBasic?! When was the last time you did any programming, 1989? Gave me a laugh though. Lars -- http://mail.python.org/mailman/listinfo/python-list

Re: Suggesion for an undergrad final year project in Python

2005-02-13 Thread Martin Christensen
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Sridhar == Sridhar [EMAIL PROTECTED] writes: Sridhar I am doing my undergrade CS course. I am in the final year, Sridhar and would like to do my project involving Python. Our Sridhar instructors require the project to have novel ideas. Can the

Re: changing __call__ on demand

2005-02-13 Thread Michael Hoffman
Stefan Behnel wrote: Is there a way to change __call__ after class creation? __call__, like __getitem__, and __getattr__ is called on the class object, not the instance object. So, no, not as far as I am aware, without using metaclass trickery. The simplest option IMO is to use another level of

Re: changing __call__ on demand

2005-02-13 Thread Michael Hoffman
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 one call function per class. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

graphing

2005-02-13 Thread Jan Rienyer Gadil
i'm currently using python 2.3(enthought edition) on win 2000/xp. i'm using boa constructor on the GUI part and matplotlib 0.71 on plotting the graph. i am using an MDIParentFrame. one of the child frame (MDIChildFrame1) will be used for the table part. then another child frame (MDIChildFrame2)

Re: Alternative to raw_input ?

2005-02-13 Thread Francis Girard
Le vendredi 11 Février 2005 18:00, den a écrit : import msvcrt msvcrt.getch() I frequently had the problem to have something similar but *portable*. Something as short and simple. Someone have an idea ? Thank you Francis Girard -- http://mail.python.org/mailman/listinfo/python-list

Re: help please

2005-02-13 Thread Steven Bethard
gargonx wrote: This works much better, aside from the fact that it does'nt work for the std dictionary. the letters used from here stay the same. that dictionary looks like this: std = { A:Z, Z:A, B:Y, Y:B, C:X, X:C, E:V, V:E, H:S, S:H, M:N, N:M

Re: Alternative to raw_input ?

2005-02-13 Thread Lars
Then may I suggest the keeping-it-simple approach: def myGetch(): raw_input(Press Enter to continue) (sorry about the dots, I'm using google groups) Lars -- http://mail.python.org/mailman/listinfo/python-list

Re: changing __call__ on demand

2005-02-13 Thread Stefan Behnel
Michael Hoffman schrieb: __call__, like __getitem__, and __getattr__ is called on the class object, not the instance object. So, no, not as far as I am aware, without using metaclass trickery. The simplest option IMO is to use another level of indirection as you suggest. Thanks for the quick

Re: changing __call__ on demand

2005-02-13 Thread Steven Bethard
Stefan Behnel wrote: Is there a way to change __call__ after class creation? Check out this thread on the topic: http://mail.python.org/pipermail/python-list/2004-January/203142.html Basically, the answer is no -- at least not on a per-instance basis. You can try something like: py class

Re: Text files read multiple files into single file, and then recreate the multiple files

2005-02-13 Thread M.E.Farmer
[EMAIL PROTECTED] wrote: Hiya, The title says it all really, but im a newbie to python sort of. I can read in files and write files no probs. But what I want to do is read in a couple of files and output them to one single file, but then be able to take this one single file and recreate

Re: A great Alan Kay quote

2005-02-13 Thread Francis Girard
Le vendredi 11 Fvrier 2005 21:45, Curt a crit: On 2005-02-10, Francis Girard [EMAIL PROTECTED] wrote: I think I've been enthouasistic too fast. While reading the article I grew more and more uncomfortable with sayings like : snip Yes, you may have grown uncomfortable because what you read

Re: check if object is number

2005-02-13 Thread Francis Girard
Le vendredi 11 Février 2005 20:11, Steven Bethard a écrit : Is there a good way to determine if an object is a numeric type? Generally, I avoid type-checks in favor of try/except blocks, but I'm not sure what to do in this case: def f(i): ... if x i:

Re: Second posting - Howto connect to MsSQL

2005-02-13 Thread jdonnell
Since this is (sort of) my second request it must not be an easy solution. Are there others using Python to connect MsSQL? http://sourceforge.net/projects/mysql-python -- http://mail.python.org/mailman/listinfo/python-list

Re: A great Alan Kay quote

2005-02-13 Thread Arthur
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. I have read and seen enough of Kay and his visions to find him as a bug where *my* moon don't shine. When the appropriate opportunity comes, I find it hard not

Re: connecting to Sybase/MsSQL from python

2005-02-13 Thread Alan Kennedy
[John Fabiani] I'm hoping someone on the list has connected to sybase/MsSQL with something that works with DBAPI 2.0 from a linux box (SUSE 9.2) because I can't seem to get it done. I found Object Craft's python code that uses FreeTDS. But I can't get it compiled. The code is looking for

Re: Second posting - Howto connect to MsSQL

2005-02-13 Thread Alan Kennedy
[John Fabiani] Since this is (sort of) my second request it must not be an easy solution. Are there others using Python to connect MsSQL? [jdonnell] http://sourceforge.net/projects/mysql-python Note that MsSQL != MySQL. -- alan kennedy -- email

Q: Portable Way to Make Files Read Only

2005-02-13 Thread Efrat Regev
Hello, 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 change file attributes to read only using the win32api

[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

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.org;.

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

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-odbc.

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 certainly

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 ... def

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

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

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. --

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 forth. kilo

Re: For American numbers

2005-02-13 Thread Jong ruuddotdedotjongatconsunet dot
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 the

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

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: 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 one

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: 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.

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

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

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! --

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

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

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

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

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: 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 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'])) False

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',

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 perfectly good ISO

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: 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: 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 utils.py

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

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

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) So usually I

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: 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 #everything gets changed to

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 why

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: 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

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

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 removal

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 iteratable,

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: 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 why

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 really

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: 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 tail

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 work

  1   2   >