Re: Newbie question

2007-08-19 Thread Michael Tobis
http://diveintopython.org/ mt -- http://mail.python.org/mailman/listinfo/python-list

Re: yet another indentation proposal

2007-08-20 Thread Michael Tobis
On Aug 19, 11:51 pm, James Stroud <[EMAIL PROTECTED]> wrote: > What's wrong with just saying the current indent level? I'd much rather > hear "indent 4" than "tab tab tab tab". Alternatively, you might also consider writing a simple pre and postprocessor so that you could read and write python th

Re: popen4 not returning output

2007-08-20 Thread Michael Bentley
;scp.stderr Both files will exist (the shell does this before starting the scp command), but will (I think) be empty. hope this helps, Michael --- The Rules of Optimization are simple. Rule 1: Don't do it. Rule 2 (for experts only): Don't do it yet. -Michael A. Jackson -- http://mail.python.org/mailman/listinfo/python-list

Re: Where we need to use Python ?

2007-08-20 Thread Michael Bentley
e: Oh, no problem, sweetheart, not with new Shimmer! [ Spokesman laughs continuously as he approaches the camera ] Spokesman: New Shimmer, for the greatest shine you ever tasted! Ducking, Michael --- "If we had asked people what they wanted they would have said 'a faster horse'." --Henry Ford -- http://mail.python.org/mailman/listinfo/python-list

Re: Python for web development ...

2007-08-22 Thread Michael S
Check out http://www.modpython.org/, you can also use python with CGI http://docs.python.org/lib/module-cgi.html or fastcgi http://www.fastcgi.com/ --- [EMAIL PROTECTED] wrote: > > Hi everyone, > > I have to do a web based application for my final > year project. Since, > i am only familiar wi

Problems Connecting to Crystal Reports table and changing field values

2007-08-23 Thread Michael Dorrian
Below is the my code so far. I have one table with 7 fields in my report and i want to clear these fields and then save the report as a different name and then print. The saving and printing part seem fine but i cannot seem to access the connection properties at all. I have the ConnectionPropertie

Re: Syslog

2007-08-23 Thread Michael Bentley
at='%(asctime)s %(levelname)-8s %(message)s', datefmt='%a, %d %b %Y %H:%M:%S', filename='/var/log/whatever.log', filemode='a') logging.info('random message') hth, Michael --- # Someth

Re: simple spider in python

2007-08-23 Thread Michael Bentley
t: Python- urllib/2.5': look into urllib2.build_opener()). Second thing to know is that the interesting results have class attribute set to "l". hope this helps, Michael --- Asking a person who he *is* ... is not Pythonic! --Anton Vredegoor -- http://mail.python.org/mailman/listinfo/python-list

Re: python setup.py: how to override a setup.cfg value ?

2007-08-24 Thread Michael Ströder
etup.cfg reflecting your OpenLDAP/OpenSSL/Cyrus-SASL/Kerberos installation. I don't know anything about "buildit" though. Ciao, Michael. -- http://mail.python.org/mailman/listinfo/python-list

wxpython on FreeBSD 6.2 broken

2007-08-26 Thread Michael S
e aware of this? Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: convert non-delimited to delimited

2007-08-27 Thread Michael Bentley
On Aug 27, 2007, at 10:59 AM, RyanL wrote: > I'm a newbie! I have a non-delimited data file that I'd like to > convert to delimited. > > Example... > Line in non-delimited file: > 01397256359210100534+42050-102800FM-15+1198KAIA > > Should be: > 0139,725635,9,2000,01,01,00,53,4,+42050

Re: how can I find out the process ids with a process name

2007-09-02 Thread Michael Bentley
ny things, including process name (the line that ends with the process name, begins with 'Name'). Here's a quick bashy way to get pid + process names: cd /proc for i in ls [0-9]*/status do echo $i `grep '^Name' $i | cut -f2` | sed 's/\/status//g' d

Re: how can I find out the process ids with a process name

2007-09-03 Thread Michael Bentley
> > cd /proc > for i in ls [0-9]*/status > do > echo $i `grep '^Name' $i | cut -f2` | sed 's/\/status//g' > done > Um... cd /proc for i in `ls [0-9]*/status` do echo $i `grep '^Name' $i | cut -f2` | sed 's/\/status//g' done --- Let the wookie win. -- http://mail.python.org/mailma

Re: FCGI app reloading on every request

2007-09-04 Thread Michael Ströder
ion files for each of the modules above for FastCGI over Unix Domain Socket( see directory /etc/httpd/, comments of sample-mod_fcgid.conf misleading). web2ldap can also be deployed as (multi-threaded) FastCGI-server. Ciao, Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: FCGI app reloading on every request

2007-09-05 Thread Michael Ströder
le gets executed as a CGI script, > and so does a ".fcgi" file. It's an Apache configuration problem. Are you sure that the server configuration allows overriding this in the .htaccess file? Ciao, Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: FCGI app reloading on every request

2007-09-05 Thread Michael Ströder
and enabled the standard > FCGI configuration, which is actually mod_fcgid. > [..] > What's wierd is that the ".fcgi" suffix files get executed at all. > I'd expect them to be either ignored or run properly with FCGI. Then I would ask APlus.net what's real

Re: Get Only the Last Items in a Traceback

2007-09-12 Thread Michael Ströder
deprecated variables.) ---- snip Ciao, Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: automatic parallelization

2007-09-13 Thread Michael Schlenker
of multiple processors, when possible. Its doable in principle, but as with OpenMP you need extra annotations to make it workable. If you have an event style script in Tcl you might be easier able to use threads, as the thread::send -async api fits very well with the event based style. Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: using python to query active directory

2007-03-07 Thread Michael Ströder
David Bear wrote: > Is it possible to use python to make calls agains microsoft active > directory? What do you mean with "calls agains microsoft active directory"? Querying user and computer entries etc.? python-ldap might be an option for you. Ciao, Michael. -- http://mail.py

Re: Flatten a two-level list --> one liner?

2007-03-07 Thread Michael Spencer
Sergio Correia wrote: > spam = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]] > > Into something like > eggs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] > > There are *no* special cases (no empty sub-lists). eggs = [i for j in spam for i in j] Michael -- http://mail.python.or

Re: merits of Lisp vs Python

2007-03-09 Thread Michael Bentley
On Mar 9, 2007, at 1:10 PM, Tim Bradshaw wrote: > On 2007-03-09 07:00:06 +, [EMAIL PROTECTED] (Alex Martelli) said: > >> (nee "One Laptop Per Child", OLPC, and once known as the "$100 >> laptop") >> uses Python as its preferred (only?-) application language, and it's >> slated to be the most

Re: Database module & multithreading

2007-03-10 Thread Michael Bentley
> > Thanx for this pointer buddy! I have done my homework. Some Database > modules are not actively maintained some modules does not work with > Python 2.5. At this moment I am using Sqlite3 which is pretty fast but > it dosent allow me to use multi threading so which database module is > better i

Re: [python-advocacy] A Pythonic Way to Measure and Improve Your Programming Skills?

2007-03-10 Thread Michael Bernstein
On Sat, 2007-03-10 at 10:01 -0600, Brad Allen wrote: > When I discussed this problem with Michael Bernstein at PyCon he suggested > the idea of creating a "chroot jail" for each web session which could run > the Python interpreter in a secure sandbox. That might be easier

Re: Signed zeros: is this a bug?

2007-03-11 Thread Michael Spencer
rownspencer.com/pycompiler/branches/new_ast/ Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: using python to visit web sites and print the web sites image to files

2007-03-12 Thread Michael Bentley
> > I wonder whether python can be used to simulate a real user to do the > following: > 1) open a web site in a browser; > 2) printscreen, so to copy the current active window image to > clipboard; > 3) save the image file to a real file > > Any pointer will be apprieciated! Which OS? -- http

Re: Twelve Proofs that Muhammad is a True Prophet

2007-03-13 Thread Michael Bentley
ng string containing linefeeds by triple-quotes. It won't be of much use unless you assign it to a variable or something -- but at least your interpreter will stop complaining. hope this helps, Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: To count number of quadruplets with sum = 0

2007-03-15 Thread Michael Spencer
for b in B: if a+b in dct: dct[a+b] += 1 else: dct[a+b] = 1 for c in C: for d in D: if -c-d in dct: s+= dct[-c-d] return s if __name__ == '__main__': import sys print sumfour(sys.stdin.read()) Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: How to calculate a file of equations in python

2007-03-19 Thread Michael Bentley
On Mar 19, 2007, at 11:48 PM, John wrote: > Hi, > I have a text file which contains math expression, like this > 134 > +234 > +234 > > (i.e. an operation (e.g. '+) and then a number and then a new line). > > Can you please tell me what is the easiest way to calculate that file? > for example the

Re: Mastering Python

2007-03-22 Thread Michael Bentley
>> > For future reference, and I hope you don't mind the lesson, the past > tense of "bind" is "bound" (I can't state it as a firm rule, but many > *ind words seem to go *ound: bind, find, wind [as in wrap, not blowing > in the...], grind -> bound, found, wound [not to confuse with an > injur

Re: My MVC critique

2007-03-22 Thread Michael Bentley
On Mar 22, 2007, at 9:29 AM, [EMAIL PROTECTED] wrote: > mickey mouse Well, at least you spelled Mickey Mouse right... :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Been a while...

2007-03-22 Thread Michael Bentley
On Mar 22, 2007, at 10:34 AM, John Salerno wrote: > Hi guys. It's been a while since I've used Python, so I got a little > rusty, but I really want to start using it again, just out of habit > and > for fun. Can anyone suggest a book or a website with little projects I > could work on to keep m

Re: Problem with time

2007-03-22 Thread Michael Bentley
> > 1) i got 2 values from mysql db (fields are "time" type) > 2) python get it as "" (why timedelta???) > 3) i need to compare 2 fields with actual time ... EG: > if ArrOutputsAuto[i].TimeFrom >= GNow and ArrOutputsAuto[i].TimeTo > <= GNow: > > i need actual time, and 2 fields from DB in datetim

Re: [JOB] Sr. Python Developer, Northern VA

2007-03-22 Thread Michael Bentley
On Mar 22, 2007, at 12:07 PM, Anton Vredegoor wrote: > Agreed. There's now probably even room on the job market for those who > don't belong to the select elite of early adopters. We might even root > out the professionalist attitude and address the problem of tying > people > to their resumes.

Re: [JOB] Sr. Python Developer, Northern VA

2007-03-22 Thread Michael Bentley
al with people who think they can judge my ability to accomplish a goal by asking "how much X do you have?" (where X is some skill, language, toolkit, whatever) That "how much X do you have" question always made me grit my teeth. obtw, thanks for my new signature :-

Re: challenge ?

2007-03-22 Thread Michael Spencer
rate(sorted((v, k) for k, v in d.items( {'a': (10, 2), 'c': (8, 1), 'b': (5, 0), 'd': (12, 3)} >>> # sort by value, then by key since (v,k) must be unique Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: how can I invoke a Java code?

2007-03-22 Thread Michael Ekstrand
d speediness choice the better. thanks. If you want to run the Java program as a separate process, you can run "java -jar TheProgram.jar". If you're wanting to interact with the code, your best option may be Jython, an implementation of Python in Java. - Michael -- http://mail.python.

Re: execution speed increase after compile py code into exe?

2007-03-24 Thread Michael Bentley
d it, mind you). regards, Michael --- Our network was brought down by a biscuit??? --Steven D'Aprano -- http://mail.python.org/mailman/listinfo/python-list

Re: execution speed increase after compile py code into exe?

2007-03-24 Thread Michael Bentley
> > Actualy startup is faster for the apps that I have py2exe'd. I think > this may be because all the modules are in one place and Python > doesn't > have to go searching for them. Thanks, Will! That's good to know. -- http://mail.python.org/mailman/listinfo/python-list

Re: Removing Python 2.4.4 on OSX

2007-03-24 Thread Michael Bentley
contains /usr/local/bin -- otherwise, you'll probably keep picking up the default 2.3.5 in /usr/bin. It looks like Stackless has a Mac binary install as well. Does anybody here know if I can install that on top of a stock 2.5 without breaking things? regards, Michael --- Simplicity

Re: Removing Python 2.4.4 on OSX

2007-03-24 Thread Michael Bentley
ules for 2.5 at the MacPython site. That's not to say you can't easily build your own, mind you -- assuming you've got developer tools installed. regards, Michael --- A clever person solves a problem. A wise person avoids it.

Re: Removing Python 2.4.4 on OSX

2007-03-24 Thread Michael Bentley
> No, the OSX version is like 2.3 something. I installed the 2.4.4 > version in /usr/local bypassing the Apple stuff. Oh! Well then: ---[cut here]--- # danger will robinson -- use at your own risk ;-) rm /usr/local/bin/python* rm -rf /usr/local/lib/python ---[snip]--- Is the uninstall program :

Re: Removing Python 2.4.4 on OSX

2007-03-24 Thread Michael Bentley
> > /Libary/Frameworks/ is an empty directory(except for . and ..) on my > Mac, and I have 2.3.5 installed somewhere. Ye sorry 'bout that... Apple's default install is under /System/ Library... Framework builds from python.org get installed under / Library -- http://mail.python.org/mailman/

Re: Join strings - very simple Q.

2007-03-24 Thread Michael Bentley
On Mar 25, 2007, at 6:33 AM, Dennis Lee Bieber wrote: > On Sat, 24 Mar 2007 10:53:20 +0200, "Hendrik van Rooyen" > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > >> >> What happened in 1850 to make it the demarcation line? >> > Well... The Modified Julian Date zero is 17

Re: How to find to HTML strings and 'save' them?

2007-03-25 Thread Michael Bentley
On Mar 25, 2007, at 12:04 PM, [EMAIL PROTECTED] wrote: > don't even get me > started on python docs.. ayaa ;] ok, try getting started with this then: http://www.crummy.com/ software/BeautifulSoup/ -- http://mail.python.org/mailman/listinfo/python-list

EuroPython 2007: Call for Proposals

2007-03-25 Thread Michael Hudson
Book Monday 9th July to Wednesday 11th July 2007 in your calendar! EuroPython 2007, the European Python and Zope Conference, will be held in Vilnius, Lithuania. Last year's conference was a great success, featuring a variety of tracks, amazing lightning talks and inspiring keynotes. With your par

Re: Sending ECHO_REQUEST (pinging) with python

2007-03-26 Thread Michael Bentley
D = os.getpid() & 0xFFFF sendOnePing(mySocket, destAddr, myID) delay = receiveOnePing(mySocket, myID, timeout) mySocket.close() return delay def ping(host, timeout=1): dest = socket.gethostbyname(host) delay = doOne(dest, timeout) return delay Hope this helps, Michael --- The Rules of Optimization are simple. Rule 1: Don't do it. Rule 2 (for experts only): Don't do it yet. -- Michael A. Jackson , "Principles of Program Design", 1975. -- http://mail.python.org/mailman/listinfo/python-list

Re: Sending ECHO_REQUEST (pinging) with python

2007-03-26 Thread Michael Bentley
ing command is using btw, is probably running suid root. hth, Michael --- Simplicity is the ultimate sophistication. -Leonardo da Vinci -- http://mail.python.org/mailman/listinfo/python-list

Re: python on window

2007-03-26 Thread Michael Bentley
v): index[v].append(k) else: index[v] = [k] return index You had mentioned something about indentation error... If you'll look at your definition of invert(), you can see that 'return index' is inside the for lo

Re: enumerating processes

2007-03-26 Thread Michael Bentley
On Mar 27, 2007, at 1:07 AM, 李现民 wrote: > thanks for your help, but that is not what I am looking for. My > question is: I need to determine whether another process is running > now ---in my problem, that is 'tomcat5.exe' ---that determines what > should I do next. Maybe this can help: htt

Re: Fortran vs Python - Newbie Question

2007-03-28 Thread Michael Tobis
I feel obligated to fan the flames a bit by pointing to http://www.fortranstatement.com/ a site which advocates discontinuing development of Fortran and does a good job of summarizing the problems with the contemporary development of that language. I am not convinced that a new high performance la

Re: manually implementing staticmethod()?

2007-03-28 Thread Michael Spencer
"7stud" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > Can someone show me how to manually implement staticmethod()? Here is > my latest attempt: > Raymond Hettinger can: http://users.rcn.com/python/download/Descriptor.htm#static-methods-and-class-methods

Re: Weird behavior in search in a list

2007-03-29 Thread Michael Bentley
han num return min([x for x in extend if x > num]) else: return None Hope this helps, Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: Inserting '-' character in front of all numbers in a string

2007-03-30 Thread Michael Bentley
On Mar 30, 2007, at 10:38 AM, kevinliu23 wrote: > I want to be able to insert a '-' character in front of all numeric > values in a string. I want to insert the '-' character to use in > conjunction with the getopt.getopt() function. > > Rigt now, I'm implementing a menu system where users will b

Re: New to Python - Easy way to open a text file

2007-03-30 Thread Michael Tobis
I think it's pretty clear that we aren't understanding what you mean by "open a text file and disply its content". I conclude that by "edna" you mean this thing: http://edna.sourceforge.net/ I suspect you are not asking a Python question at all. Did you try opening file:edna-0.6/templates/d

Re: Inserting '-' character in front of all numbers in a string

2007-03-30 Thread Michael Bentley
On Mar 30, 2007, at 4:41 PM, Paul McGuire wrote: > On Mar 30, 2:09 pm, Michael Bentley <[EMAIL PROTECTED]> wrote: >> On Mar 30, 2007, at 10:38 AM, kevinliu23 wrote: >> >> >> >> >> >>> I want to be able to insert a '-' character in f

Re: Inserting '-' character in front of all numbers in a string

2007-03-30 Thread Michael Bentley
On Mar 30, 2007, at 5:42 PM, Michael Bentley wrote: > for i in yourstring.split(): > if i[0].isdigit(): > yourstring = yourstring.replace(i, '-%s' % (i,), 1) *OR* yourstring ' '.join(x[0].isdigit() and '-%s' % x or x for x i

Re: Shed Skin Python-to-C++ Compiler 0.0.21, Help needed

2007-03-31 Thread Michael Torrie
On Sun, 2007-04-01 at 02:49 +, Dennis Lee Bieber wrote: > Take that up with ACT... GNAT 3.15p was explicitly unencumbered, but > the current version of GNAT, in the GPL (no-service contract) form has > gone the other direction, claiming that executables must be released > GPL. The no-ser

Re: Shed Skin Python-to-C++ Compiler 0.0.21, Help needed

2007-03-31 Thread Michael Torrie
On Sat, 2007-03-31 at 20:47 -0700, Paul Rubin wrote: > Michael Torrie <[EMAIL PROTECTED]> writes: > > The no-service contract version of the GPL is not the same as the > > standard GPLv2. > > I don't see how that can be--we're talking about a GCC-based compil

Re: Shed Skin Python-to-C++ Compiler 0.0.21, Help needed

2007-03-31 Thread Michael Torrie
On Sat, 2007-03-31 at 20:47 -0700, Paul Rubin wrote: > Michael Torrie <[EMAIL PROTECTED]> writes: > > The no-service contract version of the GPL is not the same as the > > standard GPLv2. > > I don't see how that can be--we're talking about a GCC-based compil

Re: Generic logic/conditional class or library for classification of data

2007-04-01 Thread Michael Bentley
t; Perhaps this is more along the lines of data mining methods? > Is there a library with this sort of functionality out there already? > > Any help will be appreciated. You may be interested in http://divmod.org/trac/wiki/DivmodReverend -- it is a general purpose Bayesian classifier written in python. hope this helps, Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: Launch script on Linux using Putty

2007-04-01 Thread Michael Hoffman
o fork as a daemon. Google for ["python cookbook" fork daemon] to find a few recipes for this. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: capturing system exit status

2007-04-01 Thread Michael Hoffman
f you're using Python 2.5, you can use subprocess.check_call() which will raise CalledProcessError for nonzero exit code. If you're using Python 2.4, you can use retcode = subprocess.call() and check it yourself. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: can a method access/set another's variables?

2007-04-01 Thread Michael Hoffman
argument or use inspect to get the frame locals), but writing to this dictionary has undefined behavior. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Launch script on Linux using Putty

2007-04-02 Thread Michael Hoffman
[Michael Hoffman] >> 1. The easiest is to run nohup on your script in the background: >> >> $ nohup myscript.py > output.txt 2> error.txt & >> >> Then you can disconnect but your script will keep running. Try man nohup >> for more information. >&g

Re: Launch script on Linux using Putty

2007-04-02 Thread Michael Hoffman
[Michael Hoffman] >> If you are running bash, you can do this: [Grant Edwards] > He's not running bash. He's running busybox's shell. There's a nohup applet for busybox. > [He'd be far better off asking his question in an OpenWRT or > Busybox forum, sinc

Re: Clean "Durty" strings

2007-04-02 Thread Michael Hoffman
[EMAIL PROTECTED] wrote: > But it could be that he just wants all HTML tags to disappear, like in > his example. A code like this might be sufficient then: re.sub(r'<[^>] > +>', '', s). Won't work for, say, this: -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

File Object behavior

2007-04-03 Thread Michael Castleton
When I open a csv or txt file with: infile = open(sys.argv[1],'rb').readlines() or infile = open(sys.argv[1],'rb').read() and then look at the first few lines of the file there is a carriage return + line feed at the end of each line - \r\n This is fine and somewhat expected. My problem comes

Re: File Object behavior

2007-04-03 Thread Michael Castleton
Thank you to both Steve and 7stud. You were right on with binary flag! I thought I had tried everything... Mike -- View this message in context: http://www.nabble.com/File-Object-behavior-tf3520070.html#a9825806 Sent from the Python - python-list mailing list archive at Nabble.com. -- http://

Re: Problem with filter()

2007-04-03 Thread Michael Spencer
2-app-8.2.96.0-inst.tar.gz', 'rqp-win32-app-8.2.96.0-inst.tar.gz'] >>> >>> import fnmatch >>> fnmatch.filter(source, '*-win32-app-*-inst.tar.gz') ['rqp-win32-app-8.2.96.0-inst.tar.gz', 'rqp-win32-app-8.2.96.0-inst.tar.gz'] >>> Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: File Object behavior

2007-04-03 Thread Michael Castleton
Bruno Desthuilliers wrote: > > Michael Castleton a écrit : >> When I open a csv or txt file with: >> >> infile = open(sys.argv[1],'rb').readlines() >> or >> infile = open(sys.argv[1],'rb').read() >> >> and then l

Re: Prevent Modification of Script?

2007-04-04 Thread Michael Ekstrand
ant factor: are you worried about other users on your systems (or other users who share systems with you under a third party's control), or are you worried about what people will do on their own systems? - Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: Debugging multithreaded program using Eclipse/Pydev

2007-04-06 Thread Michael Bentley
#x27;m quite satisfied with it. hth, Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a simple function to generate a list like ['a', 'b', 'c', ... 'z']?

2007-04-09 Thread Michael Bentley
On Apr 9, 2007, at 3:29 AM, 人言落日是天涯,望极天涯不 见家 wrote: > Is there a simple function to generate a list like ['a', 'b', 'c', ... > 'z']? The range() just can generate the numeric list. import string list(string.lowercase) -- http://mail.python.org/mailman/listinfo/python-list

Breaking up Strings correctly:

2007-04-09 Thread Michael Yanowitz
ak it up from: (E1 AND_or_OR E2) and make that int [AND_or_OR, E1, E2] and apply the same to E1 and E2 recursively until E1[0] != '(' But the main problem I am running to is, how do I split this up by outer parentheseis. So that I get the proper '(' and ')' to split this upper correctly? Thanks in advance: Michael Yanowitz -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a simple function to generate a list like ['a', 'b', 'c', ... 'z']?

2007-04-09 Thread Michael Bentley
On Apr 9, 2007, at 6:30 AM, Duncan Booth wrote: Michael Bentley <[EMAIL PROTECTED]> wrote: On Apr 9, 2007, at 3:29 AM, 人言落日是天涯,望极天涯不 见家 wrote: Is there a simple function to generate a list like ['a', 'b', 'c', ... '

RE: Breaking up Strings correctly:

2007-04-10 Thread Michael Yanowitz
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Adam Atlas Sent: Monday, April 09, 2007 11:28 PM To: [email protected] Subject: Re: Breaking up Strings correctly: On Apr 9, 8:19 am, "Michael Yanowitz" <[EMAIL PROTECTED]> wrote: > H

Re: Pass A Var To a Python Script?

2007-04-11 Thread Michael Bentley
ur script, use sys.argv to gather the argument (hello_world). hth, Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: tuples, index method, Python's design

2007-04-11 Thread Michael Zawrotny
ildly in favor of index() and count() being added to tuples. Mike -- Michael Zawrotny Institute of Molecular Biophysics Florida State University| email: [EMAIL PROTECTED] Tallahassee, FL 32306-4380 | phone: (850) 644-0069 -- http://mail.python.org/mailman/listinfo/python-list

Re: reading from sys.stdin

2007-04-12 Thread Michael Bentley
On Apr 12, 2007, at 3:20 AM, 7stud wrote: > I can't break out of the for loop in this example: > > -- > import sys > > lst = [] > for line in sys.stdin: > lst.append(line) > break > > print lst > --- > > But, I can break out of the for loop when I do this: > > - > impo

Portably generating infinity and NaN

2007-04-12 Thread Michael Hoffman
using float(Decimal("nan")), but apparently Decimal.__float__(self) is float(str(self)), which isn't portable. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Portably generating infinity and NaN

2007-04-12 Thread Michael Hoffman
Michael Hoffman wrote: > 2. Using an extension module (for example, numarray.ieeespecial will do > it). I guess I could always use ctypes as well, and say, get -inf from libc.log(ctypes.c_double(0.0)). Although we're venturing away from portable territory then, since specifying

Re: VB6 To Python

2007-04-12 Thread Michael Bentley
On Apr 12, 2007, at 1:11 PM, Sampson, David wrote: Any experience or insight would be great. It has been my experience that when migrating to a dissimilar system, avoiding the rewrite is a mistake. And futile. hth, Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: reading from sys.stdin

2007-04-13 Thread Michael Hoffman
gt; and stop on blank line. So you need a wrapper > > Why a wrapper? Because without a wrapper you'll get EOFError, while the file iterator would ordinarily give you StopIteration. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Try problem

2007-04-13 Thread Michael Hoffman
end up getting the "Hello" printed on the screen as > logically i should a '0' printed? After the exception is raised, s is not an int. It is an exception object. You want s.message. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: reading from sys.stdin

2007-04-13 Thread Michael Bentley
On Apr 13, 2007, at 4:47 AM, 7stud wrote: > On Apr 13, 3:36 am, "7stud" <[EMAIL PROTECTED]> wrote: >> >>> It is if the file is smaller than the buffer size. >> >> How is that relevant? >> > > If I put 100 lines of text in a file with each line having 50 > characters, and I run this code: > > impo

Re: Arrays, Got Me Confused

2007-04-13 Thread Michael Bentley
On Apr 13, 2007, at 7:04 AM, Robert Rawlins - Think Blue wrote: #!/usr/bin/python # Filename: Firewall.py class Firewall: def __init__(self): Self.FireArray = array(c) p = Firewall() print p Throws: Traceback (most recent call last): File "./firewall.p

Re: reading from sys.stdin

2007-04-13 Thread Michael Hoffman
7stud wrote: > On Apr 13, 3:13 am, Michael Hoffman <[EMAIL PROTECTED]> wrote: >> 7stud wrote: >>> I assume all input is buffered by default, so I'm not sure how it >>> explains things to say that input from sys.stdin is buffered. >> The difference with s

Re: Problem with algorithm

2007-04-13 Thread Michael Hoffman
the CPython interpreter crashing, so it's not completely scalable. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with algorithm

2007-04-13 Thread Michael Bentley
On Apr 13, 2007, at 9:19 AM, Paul McGuire wrote: > If you just expand the length to five million* or so, one of those > strings will contain all the works of Shakespeare. Not likely, even with a tiny sampling of the works of Shakespeare: # :-) import string import random def main(bardText, ma

Re: Portably generating infinity and NaN

2007-04-13 Thread Michael Hoffman
be the > same all over, yes? If you're going to change CPython to do this, I think adopting PEP 754, and using the fpconst module would be better than changing how float() works when called on string literals. The only thing I don't like about it is the camelcasing of the functions. http://www.python.org/dev/peps/pep-0754/ -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Portably generating infinity and NaN

2007-04-13 Thread Michael Hoffman
Michael Hoffman wrote: > [EMAIL PROTECTED] wrote: >> >> (Note the absence of a demonstration on Windows.) Can't the >> above be >> >> blessed as the One True Way and wormed around in floatmodule.c for >> >> those platform

Re: Python editor/IDE on Linux?

2007-04-13 Thread Michael Hoffman
Jack wrote: > I wonder what everybody uses for Python editor/IDE on Linux? I'll let you in on a little secret. We all use Emacs. Those who claim to use vim are just trying to prevent you from ever becoming a successful Python programmer, and therefore reduce competition. -- Michael

Re: Python editor/IDE on Linux?

2007-04-13 Thread Michael Bentley
>> >> Everybody uses vim. >> > Except for real programmers... Who instead use emacs ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: how to strip the domain name in python?

2007-04-13 Thread Michael Bentley
On Apr 13, 2007, at 11:49 PM, [EMAIL PROTECTED] wrote: > Hi, > > I have a list of url names like this, and I am trying to strip out the > domain name using the following code: > > http://www.cnn.com > www.yahoo.com > http://www.ebay.co.uk > > pattern = re.compile("http:(.*)\.(.*)", re.S) > ma

Re: Append data to a list within a dict

2007-04-13 Thread Michael Bentley
;three' : ['threeone' , 'threetwo', threethree']} > > Now I want to append 'twofour' to the list of the 'two' key but I > can't > figure out how to that? > Some pointers would be greatly appreciated. ListDict['two'].append('twofour') But you'll have to insert the missing single quote before "threethree" first. hope this helps, Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: Append data to a list within a dict

2007-04-13 Thread Michael Bentley
On Apr 14, 2007, at 12:51 AM, Paul Rubin wrote: > Is this a class exercise? Hint: > 1) figure out how to access the list of the 'two' key > 2) append 'twofour' to it. damn. -- http://mail.python.org/mailman/listinfo/python-list

Re: Double backslash in filepaths ?

2007-04-14 Thread Michael Bentley
forward slashes and forget that double- backslash madness. But that's not really answering your question, is it? What you're looking for is called 'escape characters'. The single backslash combines with the 't' to become a TAB character. The double backslashes combine to become '\'. So: >>> print 'D:\\data_to_test\test_global.pd' D:\data_to_test est_global.pd hth, Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: OverflowError: mktime argument out of range ???

2007-04-15 Thread Michael Bentley
On Apr 15, 2007, at 5:41 AM, Jorgen Bodde wrote: > This is what I try: > time.mktime((1928, 12,28, 0, 0, 0, 0, 0, 0)) > Traceback (most recent call last): > File "", line 1, in > OverflowError: mktime argument out of range Probably depends on your system. It doesn't break for me: >>>

Re: optparse -- anyway to find if the user entered an option?

2007-04-15 Thread Michael Hoffman
t and since no user can >> ever >> enter a None value, I can be sure that the user didn't provide -i. >> I'm wondering if there is a cleaner approach -- something like >> parser.opt_seen("-i") >> >> Thanks, >> Karthik >> > > Using None wouldn't be a hack, it would rather be a common and > straightforward python idiom. I agree. Also, remember that in optparse the default default (if you will) is None. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Portably generating infinity and NaN

2007-04-15 Thread Michael Hoffman
[EMAIL PROTECTED] wrote: > Michael> If you're going to change CPython to do this, I think adopting > Michael> PEP 754, and using the fpconst module would be better than > Michael> changing how float() works when called on string literals. > > B

<    31   32   33   34   35   36   37   38   39   40   >