Re: Can I use a conditional in a variable declaration?

2006-03-19 Thread Ron Adam
[EMAIL PROTECTED] wrote: > I've done this in Scheme, but I'm not sure I can in Python. > > I want the equivalent of this: > > if a == "yes": >answer = "go ahead" > else: >answer = "stop" > > in this more compact form: > > > a = (if a == "yes": "go ahead": "stop") > > > is there such

Re: ANNOUNCE: xlrd 0.5.2 -- extract data from Excel spreadsheets

2006-03-19 Thread John Machin
On 19/03/2006 2:30 PM, Kent Johnson wrote: > John Machin wrote: > >> On 19/03/2006 8:31 AM, Kent Johnson wrote: >> >>> How does xlrd compare with pyexcelerator? At a glance they look >>> pretty similar. >>> >> >> I have an obvious bias, so I'll just leave you with a not-very-PC >> analogy to thi

python newb has problem with import statements

2006-03-19 Thread danielmcbrearty
Hi Old hand at perl, giving python a try. Trying to get pymedia running on my winxp box. Have installed activestate python 2.4 and pymedia using precompiled installers. Problem is it SEEMS that the __init__.py is not getting run when I import a module. So, I have pymedia installed and it import

Re: python newb has problem with import statements

2006-03-19 Thread Peter Otten
[EMAIL PROTECTED] wrote: > the init file looks like this: > > (docs and comments skipped) > > print "in pymedia" # added by me to see > __all__= [ 'muxer', 'audio', 'video', 'removable' ] > import muxer, audio, video, removable > > but I can't import submodules of pymedia: The file with the c

Re: Can I use a conditional in a variable declaration?

2006-03-19 Thread Georg Brandl
Jeffrey Schwab wrote: > [EMAIL PROTECTED] wrote: > >> I want the equivalent of this: >> >> if a == "yes": >>answer = "go ahead" >> else: >>answer = "stop" >> >> in this more compact form: >> >> a = (if a == "yes": "go ahead": "stop") >> >> is there such a form in Python? I tried playin

Re: Is Jython development active?

2006-03-19 Thread Ray
[EMAIL PROTECTED] wrote: > Don't seem to see much progress in getting out a new version of Jython. > The last beta was out in March 2005. When will a final release be made? Not sure, but I've been checking jython-dev and jython-checkins once every few days (yes, I am *that* interested in Jython).

Re: Python compiler

2006-03-19 Thread Rc
"robert" <[EMAIL PROTECTED]> schreef in bericht news:[EMAIL PROTECTED] > Rc wrote: >> "DaveM" <[EMAIL PROTECTED]> schreef in bericht >> news:[EMAIL PROTECTED] >> >>>On Thu, 16 Mar 2006 13:34:14 +0100, "Méta-MCI" >>><[EMAIL PROTECTED]> wrote: >>> >>> Après, vous pourrez aussi fréquenter le new

Re: Python 2.5 Schedule

2006-03-19 Thread Gregory Petrosyan
Yes, it's very annoying to see VC8 warnings on perfectly legal C constructs (AFAIK even sprinf is now considered "unsafe", MS wants everybody to use sprintf_s). But the optimisation capacities of VC8 are really great. Maybe someone can measure the speedup? P.S. there's an "_CRT_SECURE_NO_DEPRECATE

Re: ANNOUNCE: xlrd 0.5.2 -- extract data from Excel spreadsheets

2006-03-19 Thread Kent Johnson
John Machin wrote: > On 19/03/2006 2:30 PM, Kent Johnson wrote: >>That didn't shed much light. I'm interested in your biased opinion, >>certainly you must have had a reason to write a new package. > > * It's not new. First public release was on 2005-05-15. When I started > writing it, there was

Re: python library for web discussions

2006-03-19 Thread Gregory Petrosyan
reddit is written with webpy (webpy.org), maybe you should give it a try? -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I use the subprocess module with mswindows?

2006-03-19 Thread Thomas Bellman
Darren Dale <[EMAIL PROTECTED]> wrote: > import subprocess > process = subprocess.Popen(['dir'], stderr=subprocess.STDOUT, > stdout=subprocess.PIPE) > stat = process.wait() > print process.stdout.read() You have already gotten the answer to why 'dir' doesn't work for you, but ther

Re: interrupting pythonD with ^C

2006-03-19 Thread Steve Holden
John Savage wrote: > I'm finding that many times when I inadvertently code an endless loop > in pythonD code, on MSDOS, execution cannot be interrupted by ctrl-C > and I am forced to reboot and this is rapidly loses its novelty. > > Do users of pythonD have a coding technique, or a library file to

Re: Can I use a conditional in a variable declaration?

2006-03-19 Thread andy
[EMAIL PROTECTED] wrote: >I've done this in Scheme, but I'm not sure I can in Python. > >I want the equivalent of this: > >if a == "yes": > answer = "go ahead" >else: > answer = "stop" > >in this more compact form: > > >a = (if a == "yes": "go ahead": "stop") > > >is there such a form in Pytho

Re: python library for web discussions

2006-03-19 Thread Amir Michail
Gregory Petrosyan wrote: > reddit is written with webpy (webpy.org), maybe you should give it a > try? I'm looking for a library that provides commenting on items in a similar way to reddit/digg/slashdot. I would rather not write all that code from scratch. I don't think web.py comes with that f

Re: Getting .NET SDK to work with Python 2.4.2

2006-03-19 Thread gregarican
Dave wrote: > yea i have .net 1.1, but not the sdk. do i need the 1.1 SDK too? I think so. The .Net 1.1 runtime (i.e. - not the SDK) is missing the support files necessary for compiling programs. Gotta love those huge downloads. I thought the Java SDK's were big :-)~ -- http://mail.python.org/m

Counting number of each item in a list.

2006-03-19 Thread sophie_newbie
I have a list a little something like this: StringA StringC StringB StringA StringC StringD StringA ... etc. Basically I was wondering if there was an easy way to return how many of each string are in the list, something like this: StringA - 3 StringB - 1 StringC - 2 StringD - 1 I suppose that

Re: Getting .NET SDK to work with Python 2.4.2

2006-03-19 Thread Martin v. Löwis
Dave wrote: > So i go to the cmd and go to the directory and type > "python setup.py build" (Will have to install after) and it comes up > with this(after everything else runs smoothly): > running build_ext > error: The .NET SDK needs to be installed before building extensions > for python. The er

Want to re-pack() a Frame displaying a collection

2006-03-19 Thread Charles Krug
List, I'd like to do the following with Tkinter's Frame() object: 1. Display a collection of pack()-able objects. Easy. Done. I hold the objects in a dictionary, mostly so that the owning program can refer to them uniformly. 2. Whenever the collection is added to or deleted from, re-pack() th

Re: Counting number of each item in a list.

2006-03-19 Thread Paul Rubin
"sophie_newbie" <[EMAIL PROTECTED]> writes: > I suppose that the easiest way to do that is to convert it to a 2 > dimensional array? Is there any easy way? Use a hash table. Untested: h = 0 for x in your_list: h[x] = h.get(x, 0) + 1 You can then use something like sorted(h.items())

Re: Getting .NET SDK to work with Python 2.4.2

2006-03-19 Thread Dave
Well i don't have the whole visual studio. I don't have 7 either, I have 8. I have VB and VC++ Express. If there is no way to download VS7, could someone point me to directions on how to build the extensions with mingw32? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.5 Schedule

2006-03-19 Thread Pekka Niiranen
Hi, what I would like to see in (www.python.org) is Windows installation package (*.msi) compiled with option "--enable-unicode=ucs4". See http://www.xml.com/pub/a/2005/06/15/py-xml.html -pekka- -- http://mail.python.org/mailman/listinfo/python-list

Re: Counting number of each item in a list.

2006-03-19 Thread Bruno Desthuilliers
sophie_newbie a écrit : > I have a list a little something like this: > > StringA > StringC > StringB > StringA > StringC > StringD > StringA > ... > etc. > > Basically I was wondering if there was an easy way to return how many > of each string are in the list, something like this: > > StringA

Re: Counting number of each item in a list.

2006-03-19 Thread sophie_newbie
Hey Bruno, I got an invalid syntax error when i tried using your "str_counts = dict((s, str_list.count(s) for s in set(str_list))" bit of code? Maybe there is a missing bracket or comma? Or maybe I need to import something. Thanks so much for your help. -- http://mail.python.org/mailman/listinf

Re: How to run SimpleHTTPServer on IronPython on Mono

2006-03-19 Thread Paul Boddie
[EMAIL PROTECTED] wrote: > Paul Boddie wrote: > > [1] http://lists.debian.org/debian-legal/2005/08/msg00089.html > > Do you realize *I* was the person asking for clarification of the license > on debian-legal mailing list? Yes. And I thereby deduce that you also believe that having Debian approval

Re: Counting number of each item in a list.

2006-03-19 Thread sophie_newbie
Hi Paul, Ur bit of code works, thanks so much, just for anyone reading this use 'h = {}' instead of h = 0. Thanks -- http://mail.python.org/mailman/listinfo/python-list

Problems redirecting STDOUT (NOT sys.stdout) to a pipe.

2006-03-19 Thread Elad
Hello All, I am trying to capture some printf's from a C function called by python. I have tried to following: STDOUT = 1# stdout fd (re, we) = os.pipe()# Create re / write handlers dup2(we, STDOUT)# override system's stdout, should dup first and restore later.. call_my_hello_world

Re: Getting .NET SDK to work with Python 2.4.2

2006-03-19 Thread Vincent Wehren
"Dave" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Well i don't have the whole visual studio. I don't have 7 either, I | have 8. I have VB and VC++ Express. If there is no way to download VS7, | could someone point me to directions on how to build the extensions | with mingw32?

Re: Have you ever considered of mousing ambidextrously?

2006-03-19 Thread Roy Smith
In article <[EMAIL PROTECTED]>, John Salerno <[EMAIL PROTECTED]> wrote: > Roy Smith wrote: > > In article <[EMAIL PROTECTED]>, > > Scott David Daniels <[EMAIL PROTECTED]> wrote: > > > >> Roy Smith wrote: > >>> I never understood why people switch mouse buttons. I'm left handed, so > >>> I >

Re: Counting number of each item in a list.

2006-03-19 Thread Kent Johnson
sophie_newbie wrote: > Hey Bruno, > > I got an invalid syntax error when i tried using your "str_counts = > dict((s, str_list.count(s) for s in set(str_list))" bit of code? Maybe > there is a missing bracket or comma? Or maybe I need to import > something. It should be str_counts = dict((s, str_l

Re: Getting .NET SDK to work with Python 2.4.2

2006-03-19 Thread Dave
So this means that I have to download .NET 1.1 SDK. Visual Studio 8 comes with msvcrt.lib, but im assuming it's the wrong version. -- http://mail.python.org/mailman/listinfo/python-list

C-API: A beginner's problem

2006-03-19 Thread Fabian Steiner
I recently started learning C since I want to be able to write Python extension modules. In fact, there is no need for it, but I simply want to try something new ... I tried to implement the bubblesort algorithm in C and to use it in python; bubblesort.c compiles fine, but whenever I want to im

Re: C-API: A beginner's problem

2006-03-19 Thread Heikki Salo
Fabian Steiner wrote: > What did I do wrong? As I am quite new to C, I probably made many > mistakes, so please feel free to correct me. The following line: > for (i = 0; i <= seqlen; i++) { Should be "for (i = 0; i < seqlen; i++) {". Otherwise the last assignment will be out of bounds an

Re: Python 2.5 Schedule

2006-03-19 Thread Scott David Daniels
Gregory Petrosyan wrote: > P.P.S. are there any experiments with compiling CPython with Intel's > compiler? Yup, the (older) Intel compiler was quite effective for 2,2 and 2.3 (at least), and I think at least one distro was built with it. -- -Scott David Daniels [EMAIL PROTECTED] -- http://mail.

Re: python newb has problem with import statements

2006-03-19 Thread danielmcbrearty
that was indeed the problem. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: C-API: A beginner's problem

2006-03-19 Thread Heikki Salo
Heikki Salo wrote: > Fabian Steiner wrote: >> What did I do wrong? As I am quite new to C, I probably made many >> mistakes, so please feel free to correct me. > > The following line: > > > for (i = 0; i <= seqlen; i++) { > > Should be "for (i = 0; i < seqlen; i++) {". Otherwise the last

Re: Python 2.5 Schedule

2006-03-19 Thread Martin v. Löwis
Pekka Niiranen wrote: > what I would like to see in (www.python.org) is > Windows installation package (*.msi) > compiled with option "--enable-unicode=ucs4". > See http://www.xml.com/pub/a/2005/06/15/py-xml.html Just enabling that option is not enough: the resulting binary likely crashes. In addi

Re: ANNOUNCE: xlrd 0.5.2 -- extract data from Excel spreadsheets

2006-03-19 Thread Scott David Daniels
Kent Johnson wrote: > John Machin wrote: >> * Herewith the biased comparison: > > Thank you! Thank you (John) as well. I realize you are a bit reluctant to toot your own horn, but it is just this kind of biased comparison that let's us know whether to investigate further. It also helps th

Re: Computing correlations with SciPy

2006-03-19 Thread tkpmep
Tested it and it works like a charm! Thank you very much for fixing this. Not knowing what an SVN is, I simply copied the code into the appropriate library files and it works perfectly well. May I suggest a simple enhancement: modify corrcoef so that if it is fed two 1 dimensional arrays, it retur

Initializing a list of lists

2006-03-19 Thread tkpmep
I want to create a list of lists, each of which is identical, but which can be modified independently i.e: >>>x = [ [0], [0], [0] ] >>> x[0].append(1) >>> x [[0, 1], [0], [0]] The above construct works if I have only few items, but if I have many, I'd prefer to write >>> N =3 >>> x =N*[[0]] >>> x

Re: C-API: A beginner's problem

2006-03-19 Thread Duncan Booth
Heikki Salo wrote: > > And closer look tells that the code should not even compile. Is the > code cut & pasted directly? Line "list[i] = item;" tries to assign a > pointer to an int-array, which should not compile. There are other > similar oddities. ... such as the declaration of list at a poi

Relative paths in mod_python

2006-03-19 Thread Ivo van der Sangen
I was wondering if I could use relative paths in a mod_python script. At the moment I am defining a constant string "/path/to/dir/where/script/resides". The problem with this is that when I move the script including files I use to get metadata I have to change this variable. The same problem occurs

Re: Initializing a list of lists

2006-03-19 Thread Tim Chase
> The above construct works if I have only few items, but if I have many, > I'd prefer to write > N =3 x =N*[[0]] x > > [[0], [0], [0]] > > If I now try extending the lists indepently, I cannot, as they all > point to the same list object > x[0].append(1) x > > [[0, 1], [0,

Re: Initializing a list of lists

2006-03-19 Thread ZeD
Ciao, [EMAIL PROTECTED] Che stavi dicendo? > Is there a simple way to create a list of independent lists? N=3 x=[[0] for e in range(N)] -- Up da 1 giorno, 3 ore, 43 minuti e 10 secondi -- http://mail.python.org/mailman/listinfo/python-list

Re: Can I use a conditional in a variable declaration?

2006-03-19 Thread Jeffrey Schwab
Georg Brandl wrote: > Jeffrey Schwab wrote: >> [EMAIL PROTECTED] wrote: >> >>> I want the equivalent of this: >>> >>> if a == "yes": >>>answer = "go ahead" >>> else: >>>answer = "stop" >>> >> def mux(s, t, f): >> if s: >> return t >> return f > > But be aware that this i

Re: C-API: A beginner's problem

2006-03-19 Thread Nick Smallbone
Duncan Booth wrote: > Heikki Salo wrote: > > > > > And closer look tells that the code should not even compile. Is the > > code cut & pasted directly? Line "list[i] = item;" tries to assign a > > pointer to an int-array, which should not compile. There are other > > similar oddities. > > ... such a

Problem with Install wxPython on Solaris10 x86

2006-03-19 Thread zjumty
I want to install wxPython 2.6 on Solaris10 x86. I have passed "make install", and want to execute python setup.py install. but i got some problems. first i run "python setup.py install",and i got the following: unable to execute cc: No such file or directory error: command 'cc' failed with exit

Unpythonic? Impossible??

2006-03-19 Thread BrJohan
Assume having this class hierarchy: (in principle and without details) class A(object): class B1(A): class B2(A): class C1(A1): class C2(A1): class C3(B1): class C4(B2): each of those classes have an initializer __init__(self, data): and an overloaded __new__(cls, dat

Re: C-API: A beginner's problem

2006-03-19 Thread Duncan Booth
Nick Smallbone wrote: > Duncan Booth wrote: >> Heikki Salo wrote: >> >> > >> > And closer look tells that the code should not even compile. Is the >> > code cut & pasted directly? Line "list[i] = item;" tries to assign a >> > pointer to an int-array, which should not compile. There are other >> >

Re: Unpythonic? Impossible??

2006-03-19 Thread Scott David Daniels
BrJohan wrote: > Assume having this class hierarchy: (in principle and without details) > class A(object): > class B1(A): > class B2(A): > ... > each of those classes have an initializer __init__(self, data): and an > overloaded __new__(cls, data): > > is it then possible to have

Rate of Flow in a Black Box

2006-03-19 Thread [EMAIL PROTECTED]
Hi all. Here's the problem: I've got a black box and a bunch of particles in an environment. The particles go into the black box, follow a path, and pop out the end after some processing. They are processed first-in-first-out, like a queue. Inside the black box is a physical layout that can be

Re: Counting number of each item in a list.

2006-03-19 Thread Bruno Desthuilliers
sophie_newbie a écrit : > Hey Bruno, > > I got an invalid syntax error when i tried using your "str_counts = > dict((s, str_list.count(s) for s in set(str_list))" bit of code? Maybe > there is a missing bracket or comma? Yes, sorry, see Kent's post for the correction. > Or maybe I need to impor

Re: Counting number of each item in a list.

2006-03-19 Thread bearophileHUGS
With CPython this is probably the faster version, the version with list.count() has to be used only if you are sure to always have a short input list, because it's O(n^2): str_list = ['StringA', 'StringC', 'StringB', 'StringA', 'StringC', 'StringD', 'StringA' ] str_count

Re: Counting number of each item in a list.

2006-03-19 Thread Bruno Desthuilliers
Kent Johnson a écrit : > sophie_newbie wrote: > >> Hey Bruno, >> >> I got an invalid syntax error when i tried using your "str_counts = >> dict((s, str_list.count(s) for s in set(str_list))" bit of code? Maybe >> there is a missing bracket or comma? Or maybe I need to import >> something. > > >

[ann] markup.py - HTML/XML generator

2006-03-19 Thread Daniel Nogradi
Just in case the thought of not having a millionth implementation of a HTML/XML generator for Python makes the world as we know it a miserable place, well then your suffering might be over soon since exactly the one millionth implementation is out. You can download markup.py from http://markup.sou

Re: C-API: A beginner's problem

2006-03-19 Thread Fabian Steiner
Heikki Salo wrote: > Heikki Salo wrote: >> Fabian Steiner wrote: >>> What did I do wrong? As I am quite new to C, I probably made many >>> mistakes, so please feel free to correct me. >> >> The following line: >> >> > for (i = 0; i <= seqlen; i++) { >> >> Should be "for (i = 0; i < seqlen; i+

Re: Python equivalent of Perl-ISAPI?

2006-03-19 Thread Waldemar Osuch
What Roger says and also: http://pyisapie.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Unpythonic? Impossible??

2006-03-19 Thread Felipe Almeida Lessa
Em Dom, 2006-03-19 às 08:54 -0800, Scott David Daniels escreveu: > class A(object): > def __new__(class_, *args, **kwargs): > if class_ is A: > if want_a_B1(*args, **kwargs): > return B1(*args, **kwargs) > elif want_a

Re: Unpythonic? Impossible??

2006-03-19 Thread BrJohan
"Scott David Daniels" <[EMAIL PROTECTED]> skrev i meddelandet news:[EMAIL PROTECTED] > BrJohan wrote: ... >> is it then possible to have this call: >> obj = A(data) >> return an instance of that particular class (e.g. class C3) in the >> hierarchy that - as decided by the __new__ functions

Re: Relative paths in mod_python

2006-03-19 Thread Jochem Berndsen
Ivo van der Sangen wrote: > I was wondering if I could use relative paths in a mod_python script. At > the moment I am defining a constant string > "/path/to/dir/where/script/resides". > [snip] You can use Python's built-in __file__ variable. It is set to the absolute location of your script. You

Re: Server applications - avoiding sleep

2006-03-19 Thread Lev Elbert
You can make it a service, which has an advantage, that it survives logouts. SOME PROGRAMMING IS REQIURED. If I need something running the "fast and dirty" way, I run a regular python application as window application (start pythonw.exe). As a way o communication (start, stop, pause) I use tray.

Re: Unpythonic? Impossible??

2006-03-19 Thread Scott David Daniels
Felipe Almeida Lessa wrote: > Em Dom, 2006-03-19 às 08:54 -0800, Scott David Daniels escreveu: >> class A(object): >> def __new__(class_, *args, **kwargs): >> if class_ is A: >> if want_a_B1(*args, **kwargs): >> return B1(*args, **kwa

Re: Writing web bots in python

2006-03-19 Thread Ben C
On 2006-03-18, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello, > I hav a question..How do I write a webbot that logs onto some website, > fills text into a textbox and submit that form, Sorry I am a novice in > python, apparently I have to use urllib, but I hav a few queries on > this, What h

Re: Counting number of each item in a list.

2006-03-19 Thread Bruno Desthuilliers
Bruno Desthuilliers a écrit : > Kent Johnson a écrit : > >> sophie_newbie wrote: >> >>> Hey Bruno, >>> >>> I got an invalid syntax error when i tried using your "str_counts = >>> dict((s, str_list.count(s) for s in set(str_list))" bit of code? Maybe >>> there is a missing bracket or comma? Or mayb

Re: Relative paths in mod_python

2006-03-19 Thread Bruno Desthuilliers
Ivo van der Sangen a écrit : > I was wondering if I could use relative paths in a mod_python script. At > the moment I am defining a constant string > "/path/to/dir/where/script/resides". The problem with this is that when > I move the script including files I use to get metadata I have to change >

Re: python cgi permision error

2006-03-19 Thread [EMAIL PROTECTED]
Sorry accidently replying using my other google account [EMAIL PROTECTED] wrote: > > > > assuming you are running this python script the standard cgi way and not > > through modpython or fastcgi. > yes I'm running it in standard cgi way coz my provider only allow me > that way. And it's really jus

Re: message box halts prgram flow

2006-03-19 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > HI > > I am creating a tkinter app. > > example > > tkMessageBox.showinfo("Window Text", "A short message") > print "blah" > > The execution of the application halts when the message box is > displayed until the user clicks OK, then "blah is printed. Yeps, this is

Re: Counting number of each item in a list.

2006-03-19 Thread Paul Rubin
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > And of course, I was right. My solution seems to be faster than Paul's > one (but slower than bearophile's), be it on small, medium or large > lists. > > nb: A is mine, B is Paul's and C is bearophile's, and the number after > is the size of the li

Re: Counting number of each item in a list.

2006-03-19 Thread Justin Azoff
Bruno Desthuilliers wrote: > And of course, I was right. My solution seems to be faster than Paul's > one (but slower than bearophile's), be it on small, medium or large lists. Your version is only fast on lists with a very small number of unique elements. changing mklist to have items = range(64

Re: remove a directory with special chars

2006-03-19 Thread Peter Hansen
andy wrote: > Is there a special reason you want to use Python to do this? The Linux > command shell would probably do exactly the same job (you can specify > backslash-escaped characters at the command-line)... > > anyway to do it in python: > > import os > os.remove("/path/to/the/file/.\17

[ANN] PyGNUGK v3.50 is out

2006-03-19 Thread Jerome Alet
Hi there, I'm pleased to announce PyGNUGK v3.50 which is available under the terms of the GNU GPL from : http://cortex.unice.fr/~jerome/pygnugk/ PyGNUGK is a Python library which allows full control over one or more instances of the GNU GateKeeper (http://www.gnugk.org) from any Python program

Re: Counting number of each item in a list.

2006-03-19 Thread Bruno Desthuilliers
Paul Rubin a écrit : > Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > >>And of course, I was right. My solution seems to be faster than Paul's >>one (but slower than bearophile's), be it on small, medium or large >>lists. >> >>nb: A is mine, B is Paul's and C is bearophile's, and the number aft

Re: Counting number of each item in a list.

2006-03-19 Thread Bruno Desthuilliers
Justin Azoff a écrit : > Bruno Desthuilliers wrote: > >>And of course, I was right. My solution seems to be faster than Paul's >>one (but slower than bearophile's), be it on small, medium or large lists. > > > Your version is only fast on lists with a very small number of unique > elements. > >

Re: Counting number of each item in a list.

2006-03-19 Thread Bruno Desthuilliers
Justin Azoff a écrit : > Bruno Desthuilliers wrote: > >> My solution seems to be faster than Paul's >>one (but slower than bearophile's), be it on small, medium or large lists. > > > Your version is only fast on lists with a very small number of unique > elements. > > changing mklist to have >

whats your favourite object relational mapper?

2006-03-19 Thread Flavio
With so many object relational mappers out there, I wonder which one is the preferred tool among the Pythonists... is there a favourite? Sqlobject, PyDO, SQLAlchemy, dejavu, etc... -- http://mail.python.org/mailman/listinfo/python-list

Re: Xah's Edu Corner: What is Expressiveness in a Computer Language

2006-03-19 Thread Xah Lee
What is Expressiveness in a Computer Language Xah Lee, 200502, 200603. In languages human or computer, there's a notion of expressiveness. English for example, is very expressive in manifestation, witness all the poetry and implications and allusions and connotations and dictions. There are a my

Re: Xah's Edu Corner: What is Expressiveness in a Computer Language

2006-03-19 Thread Dag Sunde
"Xah Lee" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > What is Expressiveness in a Computer Language PLONK. -- Dag. -- http://mail.python.org/mailman/listinfo/python-list

Re: python library for web discussions

2006-03-19 Thread Irmen de Jong
Amir Michail wrote: > Hi, > > I'm building something like digg/reddit and would like to allow people > to have discussions on various items. > > Is there a simple lightweight python library that I can use (as opposed > to a heavyweight web framework)? Although not necessary, some sort of > scori

Re: Xah's Edu Corner: What is Expressiveness in a Computer Language

2006-03-19 Thread John Bokma
"Dag Sunde" <[EMAIL PROTECTED]> wrote: > "Xah Lee" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> What is Expressiveness in a Computer Language > > PLONK. Don't post PLONK messages you idiot. PLONK in silence instead of adding to a lot of garbage in serveral groups. -- John

cmp() on integers - is there guarantee of returning only +-1 or 0?

2006-03-19 Thread Dmitry Anikin
doc says that it must be > 0, or < 0, but it seems that it returns +1 or -1. Can it be reliably used to get the sign of x: cmp(x, 0) like pascal Sign() function does? I mean, I'm pretty sure that it can be used, but is it mentioned somewhere in language spec, or it may be implementation defined? If

Re: Initializing a list of lists

2006-03-19 Thread Ron Adam
[EMAIL PROTECTED] wrote: > I want to create a list of lists, each of which is identical, but which > can be modified independently i.e: > x = [ [0], [0], [0] ] x[0].append(1) x > [[0, 1], [0], [0]] > > The above construct works if I have only few items, but if I have many, > I'd pr

How to check if a directory is exist in python?

2006-03-19 Thread yinglcs
I check the documentation here, but it does not say how to check if a directory is exist in python? http://docs.python.org/lib/os-file-dir.html And why mkdir fails if the directory already exists? Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Xah's Edu Corner: What is Expressiveness in a Computer Language

2006-03-19 Thread Luc The Perverse
"John Bokma" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Dag Sunde" <[EMAIL PROTECTED]> wrote: > >> "Xah Lee" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >>> What is Expressiveness in a Computer Language >> >> PLONK. > > Don't post PLONK messages you idiot. P

Re: python library for web discussions

2006-03-19 Thread Pierre Quentel
Take a look at Karrigell (http://www.karrigell.com), it has a built-in forum application Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: A Frame-space syntax ? - Re: global, globals(), _global ?

2006-03-19 Thread robert
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, robert wrote: > > >>The fact is: >>* Python has that big problem with unnecessary barriers for nested frame >>access - especially painfull with callback functions where you want to >>put back data into the calling frame. > > > You mea

Re: Relative paths in mod_python

2006-03-19 Thread Steve Holden
Ivo van der Sangen wrote: > I was wondering if I could use relative paths in a mod_python script. At > the moment I am defining a constant string > "/path/to/dir/where/script/resides". The problem with this is that when > I move the script including files I use to get metadata I have to change > th

PyWeek #2 one week before the fun starts!

2006-03-19 Thread richard
The PyWeek challenge invites entrants to write a game in one week from scratch either as an individual or in a team. Entries must be developed in Python, during the challenge, and must incorporate some theme chosen at the start of the challenge. PyWeek #2 runs from Sunday 26th March to Sunday 2nd

global statement and scoping

2006-03-19 Thread jochen . stier
Hi everyone, I am compiling the following script using Py_CompileString def compute(node): #global compute iter = node.getChild(0) while iter: if isinstance(iter, Group): compute(iter) print iter it

Re: cmp() on integers - is there guarantee of returning only +-1 or 0?

2006-03-19 Thread Paul Rubin
"Dmitry Anikin" <[EMAIL PROTECTED]> writes: > doc says that it must be > 0, or < 0, but it seems that > it returns +1 or -1. Can it be reliably used to get the sign of x: > cmp(x, 0) like pascal Sign() function does? The doc says (http://docs.python.org/lib/built-in-funcs.html): cmp(x,y)

Re: How to check if a directory is exist in python?

2006-03-19 Thread plahey
Check out os.path.isdir(path_name) http://docs.python.org/lib/module-os.path.html -- http://mail.python.org/mailman/listinfo/python-list

Re: How to check if a directory is exist in python?

2006-03-19 Thread Vincent Wehren
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |I check the documentation here, but it does not say how to check if a | directory is exist in python? | http://docs.python.org/lib/os-file-dir.html Look at the exist or isdir methods of the os.path module (http://docs.python.org/lib/m

Pycrypto - active ??

2006-03-19 Thread dirvine
Does anyone know if pycrypto is active at all. I have been browsing groups etc. for some info and have found entries from 2003 (latest) regarding some bits I was looking for in particular reference to symmetrical encoding (AES) and auto padding and supply or not of iv to set up method i.e from Cry

Re: How to check if a directory is exist in python?

2006-03-19 Thread Vincent Wehren
"Vincent Wehren" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | <[EMAIL PROTECTED]> wrote in message | news:[EMAIL PROTECTED] ||I check the documentation here, but it does not say how to check if a || directory is exist in python? || http://docs.python.org/lib/os-file-dir.html | | L

Re: Getting .NET SDK to work with Python 2.4.2

2006-03-19 Thread Vincent Wehren
"Dave" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | So this means that I have to download .NET 1.1 SDK. Visual Studio 8 | comes with msvcrt.lib, but im assuming it's the wrong version. | Yes, I'd say so. -- Vincent Wehren -- http://mail.python.org/mailman/listinfo/python-lis

Re: How to check if a directory is exist in python?

2006-03-19 Thread Steve Holden
Vincent Wehren wrote: > | <[EMAIL PROTECTED]> wrote in message > | news:[EMAIL PROTECTED] > ||I check the documentation here, but it does not say how to check if a > || directory is exist in python? > || http://docs.python.org/lib/os-file-dir.html > | > | Look at the exist or isdir methods of the

Re: Have you ever considered of mousing ambidextrously?

2006-03-19 Thread Benji York
Aahz wrote: > Heh. When possible, my work situation includes two computers, each with > their own keyboard and mouse. To put the keyboards as close together as > possible, the mice go on the outside. I prefer a similar setup with 2 duel monitor PCs (one Linux, one Windows), but use x2vnc to con

Re: Pycrypto - active ??

2006-03-19 Thread [EMAIL PROTECTED]
Well, the homepage of Pycrypto (http://www.amk.ca/python/code/crypto) was modified las in December 2005 - quite recent imo. It is used e.g. in the paramiko package (http://www.lag.net/paramiko/) for the most(?) used ssh implementation in Python, so my guess it is active. -- http://mail.python.org

Re: cmp() on integers - is there guarantee of returning only +-1 or 0?

2006-03-19 Thread [EMAIL PROTECTED]
It is depending on the classes you try to compare, and on how the comparison functions (see http://docs.python.org/ref/customization.html) are implemented in these, see example below: py> class wrong(object): ... def __init__(self, x): ... self.x = x ... def __cmp__(self, other): .

Re: Xah's Edu Corner: What is Expressiveness in a Computer Language

2006-03-19 Thread Roedy Green
On 19 Mar 2006 13:03:18 -0800, "Xah Lee" <[EMAIL PROTECTED]> wrote, quoted or indirectly quoted someone who said : >One thing commonly misunderstood in computing industry is the notion of >expressiveness. If a language has a vocabulary of (smile, laugh, grin, >giggle, chuckle, guffaw, cackle), E

Re: Unpythonic? Impossible??

2006-03-19 Thread Erik Max Francis
BrJohan wrote: > I know how to use a class factory - and could work around using such a > mechanism. However I am interested to know if I could let the classes do the > work by themselves. You can, but a class factory is going to be much clearer and probably more maintainable. From the user's

Re: C-API: A beginner's problem

2006-03-19 Thread Georg Brandl
Fabian Steiner wrote: > I recently started learning C since I want to be able to write Python > extension modules. In fact, there is no need for it, but I simply want > to try something new ... > > I tried to implement the bubblesort algorithm in C and to use it in > python; bubblesort.c compil

  1   2   >