Re: how do I pass values between classes?

2006-11-06 Thread Larry Bates
kath wrote: > hi, Larry Bates thanks for the reply... > >> You might consider doing it the same way wx passes things around. >> When you instantiate the subclass pass the parent class' instance >> as first argument to __init__ method. > > Yes thats ab

Re: auto indent

2006-11-06 Thread Larry Bates
Its just like asking if you could have something automatically insert parenthesis everywhere they are needed. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: assigning values in __init__

2006-11-06 Thread Larry Bates
z=Character('name', strength=10, dexterity=5, intelligence=3, luck=0) Now you can easily introduce new keyword arguments. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Python deployment options.

2006-11-08 Thread Larry Bates
rm/thread/bcc... >> >> I doubt Microsoft will unleash their lawyers on you, but it is a >> problem. > py2exe and py2app work extremely well. I'm not sure why you wouldn't want to use them if you want to distribute to those platforms. Actually they take the installed version of python out of the equation (at least I know py2exe does). -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: help using smtplib to work ..

2006-11-08 Thread Larry Bates
d: (530, '5.7.0 Must issue a STARTTLS command first > s1sm7666914uge', '[EMAIL PROTECTED]') > > What am I doing wrong ? > Under outgoing mail smtp server, use smtp.gmail.com. Since it requires SMTP authorization, use your Gmail account as username (e.g. [EMAIL PRO

Re: Python v PHP: fair comparison?

2006-11-14 Thread Larry Bates
n't the case a couple of years ago). Hosting costs have dropped so much during that time that getting Python doesn't cost much (if any) extra. I'd be surprised if there was more demand for PHP developers than Python developers. Google lists 51 PHP jobs and 168 Python jobs in the

Re: How to make a python file to a DLL?

2006-11-16 Thread Larry Bates
many_years_after wrote: > Any solution? > > Thanks. > You can certainly make python program/function into a COM object which can be called from other languages quite easily and I think is the more preferred method in newer software. py2exe has examples of creating COM objects. -La

Re: Are ActivePython scripts compatible with Linux?

2006-05-31 Thread Larry Bates
s" in your code, put them in a function or class that can easily be rewritten for the specific OS you are porting to. Don't spread them out all through your code. It is much easier to rewrite a couple of functions/classes that are OS-specific than it is to try to find problems all over yo

Re: Help requested -- importing stuff from a .COM DLL into python

2006-05-31 Thread Larry Bates
es. Maybe you can call via COM, but I just haven't ever done that. You should be able to use ctypes to interface to them. The "tricky" part is passing data back and forth. Building the proper data structures in Python can take some work. You should take a look at ctypes from: http://sourceforge.net/project/showfiles.php?group_id=71702 COM sample is here: http://starship.python.net/crew/theller/ctypes/sum_sample.html HTH, Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to do data source abstraction

2006-06-01 Thread Larry Bates
nt "Name", obj.name print "Address1", obj.address1 print "Address2", obj.address2 print "City", obj.city print "State...", obj.state print "Zip.", obj.zip -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Open Source Charting Tool

2006-06-02 Thread Larry Bates
ReportLab Graphics can do 2D and pie charts, but I don't think it does 3D charts yet. www.reporlab.org Larry Bates A.M wrote: > Hi, > > > > I developed a HTML reporting tool that renders Oracle data to HTML and > Oracle. > > > > At this point I have to

Re: Open Source Charting Tool

2006-06-02 Thread Larry Bates
Ouch. I had a typo. -Larry Scott David Daniels wrote: > Felipe Almeida Lessa wrote: >> Em Sex, 2006-06-02 às 16:56 -0400, A.M escreveu: >>> I can't browse to www.reporlab.org, but I found >>> http://www.reportlab.com/ which has a commercial charting product. &

Re: Instead of saving text files i need as html

2006-06-08 Thread Larry Bates
Then just write HTML around your list. I would guess you want them inside a table. Just write appropriate HTML tags before/after the urls. If you want the URLs to be clickable make them in into url lines. -Larry Bates Shani wrote: > I have the following code which takes a list of urls >

Re: cos: "Integer Required"?!?!?!?

2006-06-08 Thread Larry Bates
First: Always post cut-paste tracebacks so we can see actual error message. Second: print out self.ACphi, XPLMGetDataf(self.ACphi) and math.radians(XPLMGetDataf(self.ACphi)) before this statement and you will find the problem. -Larry Bates moonman wrote: > Hello all, > > I've ju

Re: Python or Ajax?

2006-06-09 Thread Larry Bates
verts client portions to Javascript (if I'm understanding how it works). -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: First question on extending Python...

2006-06-09 Thread Larry Bates
asses that help with the C structures that need to be passed back and forth. For that you will probably also need to take a look at the Python struct module, but ctypes has some built-in helper functions also. ctypes can be located here: http://starship.python.net/crew/theller/ctypes/ -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: "parent" in a class __init__ def?

2006-06-10 Thread Larry Bates
ts deeper and deeper into the class hierarchy. It can simplify the argument lists quite a bit. Maybe others can comment with their thoughts as well. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting "TypeError:list indices must be integers"

2006-06-13 Thread Larry Bates
ecuted because i'm stuck on that TypeError since 2 hours > :( (2) You have the weirdest system of choosing names that I have seen for >> decades. > :(( >> (3) Both of the above. >> >> Cheers, >> John >> > How about just inserting some pri

Re: DispatchEx('.Application')

2006-06-13 Thread Larry Bates
I intend to do this: > > mf.Navigate('www.groups.google.com.au/etc'') > > Will all of these functions work with Firefox or is it only Internet > Explorer(I can use either but I prefer Firefox?) > This might help: http://mail.python.org/pipermail/python-win32/2005-June/003413.html -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Database read and write

2006-06-15 Thread Larry Bates
Might want to check out: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362715 -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Python in Windows ng

2006-06-15 Thread Larry Bates
k Hammond and Andy Robinson). It covers lots of Windows "specific" things and has good examples of writing services and COM objects. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: a good programming text editor (not IDE)

2006-06-15 Thread Larry Bates
edge of Java? Or am I being even > more newbie-ish than I thought I was? :) Nope, no Java knowledge necessary. Jython just compiles Python code to java bytecode instead of python bytecode. Once it is in java bytecode the JVM doesn't know where it came from. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: copyfile avoiding overwrites and race conditions

2006-06-19 Thread Larry Bates
d it, extract next filename, increment the counter portion of the filename, write it back out and unlock it. Now I have the name of the file to write that is unique to my instance and I can write it without worrying about other processes. Hope this helps. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Running Python modules dump stuff on "C" drive?

2006-06-19 Thread Larry Bates
d drive with temp files or cached files from the browser. Clear out your Temporary Internet files (if you haven't already) and change the location of temporary Internet files to another drive. Also check c:\windows\temp. That directory gets lots of crud that I have to clean out. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Reddit broke - should have remained on Lisp?

2006-06-30 Thread Larry Clapp
On 2006-06-30, Luis M. González <[EMAIL PROTECTED]> wrote: > Alok wrote: >> While posting a comment on http://www.reddit.com I got an error >> page with the following curious statement on it. >> >> "reddit broke (sorry)" >> "looks like we shouldn't have stopped using lisp..." >> >> See screenshot a

Re: pyExcelerator - Can I read and modify an existing Excel-WorkBook?

2006-07-11 Thread Larry Bates
; Greetings, > Marco > > If you are on Windows, you may find using COM interface to actual Excel application easier. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: os.access() problem

2006-07-11 Thread Larry Bates
sions, so I could be missing something simple. Can anyone offer > any suggestions? > > Thanks, > Phil > I just tested on Windows XP with ActiveState Python 2.4.1 and it works as expected. >>> import os >>> os.access(r'c:\output.txt', os.W_OK) True Ch

Re: Taking data from a text file to parse html page

2006-08-24 Thread Larry Bates
th blank space) I'm new to python > and could use a little push in the right direction, any ideas on how to > implement this? > > Thanks! > See Beautiful Soup: http://www.crummy.com/software/BeautifulSoup/ it will parse even badly formed HTML and allow you to extract/ch

Re: Accessing application data portably

2006-08-24 Thread Larry Bates
Tom E H wrote: > Larry Bates wrote: >>> Well that's great, but how do you access the ini file portably? >> From my original post: >> >> Then I use ConfigParser in my application... > > Thanks, but where in the directory structure do you put the ini file

Re: lambda

2006-08-24 Thread Larry Bates
fegge wrote: > what is a lambda expression? > You really should try Google first (python lambda): http://www.secnetix.de/~olli/Python/lambda_functions.hawk http://diveintopython.org/power_of_introspection/lambda_functions.html -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Python editor

2006-08-24 Thread Larry Bates
lug-in). These represent both ends of the spectrum in editors. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: List problem

2006-08-24 Thread Larry Bates
typed: list[0]+['Five'] that gives you the error you showed. What you meant to type was: l = ['One','Two','Three','Four'] This is a list of four strings, what you entered was a list of one string. NOTE never call a variable 'list' as it will mask the built-in list method (same goes for str, tuple, int, float, etc). -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating an executable installer on Windows

2006-08-25 Thread Larry Bates
info.php) to create the actual Windows installer (e.g. setup.exe). This does what you want and was very easy to set up. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: [Q] About an Installer Script for PyWin

2006-08-25 Thread Larry Bates
mputers (Compaq/HP) as some of their management software is written in Python. So "power-users" need to be pretty careful removing it these days. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: block a network port

2006-08-29 Thread Larry Bates
uestion. Blocking ports is a function of your firewall solution. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Python for Windows

2006-08-30 Thread Larry Bates
; Python code, it is an interpreted language. You can use an extension called py2exe that packages up python code with a .exe file and a couple of support files and that package can be installed on a computer with minimal or no registry or system file modifications. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: where or filter on list

2006-08-30 Thread Larry Bates
ered you can break out of the loop you can optimize the loop by breaking out when you start getting further away from value or you might be able to use the bisect module to find it faster. If the lists are small it probably isn't worth the extra effort. If they are large and sorted look at

Re: Python for Windows

2006-08-30 Thread Larry Bates
uninstaller. http://www.activestate.com/Products/ActivePython/ It does minimal registry changes and I know of no system file changes (but I could be wrong). If you want to put a program written in python on a workstation you don't have to put python on it. Use py2exe to package it and create an installer with Inno Setup. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: where or filter on list

2006-09-01 Thread Larry Bates
and closest function that I wrote may (or may not) return the correct answer. -Larry [EMAIL PROTECTED] wrote: > Thanks all ! > >> Question: what if two values are equidistant? > >>>> def closest(foo,v): > ... intermed = [(abs(v), v) for v in foo] > ... int

Re: Python for Windows

2006-09-01 Thread Larry Bates
mistral wrote: > Larry Bates писал(а): > >> mistral wrote: >>> hg писал(а): > >>>> Grant Edwards wrote: > >>>>>> Will the msi installer modify registry or other system files? >>>>>> Does it possible install Pytho

Re: IronPython 1.0 - Bugs or Features?

2006-09-06 Thread Larry Bates
try: block, it then executed what was in the except: block. Since all that was in the except: block was pass, it just fell through to the if statement. At that point strData is not defined because the try block failed and never create strData object. It is doing EXACTLY what you told it to do. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Secure Postgres access

2006-09-06 Thread Larry Bates
ote machine. Works great and the traffic is encrypted and I know who the user is because they can't connect until they give me their pubkey and I put on the server and they must have their private key AND passphrase to establish the SSH connection. I use this to run pgAdmin III remotely through a firewall to my database server. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Data sticking around too long

2006-09-06 Thread Larry Bates
much easier to > work with. > > Thanks again! > > Rob Richardson > RAD-CON, Inc. > Bay Village, OH > You shadowed the class attribute scanList by creating an instance variable called self.scanList in the __init__ method: self.scanList = [] Comment that line out and see what you get. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: 4 Simple Questions About Python/IDLE

2006-09-07 Thread Larry Bates
oing what you told it to. print "hello program" and exit (which closes the window). If you want it to pause put something after the print like: t=raw_input('Hit return to continue') This way the program will pause until you hit return. Good luck. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: 4 Simple Questions About Python/IDLE

2006-09-07 Thread Larry Bates
Omar wrote: > thank you genteman. > > however, its not working :( > > I resaved it, but same thing. > Please post some code so we can actually do something more than read your mind. You can also run the program from a shell instead of from idle to see what happens. -La

Re: should urlparse return user and pass in separate components?

2006-09-07 Thread Larry Bates
not None: port=int(port) return [scheme, domain, username, password, rootfolder, port] -Larry Bates metaperl wrote: > The urlparse with Python 2.4.3 includes the user and pass in the site > aspect of its parse: > >>>> scheme, site, path, parms, query, fid = >>

Re: split string problems

2006-09-08 Thread Larry Bates
;t have quotes around them. How are you creating the object p? If you would just get it into a single string (with something like: x=urllib.urlopen(url) p=x.read() then you can use elementree, or beautiful soup to get your prices quite easily. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: PILGraph Upgrade or Alternative Suggestion

2006-09-08 Thread Larry Bates
with titles and legends. I do need multi-platform for both Linux and > Windows. The intended use is to create graphics for web pages on the fly. > > TIA, > > Roger ReportLab Graphics works pretty well for me. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: win32service (wxpython) -- i cannot install service

2006-09-11 Thread Larry Bates
ndows services. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: extracting substrings from a file

2006-09-11 Thread Larry Bates
re interested in keeping. I am assuming that /GEN= and /gb: data doesn't have any spaces in them. If they do, you will need to use regular expressions instead of split. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: inserting into a file

2006-09-11 Thread Larry Bates
pondingly. > > Is there any other way to do this? > Please help... > > Sai krishna M No "magic" way to insert lines. If file is small, read into memory, insert line, write to disk. If it is large, read and write lines to secondary file, insert line, read remaining lines, dele

Re: best small database?

2006-09-11 Thread Larry Bates
t place to store files, not as blobs in a database. The answer about which database depends on your target platform but you could consider gadfly. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: A cross platform systray icon

2006-09-11 Thread Larry Bates
x27;t manage to find a > python example - does anyone have one? > > Ideally I'd like someone to tell me that PyQT, tkinter or PyGTK does > it all for me, but from my searching on the subject I doubt it is > going to be that easy! > > Thanks Google turned this up. h

Re: auto upgrade scripts?

2006-09-11 Thread Larry Bates
t; Best regards, > Stefaan. > Auto-upgrade from what to what? -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: best small database?

2006-09-11 Thread Larry Bates
Blair P. Houghton wrote: > Larry Bates wrote: >> The filesystem is almost always the >> most efficient place to store files, not as blobs in a >> database. > > I could get all theoretical about why that's not so in most cases, > but there are plenty of cases

Re: best small database?

2006-09-12 Thread Larry Bates
Paul Rubin wrote: > Larry Bates <[EMAIL PROTECTED]> writes: >> As far as "rational extension" is concerned, I think I can relate. >> As a developer of imaging systems that store multiple-millions of >> scanned pieces of paper online for customers, I can pr

Re: auto upgrade scripts?

2006-09-13 Thread Larry Bates
[EMAIL PROTECTED] wrote: >> Auto-upgrade from what to what? >> -Larry Bates > > Interesting question. > > In my case I want my program to check for (e.g.) bug-fix releases on > some location (network drive or ftp), and if available, allow to > automatically downlo

Re: win32service (wxpython) -- i cannot install service

2006-09-13 Thread Larry Bates
top, etc.) and get installed into servicemanager on Windows workstation or server. Their behavior could be dynamic, that is you could change what they do by communicating with them via external means. I think you better back up and tell us what you are trying to do at a higher level. Perhaps we can help more. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: win32service (wxpython) -- i cannot install service

2006-09-13 Thread Larry Bates
Larry Bates wrote: > kkt49 wrote: >> under code service install => ok >> >> _svc_name_ = r'moin_service' >> _svc_display_name_ = r'moin_service' >> start_cmd = r"c:\mmde\moin.exe" >> #info = ['

Re: stock quotes

2006-09-13 Thread Larry Bates
ract the data you want to get. Note: If the web page gets changed, it can break your program. Hope information helps. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Help

2006-09-18 Thread Larry Bates
Ascher Python programming on Win 32 by Mark Hammond & Andy Robinson -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: win32 Service: path to .py script

2006-09-19 Thread Larry Bates
uld not have a drive mapping Y:\. You can change the account that a service runs under in the Service Manager-Log On tab. Normally you wouldn't run services from mapped drives, they would be installed on local machine and started from there. If services need to access mapped drives, you need to put full UNC pathnames to access them or run the services under an account that has the drives mapped properly. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: new string method in 2.5 (partition)

2006-09-19 Thread Larry Bates
endswith() string methods that are > new and seem neat as well. FYI- .startswith() and .endswith() string methods aren't new in 2.5. They have been around since at least 2.3. Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Replace single character at given position

2006-09-19 Thread Larry Bates
> > Thanks in advance, > Martin > > > You can do this: s1=s1.replace('x','y', 1) # Only replace the first x with y or s1l=list(s1) s1l[1]='y' s1=''.join(s1l) or your method of using slices. All depends on what you want to do. Quite often you use .replace() method so you don't have to worry with the index. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: include statement

2006-09-20 Thread Larry Bates
Python's syntax. If someone gets something wrong in a file that gets included, it is harder to take a sane default or handle the error than with ConfigParser. Just a suggestion that I hope helps. -Larry Bates or -- http://mail.python.org/mailman/listinfo/python-list

Re: Using py2exe to wrap a service?

2006-09-20 Thread Larry Bates
=[myservice] > ) > > 'elp! Plz! > You may want to post this on gmane.comp.python.py2exe also. I'm going to try to guess what the problem is, but it is a little hard to tell from here. py2exe does its best to find all the modules required to create the .exe. Sometimes modules do dynamic imports, etc. of modules that "fool" py2exe. I'm guessing that this is the case and that you will need to manually include the missing module. Most such errors seem to fall into this category. Hope this at least points you in the correct direction. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to run an external program

2006-09-21 Thread Larry Bates
on, but on a more general note: If you want directory information use os.listdir or glob.glob instead. No reason to shell out to do a dir. If you were using dir as an example, please disregard. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it possible to save a running program and reload next time ?

2006-09-21 Thread Larry Bates
e when > I want it to stop, and can reload the data and continue to run from > where it stops when the computer is free ? > > Regards, > > xiaojf > You can save the state of Python objects and reload them at a later time/date by using Zope's ZODB. http://www.z

Re: Replacing line in a text file

2006-09-25 Thread Larry Bates
= yes'.join(data.split('disable = no',1)) fp=open(filename, 'w') fp.write(data) fp.close() -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Deprecation in String.joinfields()

2006-09-25 Thread Larry Bates
lds' > >>>> newname1 = string.join (li[:-1], ".") >>>> newname1 > 'a.b.mpilgrim.z' >>>> newname = li[:-1].joinfields(".") > Traceback (most recent call last): > File "", line 1, in ? > AttributeError: 'list' object has no attribute 'join' > > Thank you for your help > > Anoop > I think you want: newname1='.'.join(li[:-1]) -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: ultra newbie question (don't laugh)

2006-09-26 Thread Larry Bates
cond nature to think of creating/using objects in places where you want to provide for maximum flexibility and code isolation. At a minimum you should take a look at the elementtree module for handling your XML. It is downloadable for Python < 2.5 and is part of the standard library starting with version 2.5. Hope information helps at least a little. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: problem moving from char to integer

2006-09-26 Thread Larry Bates
You should also lose the semicolons, you are writing Python now, not PHP ;-). You might also want to write: def strord(url): return [int(i) for i in url] Or just lose the function completely since it degrades to a single list comprehension. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: productivity and long computing delays

2006-09-27 Thread Larry Bates
uessing - A significant portion of the time might be I/O that is disk bound so faster CPU won't help. If that's the case faster hard drive (10K or even 15K rpm) or a striped drive array could help. You should also check memory, if CPU starts swapping, the swap I/O will kill your performance. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: XSLT speed comparisons

2006-09-28 Thread Larry Bates
return proc.run(xml, topLevelParams=params) > except: > return "Error blah blah" > > print "Content-Type: text/html\n\n" > print buildPage() > > You can compare the development sites here: > asp: http://consultum.pointy.co.nz/about/team > python: http://python.pointy.co.nz/about/team > > Cheers! > For max speed you might want to try pyrxp: http://www.reportlab.org/pyrxp.html -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: XSLT speed comparisons

2006-09-28 Thread Larry Bates
Jan Dries wrote: > Larry Bates wrote: >> Damian wrote: > [...] >> > What I've got is: >> > two websites, one in ASP.NET v2 and one in Python 2.5 (using 4suite for >> > XML/XSLT) >> > both on the same box (Windows Server 2003) >> > bo

PATCH: Speed up direct string concatenation by 20+%!

2006-09-28 Thread Larry Hastings
a reference to another PyString *. If non-NULL, it means the local ob_sval actually points into the ob_sval owned by that other PyString *. It'd be another four bytes, but we'd only need to incur that when creating a slice; we could set a bit in ob_sstate indicating "this is a slice

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Larry Hastings
uilt: 7.7s Python 2.5 concat: 7.2s % improvement: 6.94% Note that I was lazy and only did one benchmark run apiece. Also, keep in mind that memory utilization will be a little higher with the string concatenation objects. Carl Friedrich Bolz wrote: > Robin Becker wrote: > > wouldn't this approach apply to other additions eg list+list seq+seq etc > > etc. > no, I think it depends on strings being immutable. Exactly. /larry/ -- http://mail.python.org/mailman/listinfo/python-list

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Larry Hastings
'a' * 1000 ". (I shan't post it here.) Also, I misspoke earlier; it's not an improvement of 697%, but of 597%. To be precise, it takes about 1/7 the time of the original. Cheers, /larry/ -- http://mail.python.org/mailman/listinfo/python-list

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Larry Hastings
range(10): s += "a" The result: Python 2.5 release: 30.1s Python 2.5 locally built: 30.4s Python 2.5 concat: 3.95s Improvement: *669%*! (1/7.7 the time.) So xrange(1000) was adding between 0.4s and 0.9s overhead, and losing it makes my approach look even better. Than

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Larry Hastings
d external users can ignore the difference as long as they use the macros in stringobject.h (e.g. using PyString_AS_STRING(), rather than casting to PyStringObject and using ob_sval directly). Sorry for misunderstanding the nature of your question the first time, /larry/ -- http://mail.python.org/mailman/listinfo/python-list

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Larry Hastings
.2s Python 2.5 concat: 4.3s Improvement: 600% (1/7 of the time) /larry/ -- http://mail.python.org/mailman/listinfo/python-list

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-10-01 Thread Larry Hastings
> I think your project might make a very > interesting PyCon paper for people who were thinking about joining the > development effort but hadn't yet started. Perhaps; I've never been to PyCon, but it might be fun to give a presentation there. That said, it would be way more

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-10-02 Thread Larry Hastings
this under my patched Python 2.5: x = "" xappend = x.__add__ for i in xrange(1000): xappend("a") y = "".join(x) took 3343ms. /larry/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to handle large lists?

2006-10-03 Thread Larry Bates
n the lists (e.g are the elements unique, can they be sorted, etc) and take advantage of all that information to come up with a "faster" algorithm. If they are unique, sets might be a good choice. If they are sorted, bisect module might help. The specifics about the list(s)

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-10-03 Thread Larry Hastings
my hacked-up benchmark script. Just back up your existing python25.dll, then unzip to your Python directory, and you're ready to rock. Enjoy, /larry/ -- http://mail.python.org/mailman/listinfo/python-list

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-10-03 Thread Larry Hastings
objects. In that case I just append the string. Speeds things up immensely. Cheers, /larry/ -- http://mail.python.org/mailman/listinfo/python-list

Re: What value should be passed to make a function use the default argument value?

2006-10-03 Thread Larry Bates
sn't seem to work.. > > Thanks in advance. > The answer is don't pass any value. print f() will print 2 -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: [Zopyrus] A python IDE for teaching that supports cyrillic i/o

2006-11-18 Thread Larry Bates
etter to use a simple text > editor + command line? > > Oleg. Not sure about cyrillic and I don't mean if you are looking for Windows IDE, but I'm impressed with Pyscripter: http://mmm-experts.com/Products.aspx?ProductId=4 -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: python skipping lines?

2006-11-27 Thread Larry Bates
ordan Greenberg >> >> -- >> Posted via a free Usenet account from http://www.teranews.com > The first time through the loop you read through RawData and are at the bottom of the file. You either need to seek back to the beginning or you need to close and reopen the file each time through the loop. Suggestions: 1) In PullHourData the first argument is filename. In fact it is not a filename but rather a file pointer. Just a little confusing for anyone coming along behind you. 2) If the data is well-formed CSV you should probably take a look at the csv module. It handles CSV data better than splitting on commas (which can be dangerous as there can be commas inside of literal data). -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: SPE (Stani's Python Editor) web site?

2006-11-28 Thread Larry Bates
y Stani > wherein he said he might move the site, but I can't find it... > > John DNS resolves to 205.234.199.58, but homepage never loads and I get a Proxy Error in browser. FYI, Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple text parsing gets difficult when line continues to next line

2006-11-28 Thread Larry Bates
ine: > > line = line + nextLine > > How can I get the next line when I am in a for loop using readlines? > > jr > Something like (not tested): fp=open(filename, 'r') for line in fp: while line.rstrip().endswith('_'): line+=fp.next() fp.close() -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Python

2006-11-29 Thread Larry Bates
this module for parsing your XML: http://effbot.org/zone/element-index.htm elementree is now part of the standard library. Note: It would also help if you would post contents of log1.xml so others could see what you are working with. You should also post whatever python code you have tried so

Re: Ensure a variable is divisible by 4

2006-12-04 Thread Larry Bates
ot x % 4: # # Arrive here if x is modulo 4 divisable # -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing unix Line endings from Windows.

2006-12-04 Thread Larry Bates
done, delete the original file and rename the output file. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-09 Thread Larry Elmore
mystilleef wrote: > John Thingstad wrote: >> You are just being silly. >> Lisp's OO environment CLOS is vastly superior to Python classes. >> Both in terms of expressive power and flexibility. >> You might even find out if you ever learnt how to use it. >> > > Donkeys have wings. And thus you thi

Re: need guidance on sending emails with attachment with python.

2006-12-11 Thread Larry Bates
smtplib library. You don't need to use any email client (e.g. Outlook, etc.). -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: run a script and supply commands from a python cgi script

2006-12-14 Thread Larry Bates
obably need to switch to an ISP that allows you shell access to your server instance or one that will install python modules for you on your sever. -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiple inheritance and __slots__

2006-12-14 Thread Larry Bates
line.net/simon/blog/ > Sounds a lot like you are coming from another programming language and are trying to make Python act like it did. Hey I did the same thing when I first took up Python as a language. Python is not Java (or any other language that puts you in a straight jacket). IMHO if you embrace the dynacism of Python and you will be much happier writing code in it. Don't worry if someone will try to assign to some attribute in your class that "is illegal". They may be doing if for some reason you can't fathom at the outset. -Larry -- http://mail.python.org/mailman/listinfo/python-list

Re: update attribute - (newbie)

2006-12-19 Thread Larry Bates
Bruce wrote: class A: > ... def __init__(self): > ... self.t = 4 > ... self.p = self._get_p() > ... def _get_p(self): > ... return self.t > ... a = A() a.p > 4 a.t += 7 a.p > 4 > > I would like to have it that when I ask for p, method _get_p is always > called so t

Re: Any easy-to-use email send module?

2006-12-20 Thread Larry Bates
se() > > Thanx. I'm not entirely sure where I got this code (Google search years ago) and I've extended it a little, but you are welcome to use it and it is very close to what you outlined above. I had to strip out a bunch of custom logging that I include in my version, but i

<    5   6   7   8   9   10   11   12   13   14   >