Re: Chained Comparisons

2006-03-19 Thread Fredrik Lundh
"Sathyaish" wrote: > I) What does the following expression evaluate to? > > a < b == c > > 1) (a < b) and (b == c) > 2) (a < b) or (b == c) http://docs.python.org/ref/comparisons.html Formally, if a, b, c, ..., y, z are expressions and opa, opb, ..., opy are comparison operators, the

Re: C-API: A beginner's problem

2006-03-19 Thread Georg Brandl
Fabian Steiner wrote: > Georg Brandl wrote: >> Fabian Steiner wrote: >>> [...] >>> for (i = 0; i <= seqlen; i++) { >> >> That is one iteration too much. Use >> >> for (i = 0; i < seglen; i++) >> >>> item = PySequence_Fast_GET_ITEM(seq, i); >> >> Now item is a PyObject*.

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

2006-03-19 Thread Mike Schilling
"Xah Lee" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >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

IMAP Folder Size Information

2006-03-19 Thread Kevin F
I'm trying to use the following code to get my remote server's folder size information. Unfortunately, i'm getting the error: Traceback (most recent call last): File "/Life/School/Homework/Spring 2006/OPIM 399/Tutorial/IMAP/mailboxsize.py", line 23, in -toplevel- number_of_messages_al

Free Blog Hosting

2006-03-19 Thread mutant
Hi, I setup an account at http://www.bloggerteam.com the site provides quality blog hosting services with quality editable templates, google sitemaps built in and many more features. Also subdomain style urls which are easy remembered by your friends and familes. If you love blogging that try this

Free Blog Hosting

2006-03-19 Thread mutant
Hi, I setup an account at http://www.bloggerteam.com the site provides quality blog hosting services with quality editable templates, google sitemaps built in and many more features. Also subdomain style urls which are easy remembered by your friends and familes. If you love blogging that try this

Re: String comparison question

2006-03-19 Thread Michael Spencer
Alex Martelli wrote: > Michael Spencer <[EMAIL PROTECTED]> wrote: >> >> Here, str.translate deletes the characters in its optional second argument. >> Note that this does not work with unicode strings. > > With unicode, you could do something strictly equivalent, as follows: > > nowhite = dict.f

C API: Testing my reference counting

2006-03-19 Thread lord trousers
I'm currently replacing the Quake 3 game code (not the rendering, sound, or collision detection pieces) with Python. I've now successfully loaded Python modules and made callbacks to them, rendered maps, written some fly-through code, and embedded a Python interactive mode into the console (which i

Re: Have you ever considered of mousing ambidextrously?

2006-03-19 Thread Nick Craig-Wood
Roy Smith <[EMAIL PROTECTED]> wrote: > "WangQiang" <[EMAIL PROTECTED]> wrote: > > I'm also a programmer, as working in front of computer day and day, my > > right hand is so tired and ached. So I tried to mouse in both hands. I > > find that it is really an efficient way to release pains. At first

Re: ** Operator

2006-03-19 Thread Sathyaish
Thanks, Alex. -- http://mail.python.org/mailman/listinfo/python-list

Re: ** Operator

2006-03-19 Thread Sathyaish
Thanks, Alex. -- http://mail.python.org/mailman/listinfo/python-list

Chained Comparisons

2006-03-19 Thread Sathyaish
I) What does the following expression evaluate to? a < b == c 1) (a < b) and (b == c) 2) (a < b) or (b == c) II) How many operands can be chained for comparison in a single expression? For e.g, is the under-stated expression a valid comparison chain? a < b == c > d -- http://mail.python.org/

Re: whats your favourite object relational mapper?

2006-03-19 Thread Jonathan Ellis
Serge Orlov wrote: > Flavio wrote: > > 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... > > Google results: > Sqlobject ORM: about 17,100 > PyDO ORM: 469 >

Re: ** Operator

2006-03-19 Thread Alex Martelli
Sathyaish <[EMAIL PROTECTED]> wrote: > I tried it on the interpreter and it looks like it is the "to the power > of" operator symbol/function. Can you please point me to the formal > definition of this operator in the docs? http://docs.python.org/ref/power.html Alex -- http://mail.python.org/m

Re: Python 2.5 Schedule

2006-03-19 Thread Ben Finney
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > For more details about the plan for Python 2.5, see: > http://www.python.org/doc/peps/pep-0356/ Thanks for bringing attention to this. > - ASCII is the default coding Er? How did this happen? To be specific, what about all the movement

Re: ** Operator

2006-03-19 Thread Sathyaish
I tried it on the interpreter and it looks like it is the "to the power of" operator symbol/function. Can you please point me to the formal definition of this operator in the docs? -- http://mail.python.org/mailman/listinfo/python-list

** Operator

2006-03-19 Thread Sathyaish
In the example below from the python docs (http://docs.python.org/tut/node7.html#SECTION00714), I am not able to understand the ** operator in the following expression: >>> [(x, x**2) for x in vec] I understand the list comprehension as a whole but have forgotten the ** operator's

Re: C-API: A beginner's problem

2006-03-19 Thread Fabian Steiner
Georg Brandl wrote: > Fabian Steiner wrote: >> [...] >> for (i = 0; i <= seqlen; i++) { > > That is one iteration too much. Use > > for (i = 0; i < seglen; i++) > >> item = PySequence_Fast_GET_ITEM(seq, i); > > Now item is a PyObject*. You'll have to convert it to an i

Re: Is there such an idiom?

2006-03-19 Thread Alex Martelli
Ron Adam <[EMAIL PROTECTED]> wrote: ... > From what I recently read here (not sure where) in another thread, in > python 2.3 sets were implemented as a python module using dictionaries, > and in 2.4 it was written in C code based on the dictionary C code. ...and in 2.5 they're due to be furthe

Re: String comparison question

2006-03-19 Thread Alex Martelli
Michael Spencer <[EMAIL PROTECTED]> wrote: > Olivier Langlois wrote: > > > I would like to make a string comparison that would return true without > > regards of the number of spaces and new lines chars between the words > > > > > like 'A B\nC' = 'A\nBC' > > > > import string > NULL = s

Ink

2006-03-19 Thread mshawjr
Man I have found this site that has the cheapest ink for any printer. You can compare prices and then review the companies on service and quality. Let me know what you think -- http://mail.python.org/mailman/listinfo/python-list

Re: String comparison question

2006-03-19 Thread Alex Martelli
Michael Spencer <[EMAIL PROTECTED]> wrote: > Olivier Langlois wrote: > > Hi Michael! > > > > Your suggestion is fantastic and is doing exactly what I was looking > > for! Thank you very much. > > There is something that I'm wondering though. Why is the solution you > > proposed wouldn't work with

Re: Is there such an idiom?

2006-03-19 Thread Ron Adam
Per wrote: > Thanks Ron, > surely set is the simplest way to understand the question, to see > whether there is a non-empty intersection. But I did the following > thing in a silly way, still not sure whether it is going to be linear > time. > def foo(): > l = [...] > s = [...] > dic =

Re: Python 2.5 Schedule

2006-03-19 Thread Ravi Teja
http://msdn.microsoft.com/visualc/vctoolkit2003/ Free. -- http://mail.python.org/mailman/listinfo/python-list

Re: whats your favourite object relational mapper?

2006-03-19 Thread Serge Orlov
Jean-Paul Calderone wrote: > On 19 Mar 2006 17:52:19 -0800, Serge Orlov <[EMAIL PROTECTED]> wrote: > >Flavio wrote: > >> 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, SQLAlchem

Re: String comparison question

2006-03-19 Thread Michael Spencer
Olivier Langlois wrote: > Hi Michael! > > Your suggestion is fantastic and is doing exactly what I was looking > for! Thank you very much. > There is something that I'm wondering though. Why is the solution you > proposed wouldn't work with Unicode strings? > Simply, that str.translate with two a

Re: whats your favourite object relational mapper?

2006-03-19 Thread Jean-Paul Calderone
On 19 Mar 2006 17:52:19 -0800, Serge Orlov <[EMAIL PROTECTED]> wrote: >Flavio wrote: >> 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... > >Google results: >S

Re: whats your favourite object relational mapper?

2006-03-19 Thread Serge Orlov
Flavio wrote: > 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... Google results: Sqlobject ORM: about 17,100 PyDO ORM: 469 SQLAlchemy ORM: 571 dejavu ORM: 659

Re: Is there such an idiom?

2006-03-19 Thread Michael Spencer
Per wrote: > Thanks Ron, > surely set is the simplest way to understand the question, to see > whether there is a non-empty intersection. But I did the following > thing in a silly way, still not sure whether it is going to be linear > time. > def foo(): > l = [...] > s = [...] > dic =

RE: String comparison question

2006-03-19 Thread Olivier Langlois
Hi Michael! Your suggestion is fantastic and is doing exactly what I was looking for! Thank you very much. There is something that I'm wondering though. Why is the solution you proposed wouldn't work with Unicode strings? Olivier Langlois http://www.quazal.com > > import string > NULL = string.m

Re: String comparison question

2006-03-19 Thread Michael Spencer
Olivier Langlois wrote: > I would like to make a string comparison that would return true without > regards of the number of spaces and new lines chars between the words > > like 'A B\nC' = 'A\nBC' > import string NULL = string.maketrans("","") WHITE = string.whitespace def compare(a,b)

Re: System Information

2006-03-19 Thread Serge Orlov
[EMAIL PROTECTED] wrote: > in the online-documentation for this and had no luck. I imagine it is > quite easy and may even be as simple as a boolean variable...? In general it's not so simple, since a computer can have many power sources. > All I want to be able to tell is whether or not my compu

Re: System Information

2006-03-19 Thread [EMAIL PROTECTED]
Oops -- just asked a buddy, osx doesn't have /proc But you could look into sysctl I'll boot up my laptop and check out if there is anything regarding the battery, but I suspect you should investigate sysctl -a | grep acpi -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there such an idiom?

2006-03-19 Thread Per
Thanks Ron, surely set is the simplest way to understand the question, to see whether there is a non-empty intersection. But I did the following thing in a silly way, still not sure whether it is going to be linear time. def foo(): l = [...] s = [...] dic = {} for i in l: d

Re: System Information

2006-03-19 Thread [EMAIL PROTECTED]
I'm not sure about osx, but I know linux uses a proc virtual filesystem. ( freebsd is probably closer, and it doesn't either but you can mount it via mount_linprocfs none /proc) But if you know if you have a proc file system, you can check it to see if you are under power... IE if I remember righ

RE: Keeping a function from taking to long--threads?

2006-03-19 Thread brandon.mcginty
Thanks, however, I forgot to mention that I'm using windows, and from what I've tried, the setdefaulttimeout function doesn't work on my machine. Again, thanks for your help! Brandon McGinty > -Original Message- > From: > [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > rg] On Behalf Of

Re: Python 2.5 Schedule

2006-03-19 Thread Don Taylor
Scott David Daniels wrote: > I think there will be no compiler switching for a while. The previous > switch from VC 6 was in part because there was no longer any legal way > to get a VC 6.0 compiler. This round at least is sticking with the same > compiler as Python 2.4 (VC 7.0). > Scott: Adm

Re: Is there such an idiom?

2006-03-19 Thread Irmen de Jong
Per wrote: > how to find the number of common items between two list in linear-time? > Not really sure about linear-time, but you could try the following: >>> a=[1,2,3,4] >>> b=[3,4,5,6] >>> set(a) & set(b) set([3, 4]) --Irmen -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there such an idiom?

2006-03-19 Thread Ron Adam
Per wrote: > http://jaynes.colorado.edu/PythonIdioms.html > > """Use dictionaries for searching, not lists. To find items in common > between two lists, make the first into a dictionary and then look for > items in the second in it. Searching a list for an item is linear-time, > while searching a

System Information

2006-03-19 Thread MidiBot
Hello. I want to write a program in which the main functionality will depend on whether or not my computer is connected to a power adapter(this is for laptops). I looked in the online-documentation for this and had no luck. I imagine it is quite easy and may even be as simple as a boolean variabl

Re: Keeping a function from taking to long--threads?

2006-03-19 Thread Rene Pijlman
<[EMAIL PROTECTED]>: >Just wondering if anyone knows of a way to keep a function, >E.g. socket.gethostbyaddr("12.34.56.78"), >>From taking to long-if it's run for more than 1 second, the function >gethostbyaddr will be terminated? import socket socket.setdefaulttimeout(1) -- René Pijlman Wat wi

Re: Is there such an idiom?

2006-03-19 Thread Rene Pijlman
Per: >how to find whether there is/are common item(s) between two list >in linear-time? To find items in common between two lists, make the first into a dictionary and then look for items in the second in it. -- René Pijlman Wat wil jij leren? http://www.leren.nl -- http://mail.python.org/mai

Keeping a function from taking to long--threads?

2006-03-19 Thread brandon.mcginty
Hi All, Just wondering if anyone knows of a way to keep a function, E.g. socket.gethostbyaddr("12.34.56.78"), >From taking to long-if it's run for more than 1 second, the function gethostbyaddr will be terminated? I was thinking about using threads, but I can't seem to get the hang of them. I've tr

Is there such an idiom?

2006-03-19 Thread Per
http://jaynes.colorado.edu/PythonIdioms.html """Use dictionaries for searching, not lists. To find items in common between two lists, make the first into a dictionary and then look for items in the second in it. Searching a list for an item is linear-time, while searching a dict for an item is con

Re: Xah's Edu Corner: The Concepts and Confusions of Pre-fix, In-fix, Post-fix and Fully Functional Notations

2006-03-19 Thread Andy Dingley
On Fri, 17 Mar 2006 11:22:06 +0100, Timo Stamm <[EMAIL PROTECTED]> wrote: >Xah's posting was properly encoded and will display fine in every decent >newsreader. Well mine killfiled it straight off, which I think is entirely proper rendering for one of Xah Lee's kookery lessons. -- http://mail.p

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

2006-03-19 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > def sign(n): > return n and n/abs(n) or 0 > > Whoops... Make that > > def sign(n): > return n and n/abs(n) or 1 Uh? I thought part of the specs was that sign(0) is 0... Alex -- http://mail.python.org/mailman/listinfo/python-list

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

2006-03-19 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > Dmitry> doc says that it must be > 0, or < 0, but it seems that it > Dmitry> returns +1 or -1. Can it be reliably used to get the sign of x: > Dmitry> cmp(x, 0) like pascal Sign() function does? > > Why not > > def sign(n): > return n and n/ab

Re: Unpythonic? Impossible??

2006-03-19 Thread Erik Max Francis
Paul Rubin wrote: > I remember having a similar problem involving multiple base classes > and deciding that factory functions couldn't do quite what I wanted. > Here's a thread about it, with a recipe using metaclasses by Roeland > Rengelink: > >http://tinyurl.com/rz6ne > > Unfortunately, th

String comparison question

2006-03-19 Thread Olivier Langlois
Hi,   I would like to make a string comparison that would return true without regards of the number of spaces and new lines chars between the words   like ‘A   B\nC’ = ‘A\nB    C’   What would be the easiest way to do it in Python?   Thanks, Olivier Langlois http://www.quazal.com

Re: Unpythonic? Impossible??

2006-03-19 Thread Paul Rubin
Erik Max Francis <[EMAIL PROTECTED]> writes: > You can, but a class factory is going to be much clearer and probably > more maintainable. From the user's perspective, there's no difference > from calling a class A to instantiate it, and calling a factory > function called A that selects the approp

Passing parameters to VB

2006-03-19 Thread koia
Hi, I am using win32com for the Python interface to my Excel shreadsheets. When I turn on Macro recordiong in Excel while filling a rectangle with text information, a part of the VB code produced is the following: With Selection.Characters(Start:=1, Length:=11).Font .Name = "Arial"

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

2006-03-19 Thread skip
def sign(n): return n and n/abs(n) or 0 Whoops... Make that def sign(n): return n and n/abs(n) or 1 Skip -- http://mail.python.org/mailman/listinfo/python-list

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

2006-03-19 Thread skip
Dmitry> doc says that it must be > 0, or < 0, but it seems that it Dmitry> returns +1 or -1. Can it be reliably used to get the sign of x: Dmitry> cmp(x, 0) like pascal Sign() function does? Why not def sign(n): return n and n/abs(n) or 0 Skip -- http://mail.python.org/

RE: Counting nested loop iterations

2006-03-19 Thread Delaney, Timothy (Tim)
Diez B. Roggisch wrote: >> Oh well, just wait until Python 2.5 comes out and we get people >> complaining about the order of the new if statement. > > Sad, but true. But I'm a happy camper with list-comps and the new > if-expression :) Personally, I'm hoping the unusual order of the if-expressio

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1   2   >