Re: can't solve an exercise-help me with it

2006-01-12 Thread Tim Roberts
"hossam" <[EMAIL PROTECTED]> wrote: >I'm studying python newly and have an exercise that is difficult for me as a >beginner.Here it is : >"Write a program that approximates the value of pi by summing the terms of >this series: >4/1-4/3+4/5-4/7+4/9-4/11+ The program should prompt the user for

Re: Python Scripts to logon to websites

2006-01-12 Thread Steve Holden
Peter Hansen wrote: > BartlebyScrivener wrote: > >>>but googling for "basic authentication" and >>>maybe "realm" and/or "host" will find you other sites with less >>>technically detailed material. >> >>This looks promising, but it'll take me a week to understand it :) >> >>http://www.voidspace.org

Re: MVC in wxPython HELP!

2006-01-12 Thread bwaha
> Can I just suggest you search in Google Groups for the message by > "has" labelled "Re: MVC programming with python (newbie) - please help". > Dated: 7 Jan 2006 07:03:04 -0800. It is one of the nicest short > descriptions of the MVC pattern and why it works. I'll second that -- http://m

Re: Real-world use cases for map's None fill-in feature?

2006-01-12 Thread Raymond Hettinger
[David Murmann] > i'd like izip > to change, too. The zip() function, introduced in Py2.0, was popular and broadly useful. The izip() function is a zip() substitute with better memory utilization yet almost identical in how it is used. It is bugfree, successful, fast, and won't change. The map(

Unicode style in win32/PythonWin

2006-01-12 Thread Robert
Neil Hodgson wrote: > Robert: > > > After "is_platform_unicode = ", scintilla displays some unicode > > as you showed. but the win32-functions (e.g. MessageBox) still do not > > pass through wide unicode. > > Win32 issues are better discussed on the python-win32 mailing list > which is read by

Re: Reading from input file.

2006-01-12 Thread Sheldon
Hi, after you have read the file then split it like this: file = open('inputfile.txt', 'r').read() import string file = string.split(file,'\n') now if you print file[0] you should only get the first line. Be careful and examine the file for non-continuous sections where a line is empty. That is to

Re: Problems with WX and program loop...

2006-01-12 Thread Mr BigSmoke
Great! Tnx!! -- http://mail.python.org/mailman/listinfo/python-list

Re: Why keep identity-based equality comparison?

2006-01-12 Thread Antoon Pardon
Op 2006-01-11, Mike Meyer schreef <[EMAIL PROTECTED]>: > Antoon Pardon <[EMAIL PROTECTED]> writes: >> Op 2006-01-11, Mike Meyer schreef <[EMAIL PROTECTED]>: >>> Antoon Pardon <[EMAIL PROTECTED]> writes: Op 2006-01-10, Mike Meyer schreef <[EMAIL PROTECTED]>: >> Now you can take the practica

Re: flatten a level one list

2006-01-12 Thread Cyril Bazin
Another try: def flatten6(x, y): return list(chain(*izip(x, y))) (any case, this is shorter ;-) Cyril On 1/12/06, Michael Spencer <[EMAIL PROTECTED]> wrote: > Tim Hochberg wrote: > > Michael Spencer wrote: > >> > Robin Becker schrieb: > >> >> Is there some smart/fast way to flatten a leve

Re: flatten a level one list

2006-01-12 Thread Robin Becker
Paul Rubin wrote: > Paul Rubin writes: > >import operator >a=[(1,2),(3,4),(5,6)] >reduce(operator.add,a) >> >>(1, 2, 3, 4, 5, 6) > > > (Note that the above is probably terrible if the lists are large and > you're after speed.) yes, and it is all in C and so

Re: Exception Handling

2006-01-12 Thread Sheldon
Hi, This is a non-trivial thing that you are trying to do. You can use some of python's built-in exceptions, like RuntimeError or IOError and if so then: try: call C except IOError, e: print e But this will return and print only IOErrors if they occur. You can define your own error handlin

Re: void * C array to a Numpy array using Swig

2006-01-12 Thread Jon
Krish, In case you find a good solution, I am also looking for one! For now I essentially use helper functions on the c side which wrap in SWIG to return the data as a string in python. That string can then be converted to a numpy array using the fromstring function. This is inefficient as it doe

Re: flatten a level one list

2006-01-12 Thread Peter Otten
Tim Hochberg wrote: > Here's one more that's quite fast using Psyco, but only average without > it. > def flatten6(): > n = min(len(xdata), len(ydata)) > result = [None] * (2*n) > for i in xrange(n): > result[2*i] = xdata[i] > result[2*i+1] = ydata[i] I

Re: Why keep identity-based equality comparison?

2006-01-12 Thread Paul Rubin
Antoon Pardon <[EMAIL PROTECTED]> writes: > There is a use case for things like 1 < (1,3) making sense and denoting > a total order. When you have a hetergenous list, having a total order > makes it possible to sort the list which will make it easier to > weed out duplicates. So why don't you deman

How can I create a dict that sets a flag if it's been modified

2006-01-12 Thread sandravandale
I can think of several messy ways of making a dict that sets a flag if it's been altered, but I have a hunch that experienced python programmers would probably have an easier (well maybe more Pythonic) way of doing this. It's important that I can read the contents of the dict without flagging it a

Re: flatten a level one list

2006-01-12 Thread Paul Rubin
Robin Becker <[EMAIL PROTECTED]> writes: > >reduce(operator.add,a) > ... > A fast implementation would probably allocate the output list just > once and then stream the values into place with a simple index. That's what I hoped "sum" would do, but instead it barfs with a type error. So much f

Re: Python Scripts to logon to websites

2006-01-12 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > Underlining your point, the difference between the two is that digest > offers *strong* authentication (i.e. is not subject to replay attacks) As I mentioned in another post, that's really not enough, since digest still exposes the password hash to offlin

Re: flatten a level one list

2006-01-12 Thread bonono
Robin Becker wrote: > Paul Rubin wrote: > > Paul Rubin writes: > > > >import operator > >a=[(1,2),(3,4),(5,6)] > >reduce(operator.add,a) > >> > >>(1, 2, 3, 4, 5, 6) > > > > > > (Note that the above is probably terrible if the lists are large and > > you're aft

Re: How can I create a dict that sets a flag if it's been modified

2006-01-12 Thread Amit Khemka
Ideally, I would have made a wrapper to add/delete/modify/read from the dictionay. But other than this, one way i can think straight off is to "pickle" the dict, and to see if the picked object is same as current object. cheers, amit. On 12 Jan 2006 01:15:38 -0800, [EMAIL PROTECTED] <[EMAIL PROT

Re: How can I create a dict that sets a flag if it's been modified

2006-01-12 Thread Paul Rubin
[EMAIL PROTECTED] writes: > Still, I'd love to hear how you guys would do it. Make a subclass of dict, or an object containing a dictionary, that has a special __setattr__ method that traps updates and sets that modification flag. There are contorted ways the caller can avoid triggering the flag,

Re: Unicode style in win32/PythonWin

2006-01-12 Thread Thomas Heller
"Robert" <[EMAIL PROTECTED]> writes: > Neil Hodgson wrote: >> Robert: >> >> > After "is_platform_unicode = ", scintilla displays some unicode >> > as you showed. but the win32-functions (e.g. MessageBox) still do not >> > pass through wide unicode. >> >> Win32 issues are better discussed on th

Re: Real-world use cases for map's None fill-in feature?

2006-01-12 Thread Raymond Hettinger
[EMAIL PROTECTED] > > > How well correlated in the use of map()-with-fill with the > > > (need for) the use of zip/izip-with-fill? [raymond] > > Close to 100%. A non-iterator version of izip_longest() is exactly > > equivalent to map(None, it1, it2, ...). [EMAIL PROTECTED] > If I use map() > I c

Re: How can I create a dict that sets a flag if it's been modified

2006-01-12 Thread Brian van den Broek
[EMAIL PROTECTED] said unto the world upon 12/01/06 03:15 AM: > I can think of several messy ways of making a dict that sets a flag if > it's been altered, but I have a hunch that experienced python > programmers would probably have an easier (well maybe more Pythonic) > way of doing this. > > It'

Re: Spelling mistakes!

2006-01-12 Thread Antoon Pardon
Op 2006-01-11, Hans Nowak schreef <[EMAIL PROTECTED]>: > Antoon Pardon wrote: > >> Op 2006-01-10, Terry Hancock schreef <[EMAIL PROTECTED]>: >> >>>In unit testing, you write the code, then write code to test >>>the code, which must correctly identify the methods in the >>>code. So you have to type

different versions for 2.3.4 documentation

2006-01-12 Thread Manlio Perillo
Regards. I'm only a bit curious, but why documentation from http://www.python.org/ftp/python/2.3.4/Python-2.3.4.tar.bz2 and http://www.python.org/ftp/python/doc/2.3.4/latex-2.3.4.tar.bz2 differ? Regards Manlio Perillo -- http://mail.python.org/mailman/listinfo/python-list

Re: Programming Eclipse plugins in Jython?

2006-01-12 Thread Fabio Zadrozny
Kenneth McDonald wrote: >Is it easy or difficult to implement Eclipse plugins in Jython? And >if the former, are there any starter's guides you could recommend? > >The desire is an editor plugin for a syntactically very simple >proprietary language. I'd like to have paren checking, syntax >c

Re: New Python.org website ?

2006-01-12 Thread Tim Parkin
Mike Meyer wrote: > Stefan Rank <[EMAIL PROTECTED]> writes: >>Very nice! >>Just wanted to note that the content area and the menu area overlap >>(leaving some content unreadable) >>in Opera 8.51 / WinXP > > > Ditto for Opera 8.51 / OSX, and for Safari. > > It's a problem with not handling users

Re: New Python.org website ?

2006-01-12 Thread Tim Parkin
rzed wrote: > So what's the character encoding? I haven't found (WinXP Firefox) > that displays that city in Sweden without a paragraph symbol or > worse. It's going to be utf8 hopefully but we're just fighting with conversions from existing content which I'd wrongly assumed was already iso8859-1

Re: New Python.org website ?

2006-01-12 Thread Tim Parkin
Fuzzyman wrote: > Steve Holden wrote: > >>Fuzzyman wrote: >> >>>Now that is a very cool site. >>> >>>I'm not very good with HTML - but can write content... I might see if >>>there is something I can do. >>> >>>All the best, >>> >>>Fuzzyman >>>http://www.voidspace.org.uk/python/index.shtml >>>(and

Re: Python-list Digest, Vol 28, Issue 191

2006-01-12 Thread Manish Kumar (WT01 - Software Products & OSS)
Hi, It does not work. I had already tried this earlier. Please suggest some other solutions. Also, I would like to see the stack from where the exception started. Thanks n regards, Manish Kumar On Thu, 2006-01-12 at 10:40 +0100, [EMAIL PROTECTED] wrote: > Send Python-list mailing list submiss

Re: Unicode & Pythonwin / win32 / console?

2006-01-12 Thread Robert
Martin v. Löwis schrieb: > Robert wrote: > > is in a PythonWin Interactive session - ok results for cyrillic chars > > (tolerant mbcs/utf-8 encoding!). > > But if I do this on Win console (as you probably mean), I get also > > encoding Errors - no matter if chcp1251, because cyrillic chars raise

Re: How can I create a dict that sets a flag if it's been modified

2006-01-12 Thread Tim N. van der Leeuw
Should the dict flag when the dict itself has been updated? Or also when any of the items in the dict has been updated? Say you have a dict consisting of lists... The dict should be flagged as modified when an item is added; or when an item is replaced (you call dict.__setitem__ with a key that a

Re: How can I create a dict that sets a flag if it's been modified

2006-01-12 Thread Brian van den Broek
Brian van den Broek said unto the world upon 12/01/06 03:42 AM: > [EMAIL PROTECTED] said unto the world upon 12/01/06 03:15 AM: > >>I can think of several messy ways of making a dict that sets a flag if >>it's been altered, but I have a hunch that experienced python >>programmers would probably ha

Re: Determination of disk types

2006-01-12 Thread Mondal
Hi, Thanks for the info. That was quite useful. I will surely poke around wmi. Thanks again Regards Mondal -- http://mail.python.org/mailman/listinfo/python-list

Re: Exception Handling

2006-01-12 Thread Manish Kumar (WT01 - Software Products & OSS)
I tried with this piece of code def temp(): try: print "In try" libsummac.main1() except RuntimeError, re: print "caught" + re except e: print "caught" + e I think the control is not coming to python code. The output of the above is ..(In main

Re: Help me in this please--is Python the answer?

2006-01-12 Thread Tim N. van der Leeuw
Hi Ray, I'm in a bit of the same boat as you only I don't get to choose my implementation language ;-) Some of the concerns should be: - Do you have to interface with things like messaging-systems (a la JMS specs), distributed transaction managers? If so, the only way to go Python is Jython: Pyth

Re: flatten a level one list

2006-01-12 Thread bearophileHUGS
Well, maybe it's time to add a n-levels flatten() function to the language (or to add it to itertools). Python is open source, but I am not able to modify its C sources yet... Maybe Raymond Hettinger can find some time to do it for Py 2.5. Bye, bearophile -- http://mail.python.org/mailman/listin

Re: Can dictionaries be nested?

2006-01-12 Thread Paul McGuire
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm parsing some data of the form: > > OuterName1 InnerName1=5,InnerName2=7,InnerName3=34; > OuterName2 InnerNameX=43,InnerNameY=67,InnerName3=21; > OuterName3 > and so on > I wrote pyparsing for just this kind of job. Using

Hiding input charachters

2006-01-12 Thread Robert Hilkene
Hi there Can any body help, I wanna to hide input characters from user (when he enters password)? I found that for Macintosh you implement 4.12 quietconsole -- non-visible stdout output Can I do it with Windows? -- * Robert Hilkene DMS Gro

How to hide output characters on Windows

2006-01-12 Thread Robert Hilkene
Hi there I want to hide output characters in my py program. I found that for Macintosh you implement 4.12 quietconsole -- non-visible stdout output (http://www.python.org/doc/2.0.1/mac/module-quietconsole.html) Can you help me, how I can hide output characters on Windows? Best Regards -- ***

Re: Help me in this please--is Python the answer?

2006-01-12 Thread Ed Singleton
On 11 Jan 2006 17:54:05 -0800, Ray <[EMAIL PROTECTED]> wrote: > Hello, > > I've got the chance to determine the technology to use in creating a > product similar to this: > > http://www.atomicisland.com/ > > Now the thing is that I need to sell this to the guy with the money. > I've developed for y

ANN: (slightly) extended Python debugger

2006-01-12 Thread R. Bernstein
I've put out the first release of an expanded version of the Python debugger. For now it is under the bashdb project on sourceforge: http://sourceforge.net/project/showfiles.php?group_id=61395 I've tried this only on 3 machines and each had a different version of Python: OSX using python versio

Re: Why keep identity-based equality comparison?

2006-01-12 Thread Antoon Pardon
Op 2006-01-12, Paul Rubin schreef : > Antoon Pardon <[EMAIL PROTECTED]> writes: >> There is a use case for things like 1 < (1,3) making sense and denoting >> a total order. When you have a hetergenous list, having a total order >> makes it possible to sort the list which will make it easier to >> w

Parse date

2006-01-12 Thread Jacob Friis Saxberg
Hi.How do I parse a date like "2006-01-12T09:05:08+02:00"?I'd like to parse it into the local time for my server.Thanks.Jacob -- http://mail.python.org/mailman/listinfo/python-list

Re: pdb.py - why is this debugger different from all other debuggers?

2006-01-12 Thread R. Bernstein
Tino Lange <[EMAIL PROTECTED]> writes: > R. Bernstein wrote: > To summarize, I think most of us readers here like your changes or at least > didn't shout loud enough against it ;-) Okay. I'll gladly accept whatever positive interpretation someone wants to offer. :-) > As I also would like to hav

Re: Hiding input charachters

2006-01-12 Thread Paul Rubin
Robert Hilkene <[EMAIL PROTECTED]> writes: > Can any body help, I wanna to hide input characters from user (when he > enters password)? http://docs.python.org/lib/module-getpass.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Why keep identity-based equality comparison?

2006-01-12 Thread Paul Rubin
Antoon Pardon <[EMAIL PROTECTED]> writes: > The bisect module doesn't have an alternate comparison function > neither has the heapqueue module. They could be extended. Care to enter a feature request? > 1) Python could provide a seperare total ordering, maybe with operators >like '<|' and '|

Re: How can I create a dict that sets a flag if it's been modified

2006-01-12 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > It's important that I can read the contents of the dict without > flagging it as modified, but I want it to set the flag the moment I add > a new element or alter an existing one (the values in the dict are > mutable), this is what makes it difficult. Because the values

Re: creating dictionarie names, using variables?

2006-01-12 Thread Dan Sommers
On Wed, 11 Jan 2006 18:00:53 -0700, "Livin" <[EMAIL PROTECTED]> wrote: > Are you saying that each child dictionary actually has its own 'key', > not just the items within it? I don't quite understand "its own 'key'." There is a main dictionary. The keys come from replacing spaces with plusses i

setup.py vs autoconf install/uninstall,

2006-01-12 Thread R. Bernstein
In making a release of the recent changes to pdb.py announce here: http://groups.google.com/group/comp.lang.python/browse_thread/thread/b4cb720ed359a733/fbd9f8fef9693e58#fbd9f8fef9693e58 I tried using setup.py. I think it's great that setup.py tries to obviate the need for "Make" by just doing ev

Re: flatten a level one list

2006-01-12 Thread Raymond Hettinger
[Robin Becker] > Is there some smart/fast way to flatten a level one list using the > latest iterator/generator idioms. > > The problem arises in coneverting lists of (x,y) coordinates into a > single list of coordinates eg > > f([(x0,y0),(x1,y1),]) --> [x0,y0,x1,y1,] Here's one way: >>>

Re: How can I create a dict that sets a flag if it's been modified

2006-01-12 Thread Dan Sommers
On Thu, 12 Jan 2006 03:42:21 -0600, Brian van den Broek <[EMAIL PROTECTED]> wrote: > It's broken in at least one way: newmd = ModFlagDict(3=4, 1=5) > SyntaxError: keyword can't be an expression > So, as it stands, no integers, floats, tuples, etc can be keys on > initialization ... T

Re: How can I create a dict that sets a flag if it's been modified

2006-01-12 Thread Paul Rubin
Brian van den Broek <[EMAIL PROTECTED]> writes: > It's broken in at least one way: > > >>> newmd = ModFlagDict(3=4, 1=5) > SyntaxError: keyword can't be an expression newmd = ModFlagDict(**{3:4, 1:5}) -- http://mail.python.org/mailman/listinfo/python-list

python create mail

2006-01-12 Thread anyab5
hey I need help in sending email, It seems that while using this set of commands from smtplib import SMTP s = SMTP() s.set_debuglevel(1) s.connect('outmail.huji.ac.il') I should be able to get a connection but what I get is this error T:\Anya\work>mail1.py connect: ('outmail.huji.ac.il', 2

Re: python create mail

2006-01-12 Thread Tim Williams (gmail)
On 12 Jan 2006 04:28:44 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: hey I need help in sending email,It seems that while using  this set of commands from smtplib import SMTP s = SMTP() s.set_debuglevel(1) s.connect('outmail.huji.ac.il')I should be able to get a connection but what I get is

Re: flatten a level one list

2006-01-12 Thread Sion Arrowsmith
In article <[EMAIL PROTECTED]>, Paul Rubin wrote: >Robin Becker <[EMAIL PROTECTED]> writes: >> >reduce(operator.add,a) >> ... >That's what I hoped "sum" would do, but instead it barfs with a type >error. So much for duck typing. sum(...) sum(sequence, start=0)

Re: flatten a level one list

2006-01-12 Thread Paul Rubin
Sion Arrowsmith <[EMAIL PROTECTED]> writes: > sum(sequence, start=0) -> value > > If you're using sum() as a 1-level flatten you need to give it > start=[]. Oh, right, I should have remembered that. Thanks. Figuring out whether it's quadratic or linear would still take an experiment or code

Re: Help me in this please--is Python the answer?

2006-01-12 Thread Ray
Hi Ed, Ed Singleton wrote: > Personally I have found that if you need to sell a technology on, > saying it's written in Java is an advantage generally (because "it's a > standard"). If it's written in Python you may get asked why it has > been written in a "scripting language" if they've heard of

Re: python-soappy

2006-01-12 Thread m.banaouas
Mikalai a écrit : >> While talking about SOAPpy module, I'm facing an authentication problem >> with it: >> >> I'm consuming a WebServices server requiring authentication, and I did >> not found yet how to give authentication code (username:password) while >> calling any mehode of the webservice. >

Re: python create mail

2006-01-12 Thread Peter Hansen
[EMAIL PROTECTED] wrote: > hey I need help in sending email, > > It seems that while using this set of commands > > from smtplib import SMTP > > s = SMTP() > s.set_debuglevel(1) > s.connect('outmail.huji.ac.il') > > I should be able to get a connection but what I get is this error [snip] T

Re: flatten a level one list

2006-01-12 Thread Robin Becker
Peter Otten wrote: > Tim Hochberg wrote: > > >>Here's one more that's quite fast using Psyco, but only average without >>it. > > > >>def flatten6(): >> n = min(len(xdata), len(ydata)) >> result = [None] * (2*n) >> for i in xrange(n): >> result[2*i] = xdata[i] >>

jython base64.urlsafe_b64xxx

2006-01-12 Thread py
anyone know how to do perform the equivalent base64.urlsafe_b64encode and base64.urlsafe_b64decode functions that Python has but in jython? Jython comes with a base64 module but it does not have the urlsafe functions. Tried copying the pythhon base64.py to replace the Jython one, and although it d

Re: Help me in this please--is Python the answer?

2006-01-12 Thread Ray
Tim N. van der Leeuw wrote: > Hi Ray, Hi Tim! > I'm in a bit of the same boat as you only I don't get to choose my > implementation language ;-) > > Some of the concerns should be: > - Do you have to interface with things like messaging-systems (a la JMS > specs), distributed transaction manager

Re: Python on WinXP Embedded

2006-01-12 Thread [EMAIL PROTECTED]
Godzilla wrote: > Hello rtilley, > > thanks for replying so soon. I wish to install WinXP Embedded on a > PC/104 module and install Python on WinXP Embedded, not WinPE... The > hardware which is to be acquired is about a celeron 400MHz but we just > not sure how well Python will work under WinXPE..

help on eval()-like but return module object

2006-01-12 Thread Dody Suria Wijaya
As I'm adding XMLRPC support in my apps, I'd like to send a module in server to be executed in client. My plan in sending the file content via xmlrpc, and doing compile + eval, but eval just execute the code object without returning the module. Original: import mymodule mymodule.run(request)

Re: flatten a level one list

2006-01-12 Thread David Murmann
Robin Becker schrieb: > # New attempts: > from itertools import imap > def flatten4(x, y): > '''D Murman''' > l = [] > list(imap(l.extend, izip(x, y))) > return l > > > from Tkinter import _flatten > def flatten5(x, y): > '''D Murman''' > return list(_flatten(zip(x, y)))

Re: How can I create a dict that sets a flag if it's been modified

2006-01-12 Thread Steve Holden
Paul Rubin wrote: > [EMAIL PROTECTED] writes: > >>Still, I'd love to hear how you guys would do it. > > > Make a subclass of dict, or an object containing a dictionary, that > has a special __setattr__ method that traps updates and sets that /__setattr__/__setitem__/ ? regards Steve -- Stev

Can't compile

2006-01-12 Thread Layne Meier
I am having a problem trying to get Python 2.4.2 to compile on my Sun Solaris 10 system. I've even tried adding CC=gcc to the configure file or even tried running the command ./configure --with-gcc This is what is happening: MAILBOT:root:8:Python-2.4.2:# ./configure checking MACHDEP... sunos5

Re: How can I create a dict that sets a flag if it's been modified

2006-01-12 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > > Make a subclass of dict, or an object containing a dictionary, that > > has a special __setattr__ method that traps updates and sets that > > /__setattr__/__setitem__/ ? Yes, thinkographical error. Thanks. -- http://mail.python.org/mailman/listinfo/p

Re: Timeout at command prompt

2006-01-12 Thread Thierry Lam
Which Python version are you using? I'm getting the following error with Python 2.3.4: Traceback (most recent call last): File "C:\home\pciroot\vcur\sdk\tools\inter.py", line 32, in ? signal.signal(signal.SIGALRM, input) AttributeError: 'module' object has no attribute 'SIGALRM' Thierry -

Re: Timeout at command prompt

2006-01-12 Thread Thierry Lam
Is there a windows equivalent for that solution? -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Python training, 2006 Feb 1-3, San Francisco

2006-01-12 Thread jim
On Wed, 11 Jan 2006, w chun wrote: ... > as promised, this is the FINAL reminder i'll send out about our > upcoming Python course at the beginning of February. Is it too much to ask that you refrain altogether from using these lists for advertising, with the possible exception of the local one?

Extending & Embedding Python

2006-01-12 Thread Marco Meoni
Hi all! I've a problem with a C++ class that has to be included in a python application. One way to do it is Extending and Embedding the Python Interpreter Now i have 2 questions 1) Is there a one-file version of this tutorial? 2) Is there anyone that can help me with this problem? The class is att

Re: Extending & Embedding Python

2006-01-12 Thread David Murmann
Marco Meoni schrieb: > Hi all! I've a problem with a C++ class that has to be included in a > python application. One way to do it is Extending and Embedding the > Python Interpreter > Now i have 2 questions > 1) Is there a one-file version of this tutorial? i'm not sure what tutorial you mean. ar

Re: Extending & Embedding Python

2006-01-12 Thread Marco Meoni
> i'm not sure what tutorial you mean. are you talking about the > Extending and Embedding section of the python manual? > > http://docs.python.org/ext/ext.html Yes, this section. Is there in one-file version? (pdf, ps, dvi, all in 1 html, etc...) -- http://mail.python.org/mailman/listinfo/pyth

Re: batch tiff to jpeg conversion script

2006-01-12 Thread [EMAIL PROTECTED]
Just curious... is PhotoShop _really_ recursive? We have dozens of levels of sub-folders where the pics have been sorted and thousands of pics. That's one reason I used os.walk() -- http://mail.python.org/mailman/listinfo/python-list

Re: how to improve this simple block of code

2006-01-12 Thread Tim Williams (gmail)
On 11/01/06, Mike Meyer <[EMAIL PROTECTED]> wrote: "py" <[EMAIL PROTECTED]> writes:> Say I have...> x = "132.00"> but I'd like to display it to be "132" ...dropping the trailing > zeros...I currently try this Is it likely that  x might not have any decimal places?    If so all the above solutions f

Embedding Python: Creating Python Class from Application

2006-01-12 Thread Kakacek
Hello All, Let's say I have a following python code: class hw_class: def __init__(self): pass def hello_world(self): print 'Hello World!' create_instance('hw_class', 'hw') hw.hello_world() hw = None The 'create_instance' function should be implemented in the application (powe

Re: Why keep identity-based equality comparison?

2006-01-12 Thread Antoon Pardon
Op 2006-01-12, Paul Rubin schreef : > Antoon Pardon <[EMAIL PROTECTED]> writes: >> The bisect module doesn't have an alternate comparison function >> neither has the heapqueue module. > > They could be extended. Care to enter a feature request? Not really because IMO this is the wrong approach.

ajax python module??

2006-01-12 Thread Mark Engstrom
Does anyone have a recommendation on the best AJAX python module? Thanks, Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading from input file.

2006-01-12 Thread Mike Meyer
"Sheldon" <[EMAIL PROTECTED]> writes: > after you have read the file then split it like this: > file = open('inputfile.txt', 'r').read() > import string > file = string.split(file,'\n') You're doing things the hard way - at least if you have a modern Python. The above can be done as: file = open(

Re: Extending & Embedding Python

2006-01-12 Thread Marco Meoni
About SWIG: This program has a lot of commands... In your opinion what is the best settings for my use? Thanks... Marco -- http://mail.python.org/mailman/listinfo/python-list

Re: ajax python module??

2006-01-12 Thread ookoi
Hi Mark, Basically, all you needs is the CGI module to handle requests from clients, print some xml or html in response, then handle them back in your client code (javascript). With these simple principles I made a small web apps to watch Apache Logs, see: https://live.dbzteam.com/ If you want t

RE: Timeout at command prompt

2006-01-12 Thread Tim Golden
[Thierry Lam] [to do with a Win32 equivalent to the SIGALRM interruption of a raw_input] | Is there a windows equivalent for that solution? Nothing so straightforward. Depends how hard you want to try. A couple of past threads on pretty much the exact same issue offer no equivalent solution.

Re: Timeout at command prompt

2006-01-12 Thread Amit Khemka
its "Python 2.4.1" .. on linux On 12 Jan 2006 06:34:08 -0800, Thierry Lam <[EMAIL PROTECTED]> wrote: > Is there a windows equivalent for that solution? > > -- > http://mail.python.org/mailman/listinfo/python-list > -- Endless the world's turn, endless the sun's spinning Endless the quest; I

Re: Spelling mistakes!

2006-01-12 Thread skip
Antoon> But now we are back to my first doubt. Sure unit test will be Antoon> helpfull in finding out there is a bug. I doubt they are that Antoon> helpfull in tracking the bug (at least this kind). This thread seems to be going in circles. Maybe it's time to simply drop it and move

Re: Indentation/whitespace

2006-01-12 Thread Dave Hansen
On Thu, 12 Jan 2006 11:56:05 +0800 in comp.lang.python, Jon Perez <[EMAIL PROTECTED]> wrote: [...] > >Although the below does work, I believe: Verified example: >>> def check_indent(n): if n==4: print "You like four spaces" elif n==3: print "I like three"

Re: flatten a level one list

2006-01-12 Thread Nick Craig-Wood
Sion Arrowsmith <[EMAIL PROTECTED]> wrote: > sum(...) > sum(sequence, start=0) -> value > > If you're using sum() as a 1-level flatten you need to give it > start=[]. Except if you are trying to sum arrays of strings... >>> sum(["a","b","c"], "") Traceback (most recent call last):

Template language with XPath support for source code generation?

2006-01-12 Thread Stefan Behnel
Hi! I need to generate source code (mainly Java) from a domain specific XML language, preferably from within a Python environment (since that's where the XML is generated). I tried using XSLT, but I found that I need a template system that supports Python interaction. I know, lxml's XSLT support

Re: Why keep identity-based equality comparison?

2006-01-12 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: > Op 2006-01-11, Mike Meyer schreef <[EMAIL PROTECTED]>: >> Antoon Pardon <[EMAIL PROTECTED]> writes: >>> Op 2006-01-11, Mike Meyer schreef <[EMAIL PROTECTED]>: Antoon Pardon <[EMAIL PROTECTED]> writes: > Op 2006-01-10, Mike Meyer schreef <[EMAIL P

Asking for help effectively

2006-01-12 Thread skip
Manish> It does not work. I had already tried this earlier. Manish> Please suggest some other solutions. Manish> Also, I would like to see the stack from where the exception Manish> started. Manish, You made it extremely difficult for anyone to respond intelligently to your messa

Re: Failing unittest Test cases

2006-01-12 Thread Scott David Daniels
Duncan Booth wrote: > ... Possible enhancements: > add another argument for associated issue tracker id ... some unbroken tests > will also have associated issues this might just be a separate decorator. This is probably easier to do as a separate decoration which would have to precede the "fai

Re: Timeout at command prompt

2006-01-12 Thread Amit Khemka
I tried it on "Python 2.4.1" on '2.6.11-1.1369_FC4smp with gcc version 4.0.0' .. which works fine .. may be it could be an issue with some other combinations .. cheers, amit On 12 Jan 2006 07:35:57 -0800, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > Amit Khemka <[EMAIL PROTECTED]> writes:

Re: Timeout at command prompt

2006-01-12 Thread Paul Rubin
Amit Khemka <[EMAIL PROTECTED]> writes: > import signal > TIMEOUT = 5 # number of seconds your want for timeout > signal.signal(signal.SIGALRM, input) > signal.alarm(TIMEOUT) > > def input(): > try: >foo = raw_input() >return foo > except: > # timeout > return This doesn't work with

Re: Template language with XPath support for source code generation?

2006-01-12 Thread bruno at modulix
Stefan Behnel wrote: > Hi! > > I need to generate source code (mainly Java) from a domain specific XML > language, preferably from within a Python environment (since that's where the > XML is generated). > > I tried using XSLT, but I found that I need a template system that supports > Python inte

Re: exec a string in an embedded environment

2006-01-12 Thread Greg Copeland
I would be happy to share my point with you. In fact, I'm fixing a minor memory leak (socket module; vxWorks specific) in Python 2.3.4 (ported version) today. My port is actually on BE XScale. Email me at g t copeland2002@@ya hoo...com and I'll be happy to talk more with you. -- http://mail.py

Re: ajax python module??

2006-01-12 Thread Diez B. Roggisch
Mark Engstrom wrote: > Does anyone have a recommendation on the best AJAX python module? If it is the best is obviously an arguable assertion - but I very much like MochiKit from Bob Ippolito. http://www.mochikit.org/ Enyoy! Regards, Diez -- http://mail.python.org/mailman/listinfo/python-lis

Re: - E04 - Leadership! Google, Guido van Rossum, PSF

2006-01-12 Thread Dave Hansen
On 11 Jan 2006 21:30:11 -0800 in comp.lang.python, [EMAIL PROTECTED] (Aahz) wrote: [..] > >Side note: I don't have a degree, and I interviewed at Google several >years ago. I'm about 97% certain that my lack of degree played little >role (if any) in my failure to get a job offer. Side note: I ha

Re: Help me in this please--is Python the answer?

2006-01-12 Thread bruno at modulix
Ray wrote: (snip) > But then on the other hand, there is a manpower problem--it's damn easy > to find a Java programmer (although the quality that you get is a > different matter). Python programmers are more difficult. Possibly - but if a programmer is not able to pick on Python in a matter of d

Re: Timeout at command prompt

2006-01-12 Thread Amit Khemka
Another thing that can be tried is: import threading a="" def input(): global a a = raw_input() T = threading.Thread(target=input) T.start() T.join(2) ## does the trick ... I have not tested it but i guess should work. cheers, amit. On 1/12/06, Amit Khemka <[EMAIL PROTECTED]>

  1   2   3   >