COM makepy util finds multiple versions of my COM object

2007-02-02 Thread bg_ie
Hi, I have a problem where an earlier version of my Com object is being used by makepy for early binding. In makepy I see - MyCom (1.0) MyCom (1.0) MyCom (2.0) I created version 2 of my Com object hoping that this would solve the problem but makepy is still using an earlier version. I can solve

Re: A* search implementation in Python

2007-02-02 Thread Peter Otten
Steven D'Aprano wrote: > On Thu, 01 Feb 2007 18:21:57 -0800, bearophileHUGS wrote: > >> Reid Priedhorsky: >>> I'm looking for an open-source Python implementation of A* search for >>> use in a mapping application. >> >> You can try this one: >> http://aima.cs.berkeley.edu/python/search.html > >

Re: Python, readline and OS X

2007-02-02 Thread Mark Asbach
Hi James, hi Ron, > Where have you installed libreadline? Is LD_LIBRARY_PATH pointing to the > directory libreadline.dylib? Did you install libreadline with fink? If > so, try > >setenv LD_LIBRARY_PATH /sw/lib That would probably make no difference since on Mac OS X that variable is called D

Re: win32com.client

2007-02-02 Thread GHUM
rzed, > 1) In your browser, enter this URL:http://sourceforge.net/projects/pywin32/ > [...] > Try those steps, then try importing win32com again. man, you are SO 2005. Could'nt you please make a screen cap video, upload it to youtube and give a pointer to it on your blog? *wink* Harald --

Re: win32com.client

2007-02-02 Thread GHUM
btw... the statement with "youtube" was a joke. I really applaud rzed you for giving this detailed descriptions, people like him make the spirit of c.l.p.: People get help here WAY over what commercial support usually gets you. Thanks for doing that, rzed! best wishes, HArald -- http://mail.p

Re: Sorting a list

2007-02-02 Thread Duncan Booth
Steven Bethard <[EMAIL PROTECTED]> wrote: > You don't need to use sorted() -- sort() also takes the key= and > reverse= arguments:: > > >>> lines = [('1995', 'aaa'), ('1997', 'bbb'), ('1995', 'bbb'), > ... ('1997', 'aaa'), ('1995', 'ccc'), ('1996', 'ccc'), > ...

Re: LDAP/LDIF Parsing

2007-02-02 Thread Cruelemort
On Feb 1, 11:08 pm, "aspineux" <[EMAIL PROTECTED]> wrote: > The tree hierarchy is defined by the DN of each object, the types of > the object is specified by its objectClass. > Just collect all items (or do it dynamically by tunning the scope and > the base of your search request) > > On 1 fév, 18:

Re: asyncore DoS vulnerability

2007-02-02 Thread William Heymann
On Thursday 01 February 2007, billie wrote: > Here's the traceback: > > Traceback (most recent call last): > File "C:\Documents and Settings\root\Desktop\test.py", line 31, in ? > asyncore.loop(timeout=1) > File "C:\Python24\lib\asyncore.py", line 192, in loop > poll_fun(timeout, map)

Re: Python design project

2007-02-02 Thread Michael
[EMAIL PROTECTED] wrote: .. > I'm a Dutch student, and graduating this year on my graphic design > study. For my graduating study, I want to do some Python work and i'm > lokking for a partner wich can help/ cooperate me in programming > python. > > The project > In short: The project subject is t

Inconsistent list/pointer problem

2007-02-02 Thread Eduardo \"EdCrypt\" O. Padoan
> def myFunc(listA): > listB = listA > work on & modify listB > return(listB) def my_func(listA): listB = listA[:] #work on & modify listB return listB Attribution makes the name t the left 'point' to the result of the expression at the right. In your myFunc the expersion at

Re: Inconsistent list/pointer problem

2007-02-02 Thread Bruno Desthuilliers
Eduardo "EdCrypt" O. Padoan a écrit : >> def myFunc(listA): >> listB = listA >> work on & modify listB >> return(listB) > > def my_func(listA): > listB = listA[:] > #work on & modify listB > return listB Won't do for the OP's needs - he wants to modify the objects contained in

Writing "pythonish" code

2007-02-02 Thread Mizipzor
Hi, this is my first mail to the list (and any list for that matter) so any pointers on errors from my part would be appreciated. Im more used to forums. To start off, Ive read some python documents and done some small apps so I think I can say I know it semi-well, and I know c++ very well. But I

re: Inconsistent list/pointer problem

2007-02-02 Thread Eduardo \"EdCrypt\" O. Padoan
> Won't do for the OP's needs - he wants to modify the objects contained > in listB without impacting the ones in listA (or at least that's what I > understand). Sorry. That is true - the items referenced on the [:] copy are the same as in the original. Rereading what the OP msg, I think we agree

Re: coping directories

2007-02-02 Thread Gigs_
Gabriel Genellina wrote: > En Thu, 01 Feb 2007 21:33:03 -0300, Gigs_ <[EMAIL PROTECTED]> escribió: > >> class CVisitor(FileVisitor): >> def __init__(self, fromdir, todir): >> self.fromdirLen = len(fromdir) + 1# here is my problem >> self.todir = todir >> Fil

Re: Writing "pythonish" code

2007-02-02 Thread skyofdreams
"Mizipzor" <[EMAIL PROTECTED]> ??:[EMAIL PROTECTED] > Hi, this is my first mail to the list (and any list for that matter) > so any pointers on errors from my part would be appreciated. Im more > used to forums. > > To start off, Ive read some python documents and done some small apps > so I

Interpreter window

2007-02-02 Thread Nils Overas Bergen
I have created a Python application in Windows XP which uses WxWidgets. When I start the application from the Python interpreter I get one empty interpreter window in addition to the application window. Is there a way to close the interpreter window without closing the application? Or, can I start

simple SOAP method doesn't work,

2007-02-02 Thread Grzegorz Smith
Hi All. I 'm learning ZSI to use SOAP and I desperately need help. I'm working on example from tutorial -> (examples/server/send_response/ simple/wsdl/). Here are my wsdl files -> http://pastebin.com/873488. I made wsdl2py wsdl2py --complexType --file=binding.wsdl and get Example_services.py and Ex

How do I print out in the standard output coloured lines

2007-02-02 Thread cniharral
Hi, I'm interested in printing out coloured lines of my application and I don't know what to use. Can anybody give me an idea?? Regards. Carlos Niharra López -- http://mail.python.org/mailman/listinfo/python-list

compound statement from C "?:"

2007-02-02 Thread Holger
Hi I have not been able to figure out how to do compound statement from C - "?:" But something similar must exist...?! I would like to do the equivalent if python of the C line: printf("I saw %d car%s\n", n, n != 1 ? "s" : "") Please help /Holger -- http://mail.python.org/mailman/listinfo/py

Re: division by 7 efficiently ???

2007-02-02 Thread Bart Ogryczak
On Feb 1, 3:42 am, [EMAIL PROTECTED] wrote: > How to divide a number by 7 efficiently without using - or / operator. > We can use the bit operators. I was thinking about bit shift operator > but I don't know the correct answer. It´s quiet simple. x == 8*(x/8) + x%8, so x == 7*(x/8) + (x/8 + x%8)

Re: Writing "pythonish" code

2007-02-02 Thread Ben Finney
Mizipzor <[EMAIL PROTECTED]> writes: > The problem isnt in pythons syntax, its in the architecture/design, > the concept of writing "pythonish code" if you like. The nomenclature around here for that concept is "Pythonic". > One thing is that in c++ im used to have private members in classes > a

Re: Interpreter window

2007-02-02 Thread skyofdreams
"Nils Overas Bergen" <[EMAIL PROTECTED]> [EMAIL PROTECTED] >I have created a Python application in Windows XP which uses > WxWidgets. When I start the application from the Python interpreter I > get one empty interpreter window in addition to the application > window. Is there a way to close the

Re: Python does not play well with others

2007-02-02 Thread Paul Boddie
On 2 Feb, 03:46, Paul Rubin wrote: > > I'd say the functionality that John wants is the same that pretty much > everyone wants, and it's much easier to get for other languages than > for Python. If the hosting provider doesn't want to install MySQLdb then it may not be a

Re: File system API

2007-02-02 Thread Eduardo \"EdCrypt\" O. Padoan
On 2/2/07, Tal Einat <[EMAIL PROTECTED]> wrote: > > I think that there aready exists a proposal for an Abstract FS Layer > > for Python somewere. > > I haven't been able to find any mention of it. Maybe you could point me in > the right direction? > > - Tal > http://wiki.python.org/moin/CodingProje

Re: How do I print out in the standard output coloured lines

2007-02-02 Thread rzed
[EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: > Hi, > > I'm interested in printing out coloured lines of my > application and > I don't know what to use. Can anybody give me an idea?? > You could speed up the process if you explain what your application is and what you mean by color

Re: Interpreter window

2007-02-02 Thread Nils Overas Bergen
On 2 Feb, 13:07, "skyofdreams" <[EMAIL PROTECTED]> wrote: > "Nils Overas Bergen" <[EMAIL PROTECTED]> > [EMAIL PROTECTED] > > >I have created a Python application in Windows XP which uses > > WxWidgets. When I start the application from the Python interpreter I > > get one empty interpreter window i

Re: Writing "pythonish" code

2007-02-02 Thread James Stroud
Mizipzor wrote: > Hi, this is my first mail to the list (and any list for that matter) > so any pointers on errors from my part would be appreciated. Im more > used to forums. > > To start off, Ive read some python documents and done some small apps > so I think I can say I know it semi-well, and

Re: Python does not play well with others

2007-02-02 Thread Paul Boddie
On 2 Feb, 04:56, Ben Finney <[EMAIL PROTECTED]> wrote: > > A bug report should be sent to the bug tracker for the software > against which you're reporting a bug. Only at that point does it > become something on which you can comment about attitude toward bug > reports, because before that point th

Re: How do I print out in the standard output coloured lines

2007-02-02 Thread cniharral
On Feb 2, 1:16 pm, rzed <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote innews:[EMAIL PROTECTED]: > > > Hi, > > > I'm interested in printing out coloured lines of my > > application and > > I don't know what to use. Can anybody give me an idea?? > > You could speed up the process if you ex

re: compound statement from C "?:"

2007-02-02 Thread Eduardo \"EdCrypt\" O. Padoan
http://effbot.org/pyfaq/is-there-an-equivalent-of-c-s-ternary-operator.htm -- EduardoOPadoan (eopadoan->altavix::com) Bookmarks: http://del.icio.us/edcrypt Blog: http://edcrypt.blogspot.com Jabber: edcrypt at jabber dot org ICQ: 161480283 GTalk: eduardo dot padoan at gmail dot com MSN: eopadoan a

Re: How do I print out in the standard output coloured lines

2007-02-02 Thread rzed
[EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: > On Feb 2, 1:16 pm, rzed <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote >> innews:[EMAIL PROTECTED]: >> >> > Hi, >> >> > I'm interested in printing out coloured lines of my >> > application and >> > I don't know what to use. Can anyb

Why does this not work?

2007-02-02 Thread alain
I tried the following: myobj=object() myobj.newattr=5 results in: Traceback (most recent call last): File "", line 1, in ? AttributeError: 'object' object has no attribute 'newattr' Any idea? Alain -- http://mail.python.org/mailman/listinfo/python-list

Re: LDAP/LDIF Parsing

2007-02-02 Thread Hallvard B Furuseth
Bruno Desthuilliers writes: > class LdapObject(object): >(...) >def __getattr__(self, name): > try: >data = self._record[name] > except KeyError: >raise AttributeError( > "object %s has no attribute %s" % (self, name) > ) Note that LDAP attribute

Re: Why does this not work?

2007-02-02 Thread Bart Van Loon
It was 2 Feb 2007 04:41:48 -0800, when alain wrote: > I tried the following: > > myobj=object() > myobj.newattr=5 > > results in: > > > Traceback (most recent call last): > File "", line 1, in ? > AttributeError: 'object' object has no attribute 'newattr' > > Any idea? I think it's because... ob

Re: Why does this not work?

2007-02-02 Thread alain
On Feb 2, 1:57 pm, Bart Van Loon <[EMAIL PROTECTED]> wrote: > It was 2 Feb 2007 04:41:48 -0800, when alain wrote: > > > I tried the following: > > > myobj=object() > > myobj.newattr=5 > > > results in: > > > Traceback (most recent call last): > > File "", line 1, in ? > > AttributeError: 'object'

Re: How do I print out in the standard output coloured lines

2007-02-02 Thread cniharral
On Feb 2, 1:38 pm, rzed <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote innews:[EMAIL PROTECTED]: > > > > > On Feb 2, 1:16 pm, rzed <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote > >> innews:[EMAIL PROTECTED]: > > >> > Hi, > > >> > I'm interested in printing out coloured lines of my

Re: How do I print out in the standard output coloured lines

2007-02-02 Thread Bart Van Loon
It was 2 Feb 2007 04:27:06 -0800, when [EMAIL PROTECTED] wrote: > print "Hello World!!" > > I want it in red colour. > > That's all. Use colour escape codes: print "\033[1;31mHello World\033[0m" That's all. :-) -- groetjes, BBBart Golly, I'd hate to have a kid like me!

Re: Writing "pythonish" code

2007-02-02 Thread Toby A Inkster
Mizipzor wrote: > One thing is that in c++ im used to have private members in classes and > no member is altered except through the public functions of the class. By convention, class members starting with a single underscore are considered private. This is much the same as the convention that

Re: LDAP/LDIF Parsing

2007-02-02 Thread Bruno Desthuilliers
Hallvard B Furuseth a écrit : > Bruno Desthuilliers writes: >> class LdapObject(object): >>(...) >>def __getattr__(self, name): >> try: >>data = self._record[name] >> except KeyError: >>raise AttributeError( >> "object %s has no attribute %s" % (self, name

Re: mysqldb duplicate entry error handling

2007-02-02 Thread baur79
thanks John this solves my problem except MySQLdb.IntegrityError, message: thanks everybody again Baurzhan Zhakashev Kazakhstan / Shymkent city -- http://mail.python.org/mailman/listinfo/python-list

Re: asyncore DoS vulnerability

2007-02-02 Thread aspineux
Did you take a look for "too many file descriptors in select()" on google. On 1 fév, 20:18, "billie" <[EMAIL PROTECTED]> wrote: > Hi all. I've just terminated a server application using asyncore / > asynchat frameworks. > I wrote a test script that performs a lot of connections to the server > app

Re: coping directories

2007-02-02 Thread Gigs_
Gabriel Genellina wrote: > En Thu, 01 Feb 2007 21:33:03 -0300, Gigs_ <[EMAIL PROTECTED]> escribió: > >> class CVisitor(FileVisitor): >> def __init__(self, fromdir, todir): >> self.fromdirLen = len(fromdir) + 1# here is my problem >> self.todir = todir >> Fil

About PyCamp - a Regional Python Unconference

2007-02-02 Thread Jeff Rush
A week or so ago, the Dallas and Houston Python User Groups met online in a chat room, to discuss the possibility of a regional Python conference. There was interest on all sides. Some of the Dallas members had recently attended their second BarCamp (http://barcamp.org), defined as an ad-hoc gath

Re: Why does this not work?

2007-02-02 Thread Laurent Pointal
alain a écrit : > On Feb 2, 1:57 pm, Bart Van Loon <[EMAIL PROTECTED]> wrote: >> It was 2 Feb 2007 04:41:48 -0800, when alain wrote: >> >>> I tried the following: >>> myobj=object() >>> myobj.newattr=5 >>> results in: >>> Traceback (most recent call last): >>> File "", line 1, in ? >>> AttributeE

Re: How do I print out in the standard output coloured lines

2007-02-02 Thread cniharral
On Feb 2, 2:08 pm, Bart Van Loon <[EMAIL PROTECTED]> wrote: > It was 2 Feb 2007 04:27:06 -0800, when [EMAIL PROTECTED] wrote: > > > print "Hello World!!" > > > I want it in red colour. > > > That's all. > > Use colour escape codes: > > print "\033[1;31mHello World\033[0m" > > That's all. :-) > > --

newbie/ merging lists of lists with items in common

2007-02-02 Thread ardief
Hi everyone Here is my problem: I have a list that looks like this - [['a', '13'], ['a', '3'], ['b', '6'], ['c', '12'], ['c', '15'], ['c', '4'], ['d', '2'], ['e', '11'], ['e', '5'], ['e', '16'], ['e', '7']] and I would like to end up with something like this, i.e. with the only one list per letter

Re: LDAP/LDIF Parsing

2007-02-02 Thread Michael Ströder
Cruelemort wrote: > I was wondering the best way to do this? I have installed and used the > python-ldap libraries and these allow me to access and search the > server, but the searches always return a horrible nesting of lists, > tuples and dictionaries, below is an example of returning just one >

Re: division by 7 efficiently ???

2007-02-02 Thread Neil Cerutti
On 2007-02-01, Michael Yanowitz <[EMAIL PROTECTED]> wrote: > I think it is off by 1 in small numbers, off by a little more with large > numbers: def div7 (N): > ...return (N>>3) + ((N-7*(N>>3))>>3) > ... div7 (70) > 9 div7 (77) > 10 div7 (700) > 98 div7 (7) > 0 d

Re: How do I print out in the standard output coloured lines

2007-02-02 Thread Neil Cerutti
On 2007-02-02, rzed <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote in > news:[EMAIL PROTECTED]: > >> On Feb 2, 1:16 pm, rzed <[EMAIL PROTECTED]> wrote: >>> [EMAIL PROTECTED] wrote >>> innews:[EMAIL PROTECTED]: >>> >>> > Hi, >>> >>> > I'm interested in printing out coloured lines of my >>>

Re: need help on a data structure problem

2007-02-02 Thread Neil Cerutti
On 2007-02-02, Ben Finney <[EMAIL PROTECTED]> wrote: > "Dongsheng Ruan" <[EMAIL PROTECTED]> writes: > >> Not quite related with Python. But my Data Structure course is >> experiemented on python and there is no data structure group, So I >> have to post here: > > Better, you should discuss it in yo

Re: Overloading the tilde operator?

2007-02-02 Thread Neil Cerutti
On 2007-02-02, Ben Finney <[EMAIL PROTECTED]> wrote: > James Stroud <[EMAIL PROTECTED]> writes: >> Ben Finney wrote: >> > The Python runtime parser is designed to parse Python, not >> > some arbitrary language that someone chooses to implement in >> > Python. >> >> You haven't addressed why the lim

Re: newbie/ merging lists of lists with items in common

2007-02-02 Thread Miki
Hello, > Here is my problem: > I have a list that looks like this - > [['a', '13'], ['a', '3'], ['b', '6'], ['c', '12'], ['c', '15'], ['c', > '4'], ['d', '2'], ['e', '11'], ['e', '5'], ['e', '16'], ['e', '7']] > > and I would like to end up with something like this, i.e. with the > only one list pe

Re: How do I print out in the standard output coloured lines

2007-02-02 Thread Miki
Hello Carlos, > I'm interested in printing out coloured lines of my application and > I don't know what to use. Can anybody give me an idea?? I use the following script: #!/usr/bin/env python '''Print message using ANSI terminal codes''' __author__ = "Miki Tebeka <[EMAIL PROTECTED]>" # $Id: ans

Re: newbie/ merging lists of lists with items in common

2007-02-02 Thread Larry Bates
ardief wrote: > Hi everyone > Here is my problem: > I have a list that looks like this - > [['a', '13'], ['a', '3'], ['b', '6'], ['c', '12'], ['c', '15'], ['c', > '4'], ['d', '2'], ['e', '11'], ['e', '5'], ['e', '16'], ['e', '7']] > > and I would like to end up with something like this, i.e. with

Re: LDAP/LDIF Parsing

2007-02-02 Thread Hallvard B Furuseth
Bruno Desthuilliers writes: >Hallvard B Furuseth a écrit : >>> else: >>># all LDAP attribs are multivalued by default, >>># even when the schema says they are monovalued >>>if len(data) == 1: >>> return data[0] >>>else: >>> return data[:] >>

Re: How do I print out in the standard output coloured lines

2007-02-02 Thread Geoffrey Clements
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Feb 2, 1:38 pm, rzed <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote > innews:[EMAIL PROTECTED]: > > > > > On Feb 2, 1:16 pm, rzed <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote > >> innews:[EMAIL PROTECTED]: > > >> > Hi

Re: newbie/ merging lists of lists with items in common

2007-02-02 Thread Paddy
On Feb 2, 1:55 pm, "ardief" <[EMAIL PROTECTED]> wrote: > Hi everyone > Here is my problem: > I have a list that looks like this - > [['a', '13'], ['a', '3'], ['b', '6'], ['c', '12'], ['c', '15'], ['c', > '4'], ['d', '2'], ['e', '11'], ['e', '5'], ['e', '16'], ['e', '7']] > > and I would like to end

Re: newbie/ merging lists of lists with items in common

2007-02-02 Thread Neil Cerutti
On 2007-02-02, ardief <[EMAIL PROTECTED]> wrote: > Hi everyone > Here is my problem: > I have a list that looks like this - > [['a', '13'], ['a', '3'], ['b', '6'], ['c', '12'], ['c', '15'], ['c', > '4'], ['d', '2'], ['e', '11'], ['e', '5'], ['e', '16'], ['e', '7']] > > and I would like to end up wi

Re: newbie/ merging lists of lists with items in common

2007-02-02 Thread Laurent Pointal
ardief a écrit : > Hi everyone > Here is my problem: > I have a list that looks like this - > [['a', '13'], ['a', '3'], ['b', '6'], ['c', '12'], ['c', '15'], ['c', > '4'], ['d', '2'], ['e', '11'], ['e', '5'], ['e', '16'], ['e', '7']] > > and I would like to end up with something like this, i.e. wi

Re: newbie/ merging lists of lists with items in common

2007-02-02 Thread Paddy
On Feb 2, 2:39 pm, "Paddy" <[EMAIL PROTECTED]> wrote: > On Feb 2, 1:55 pm, "ardief" <[EMAIL PROTECTED]> wrote: > > > > > Hi everyone > > Here is my problem: > > I have a list that looks like this - > > [['a', '13'], ['a', '3'], ['b', '6'], ['c', '12'], ['c', '15'], ['c', > > '4'], ['d', '2'], ['e',

Re: newbie/ merging lists of lists with items in common

2007-02-02 Thread Bart Ogryczak
On Feb 2, 2:55 pm, "ardief" <[EMAIL PROTECTED]> wrote: > Hi everyone > Here is my problem: > I have a list that looks like this - > [['a', '13'], ['a', '3'], ['b', '6'], ['c', '12'], ['c', '15'], ['c', > '4'], ['d', '2'], ['e', '11'], ['e', '5'], ['e', '16'], ['e', '7']] > > and I would like to end

Re: newbie/ merging lists of lists with items in common

2007-02-02 Thread Laurent Pointal
Neil Cerutti a écrit : > On 2007-02-02, ardief <[EMAIL PROTECTED]> wrote: > This is a job for... duhn-duhn-DH! Captain CHAOS! > > Er... I mean itertools.groupby. > > def key_func(t): > return t[0] Not needed: --> from operator import itemgetter See in the example: http://docs

Re: newbie/ merging lists of lists with items in common

2007-02-02 Thread Bart Ogryczak
On Feb 2, 3:19 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > l=[x for x in d.items()] d.items() is not an iterator, you don´t need this. This code is equivalent to l = d.items(). -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing "pythonish" code

2007-02-02 Thread Istvan Albert
On Feb 2, 6:20 am, Mizipzor <[EMAIL PROTECTED]> wrote: > Now, the thing that bothers me the most. When I write python modules I > write one class per file, and the file and the class has a common > name. Maybe this is due to c++ habits. Python modules typically contain multiple classes and modul

Re: Germany issues warrants for 13 American CIA agents

2007-02-02 Thread Boris Borcic
Vance P. Frickey wrote: > I understand that Mengele's old boss is still alive and well > in Deutschland What else do you understand ? -- http://mail.python.org/mailman/listinfo/python-list

Re: compound statement from C "?:"

2007-02-02 Thread Jussi Salmela
Holger kirjoitti: > > I would like to do the equivalent if python of the C line: > printf("I saw %d car%s\n", n, n != 1 ? "s" : "") > > Please help > > /Holger > In this particular case you don't need the ternary operator: print "I saw %d car%s\n" % (n, ("", "s")[n != 1]) Cheers, Jus

Re: newbie/ merging lists of lists with items in common

2007-02-02 Thread Neil Cerutti
On 2007-02-02, Laurent Pointal <[EMAIL PROTECTED]> wrote: > Neil Cerutti a écrit : >> On 2007-02-02, ardief <[EMAIL PROTECTED]> wrote: > > >> This is a job for... duhn-duhn-DH! Captain CHAOS! >> >> Er... I mean itertools.groupby. >> > >> def key_func(t): >> return t[0] > > Not nee

Re: newbie/ merging lists of lists with items in common

2007-02-02 Thread ardief
On Feb 2, 1:55 pm, "ardief" <[EMAIL PROTECTED]> wrote: > Hi everyone > Here is my problem: > I have a list that looks like this - > [['a', '13'], ['a', '3'], ['b', '6'], ['c', '12'], ['c', '15'], ['c', > '4'], ['d', '2'], ['e', '11'], ['e', '5'], ['e', '16'], ['e', '7']] > > and I would like to end

Re: Tkinter Scrolling

2007-02-02 Thread Eric Brunel
On Thu, 01 Feb 2007 20:26:08 +0100, D <[EMAIL PROTECTED]> wrote: > Bob Greschke wrote: >> The typical way to do it is to make a scrolling canvas and >> pack the buttons and other stuff into an empty Frame() and then pack >> the frame on to the canvas, which I haven't had to do yet. >> >> Bob > Than

Re: Writing "pythonish" code

2007-02-02 Thread Neil Cerutti
On 2007-02-02, Toby A Inkster <[EMAIL PROTECTED]> wrote: > Mizipzor wrote: >> One thing is that in c++ im used to have private members in >> classes and no member is altered except through the public >> functions of the class. > > By convention, class members starting with a single underscore > are

Re: division by 7 efficiently ???

2007-02-02 Thread Jesse Chounard
On 31 Jan 2007 19:13:14 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Its not an homework. I appeared for EA sports interview last month. I > was asked this question and I got it wrong. I have already fidlled > around with the answer but I don't know the correct reasoning behind > it. I th

Re: division by 7 efficiently ???

2007-02-02 Thread John Machin
On Feb 2, 11:03 pm, "Bart Ogryczak" <[EMAIL PROTECTED]> wrote: > On Feb 1, 3:42 am, [EMAIL PROTECTED] wrote: > > > How to divide a number by 7 efficiently without using - or / operator. > > We can use the bit operators. I was thinking about bit shift operator > > but I don't know the correct answer

Re: asyncore DoS vulnerability

2007-02-02 Thread billie
> This is not a CRASH, It looks an exception with a "Traceback", this is > the normal way python report problems, nothing wrong with that. > You can handle it with a try: except: I think that such a thing should be handled by asyncore itself. > 512 is probably a fixed limit into XP, win2k3 or win

Re: division by 7 efficiently ???

2007-02-02 Thread John Machin
On Feb 3, 2:31 am, "Jesse Chounard" <[EMAIL PROTECTED]> wrote: > On 31 Jan 2007 19:13:14 -0800, [EMAIL PROTECTED] > > <[EMAIL PROTECTED]> wrote: > > Its not an homework. I appeared for EA sports interview last month. I > > was asked this question and I got it wrong. I have already fidlled > > aroun

Re: asyncore DoS vulnerability

2007-02-02 Thread Chris Mellon
On 2 Feb 2007 07:32:14 -0800, billie <[EMAIL PROTECTED]> wrote: > > This is not a CRASH, It looks an exception with a "Traceback", this is > > the normal way python report problems, nothing wrong with that. > > You can handle it with a try: except: > > I think that such a thing should be handled by

Re: coping directories

2007-02-02 Thread Jussi Salmela
Gigs_ kirjoitti: > hi people > > I have problem with this example, not actually the problem, but > [code] > class FileVisitor(object): > def __init__(self, data=None): > self.context = data > def run(self, startdir=os.curdir): > os.path.walk(startdir, self.visitor, None) >

from __future__ import absolute_import ?

2007-02-02 Thread Ron Adam
from __future__ import absolute_import Is there a way to check if this is working? I get the same results with or without it. Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win 32 _Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: coping directories

2007-02-02 Thread Gigs_
Jussi Salmela wrote: > Gigs_ kirjoitti: >> hi people >> >> I have problem with this example, not actually the problem, but >> [code] >> class FileVisitor(object): >> def __init__(self, data=None): >> self.context = data >> def run(self, startdir=os.curdir): >> os.path.walk(s

Re: stlib name clash when using python as ASP language

2007-02-02 Thread Gabriel Genellina
"Joost" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > When using ASP the iis/inetsrv path is placed as the first item in > sys.path. Consequently importing httplib2 will cause the following > error: > > ImportError: dynamic module does not define init function (initgzip) > >

Re: division by 7 efficiently ???

2007-02-02 Thread Bart Ogryczak
On Feb 1, 2:00 pm, "Nicko" <[EMAIL PROTECTED]> wrote: > precision and the answer that they were looking for was: > a = (b * 045L) >> 32 > Note that the constant there is in octal. 045L? Shouldn´t it be 044? Or more generally, const = (1<>bitPrecision -- http://mail

Re: Sorting a list

2007-02-02 Thread John Salerno
Bruno Desthuilliers wrote: > John Salerno a écrit : > (snip) > >> Oh I didn't sort then reverse, I just replaced sort with reverse. >> Maybe that's why! > > Hmmm... Probably, yes... > > !-) lol, this is what a couple months away from python does to me! -- http://mail.python.org/mailman/listin

Re: coping directories

2007-02-02 Thread Gabriel Genellina
"Gigs_" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] Gabriel Genellina wrote: > En Thu, 01 Feb 2007 21:33:03 -0300, Gigs_ <[EMAIL PROTECTED]> escribió: > >> class CVisitor(FileVisitor): >> def __init__(self, fromdir, todir): >> self.fromdirLen = len(fromdir) + 1

Re: asyncore DoS vulnerability

2007-02-02 Thread skip
billie> asyncore aims to be a framework, right? I think that when billie> select() limit is reached asyncore should just drop other billie> connections. That's all. You're asking asyncore to make a policy decision on behalf the controlling application. It has no idea what that appli

Re: Interpreter window

2007-02-02 Thread Gabriel Genellina
"Nils Overas Bergen" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > On 2 Feb, 13:07, "skyofdreams" <[EMAIL PROTECTED]> wrote: >> "Nils Overas Bergen" <[EMAIL PROTECTED]> >> [EMAIL PROTECTED] >> >> >I have created a Python application in Windows XP which uses >> > WxWidgets. W

Re: division by 7 efficiently ???

2007-02-02 Thread Nicko
On Feb 2, 4:21 pm, "Bart Ogryczak" <[EMAIL PROTECTED]> wrote: > On Feb 1, 2:00 pm, "Nicko" <[EMAIL PROTECTED]> wrote: > > > precision and the answer that they were looking for was: > > a = (b * 045L) >> 32 > > Note that the constant there is in octal. > > 045L? Shouldn´t it be

Re: asyncore DoS vulnerability

2007-02-02 Thread Jean-Paul Calderone
On Fri, 2 Feb 2007 10:39:57 -0600, [EMAIL PROTECTED] wrote: > >billie> asyncore aims to be a framework, right? I think that when >billie> select() limit is reached asyncore should just drop other >billie> connections. That's all. > >You're asking asyncore to make a policy decision on b

OSS and ALSA

2007-02-02 Thread Silver Rock
Hi all, I've seen that python comes by default with a module for communication with OSS. I've looked for a ALSA module too (pyalsa) but it seems to handle only limited operations. Is it recommended that one programm using oss becouse of Alsa's OSS compatibility? thanks, claire -- http://ma

Re: from __future__ import absolute_import ?

2007-02-02 Thread Peter Otten
Ron Adam wrote: > > from __future__ import absolute_import > > Is there a way to check if this is working? I get the same results with > or without it. > > Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) > [MSC v.1310 32 bit (Intel)] on win 32 If there are two modules 'foo', one at

Re: Spring Python 0.2.0 is released

2007-02-02 Thread Jonathan Curran
Greg, You have managed to peak my interest. I'll be dabbling with this in the next few hours. This looks very promising, keep up the good work. - Jonathan -- http://mail.python.org/mailman/listinfo/python-list

Re: division by 7 efficiently ???

2007-02-02 Thread Nicko
On Feb 1, 8:25 pm, "Krypto" <[EMAIL PROTECTED]> wrote: > The correct answer as told to me by a person is > > (N>>3) + ((N-7*(N>>3))>>3) > > The above term always gives division by 7 No it doesn't. The above term tends towards N * (9/64), with some significant rounding errors. 9/64 is a fairly po

Re: from __future__ import absolute_import ?

2007-02-02 Thread Peter Otten
Peter Otten wrote: > If there are two modules 'foo', one at the toplevel and the other inside a > package 'bar', > > from __future__ import absolute_import > import foo > > will import the toplevel module whereas > > import foo > > will import bar.foo. ... provided these imports are performe

Re: compound statement from C "?:"

2007-02-02 Thread bearophileHUGS
Jussi Salmela: > In this particular case you don't need the ternary operator: > print "I saw %d car%s\n" % (n, ("", "s")[n != 1]) The last newline is probably unnecessary. This seems be a bit more readable: print "I saw", n, "car" + ("", "s")[n != 1] With Python 2.5 this looks better: print "I sa

Build Python 2.5 wit VC6.0 ?

2007-02-02 Thread Alexander Eisenhuth
Hi everybody, does somebody have experience in building with VC6.0. On my first try there where missing C-Modules. Is that true. VC6.0 is not supported? Thanks a lot. Regards Alexander PC: What Python version supports VC6.0? -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing "pythonish" code

2007-02-02 Thread bearophileHUGS
Mizipzor: > To me, the main.py code above looks very ugly. With time, and looking at other people code, you will learn what pythonic means, in the meantime you can remember that into your Python code if you find something that makes you write too much code, or you see something "ugly", then that's

Timeout for M2Crypto working - patch

2007-02-02 Thread John Nagle
-- http://mail.python.org/mailman/listinfo/python-list

[Q] result of os.times() is different with 'time' command

2007-02-02 Thread kwatch
Hi, I have a question about os.times(). os.times() returns a tuple containing user time and system time, but it is not matched to the result of 'time' command. For example, os.times() reports that user time is 39.85 sec, but 'time' command reports that user time is 28.55sec. (machine: Python2.5, M

Checking default arguments

2007-02-02 Thread Igor V. Rafienko
Hi, I was wondering whether it was possible to find out which parameter value is being used: the default argument or the user-supplied one. That is: def foo(x, y="bar"): # how to figure out whether the value of y is # the default argument, or user-supplied? foo(1, "bar") => user-sup

Re: Ubunu - Linux - Unicode - encoding

2007-02-02 Thread Franz Steinh�usler
On Fri, 2 Feb 2007 00:12:45 +0100, Alan Franzoni <[EMAIL PROTECTED]> wrote: >Il Thu, 01 Feb 2007 20:57:53 +0100, Franz Steinhäusler ha scritto: > >> If I copy files with german umlauts (äöü and strong 's' ß), these >> filenames are not copied properly, and that characters are replaces >> by l

Sybase module 0.38pre2 released

2007-02-02 Thread Sébastien Sablé
WHAT IS IT: The Sybase module provides a Python interface to the Sybase relational database system. It supports all of the Python Database API, version 2.0 with extensions. The module is available here: http://downloads.sourceforge.net/python-sybase/python-sybase-0.38pre2.tar.gz The module ho

Re: Python does not play well with others

2007-02-02 Thread Paul Rubin
"Paul Boddie" <[EMAIL PROTECTED]> writes: > If the hosting provider doesn't want to install MySQLdb then it may > not be a technical issue - perhaps they just can't be bothered to > install it, possibly because there's no demand or benefit to the > bottom line in doing so. Why should the hosting p

  1   2   >