Python tricks with applescript in OS-X

2009-12-11 Thread joa...@gmail.com
Greetings, I've written a short document with some working examples of how to interface python with other applications in OS-X via applescript (had to spend some time figuring it out, and thought I might as well write it down). The examples include asking Google Earth for the latitude and longitu

which pi formula is given in the decimal module documentation?

2009-12-11 Thread Anh Hai Trinh
I'm just curious which formula for pi is given here: ? def pi(): """Compute Pi to the current precision. >>> print pi() 3.141592653589793238462643383 """ getcontext().prec += 2 # extra digits for intermediate steps three = Decimal(3) # substitute "three=3.0" for reg

Re: Question on Python as career

2009-12-11 Thread Nicola Larosa (tekNico)
> Tim Roberts wrote: >> There are very, very few full-time Python jobs anywhere in the world, >> although many people use Python as one tool in their toolbox. Not that few. Anyway, it's not a zero-sum game: you want to work with Python? Find a job where *you* introduce it. :-) Aahz wrote: > All

Re: Float precision and float equality

2009-12-11 Thread dbd
On Dec 10, 2:23 pm, Carl Banks wrote: > ... > > A useful description of floating point issues can be found: > > [snip] > > I'm not reading it because I believe I grasp the situation just fine. > ... > > Say I have two numbers, a and b.  They are expected to be in the range > (-1000,1000).  As far

Re: plain text parsing to html (newbie problem)

2009-12-11 Thread João
On Dec 10, 7:55 pm, Lie Ryan wrote: > > and, is there any reason why you're not using the email and > smtplib?http://docs.python.org/library/email-examples.html Mainly because I was unaware of them :( I just read about them and I found all the Subject, From, To classes, but what about Content-T

Re: plain text parsing to html (newbie problem)

2009-12-11 Thread João
On Dec 10, 7:55 pm, Lie Ryan wrote: > > and, is there any reason why you're not using the email and > smtplib?http://docs.python.org/library/email-examples.html Mainly because I was unaware of them :( I just read about them and I found all the Subject, From, To classes, but what about Content-T

Variable class instantiation

2009-12-11 Thread Jan Mach
Hi everybody, I am currently solving the following problem and I am stuck. I am trying to create instance of the class of variable name. I know, that the following works: if (something): classToUse = C1 else: classToUse = C2 o = classToUse() ,but this is not what I want. I need to have t

Re: Variable class instantiation

2009-12-11 Thread Richard Thomas
On Dec 11, 9:26 am, Jan Mach wrote: > Hi everybody, > I am currently solving the following problem and I am stuck. I am trying > to create instance of the class of variable name. I know, that the > following works: > > if (something): >     classToUse = C1 > else: >     classToUse = C2 > > o = cla

Re: Variable class instantiation

2009-12-11 Thread Steven D'Aprano
On Fri, 11 Dec 2009 10:26:49 +0100, Jan Mach wrote: > I need to have the class name in the > string and then instantiate it: > > (this does not work of course) > classToUse = "C1" > o = classToUse() > > It is because I don`t know at the moment what the name of the class will > be, I will load it

Which graph library is best suited for large graphs?

2009-12-11 Thread Wolodja Wentland
Hi all, I am writing a library for accessing Wikipedia data and include a module that generates graphs from the Link structure between articles and other pages (like categories). These graphs could easily contain some million nodes which are frequently linked. The graphs I am building right now h

Re: Variable class instantiation

2009-12-11 Thread Lie Ryan
On 12/11/2009 8:26 PM, Jan Mach wrote: Hi everybody, I am currently solving the following problem and I am stuck. I am trying to create instance of the class of variable name. I know, that the following works: if (something): classToUse = C1 else: classToUse = C2 o = classToUse() ,bu

Re: which pi formula is given in the decimal module documentation?

2009-12-11 Thread Mark Dickinson
On Dec 11, 8:16 am, Anh Hai Trinh wrote: > I'm just curious which formula for pi is given here: docs.python.org/library/decimal.html#recipes>? > > def pi(): >     """Compute Pi to the current precision. > >     >>> print pi() >     3.141592653589793238462643383 > >     """ >     getcontext().prec

Re: pyZui - anyone know about this?

2009-12-11 Thread Daniel Fetchinson
> Hi, > I happened upon this youtube link: > http://www.youtube.com/watch?v=57nWm984wdY > It fairly blew my socks off. In it a fellow by the name of David Roberts > demos > a zui written in Python. Aside from the zooming (which is impressive enough) > it show embedding of images, pdf files, web pag

Re: plain text parsing to html (newbie problem)

2009-12-11 Thread Lie Ryan
On 12/11/2009 8:43 PM, João wrote: On Dec 10, 7:55 pm, Lie Ryan wrote: and, is there any reason why you're not using the email and smtplib?http://docs.python.org/library/email-examples.html Mainly because I was unaware of them :( I just read about them and I found all the Subject, From, To

Re: which pi formula is given in the decimal module documentation?

2009-12-11 Thread Mark Dickinson
On Dec 11, 10:30 am, Mark Dickinson wrote: > > It looks like an infinite series with term `t`, where`n` = (2k-1)^2 > > and `d` = d = 4k(4k+2) for k = 1... Does it have a name? > > Interesting.  So the general term here is > 3 * (2k choose k) / (16**k * (2*k+1)),  k >= 0. > > I've no idea what its

Re: Which graph library is best suited for large graphs?

2009-12-11 Thread Bearophile
Wolodja Wentland: > Which library would you choose? This one probably uses low memory, but I don't know if it works still: http://osl.iu.edu/~dgregor/bgl-python/ Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Which graph library is best suited for large graphs?

2009-12-11 Thread Wolodja Wentland
On Fri, Dec 11, 2009 at 03:03 -0800, Bearophile wrote: > Wolodja Wentland: > > Which library would you choose? > > This one probably uses low memory, but I don't know if it works still: > http://osl.iu.edu/~dgregor/bgl-python/ That project looks not that maintained and graph-tool [1] is based on

Re: pyZui - anyone know about this?

2009-12-11 Thread Donn
On Friday 11 December 2009 12:38:46 Daniel Fetchinson wrote: > Youtube has a link 'Send message' on the profile of users, maybe > sending a message to the person who uploaded the video will give you a > useful response. > I'm a Tube-tard so that never crossed my mind. Will give it a go. \d -- ht

Re: Variable class instantiation

2009-12-11 Thread Sion Arrowsmith
Steven D'Aprano wrote: >thisModule = __import__(__name__) >classToUse = thisModule.__dict__['C1'] Any reason to prefer this over: classToUse = getattr(thisModule, 'C1') ? (I think, for a module, they should do exactly the same thing. Personally, I prefer keeping explicit references to __specia

Re: Variable class instantiation

2009-12-11 Thread Steven D'Aprano
On Fri, 11 Dec 2009 11:36:13 +, Sion Arrowsmith wrote: > Steven D'Aprano wrote: >>thisModule = __import__(__name__) >>classToUse = thisModule.__dict__['C1'] > > Any reason to prefer this over: > > classToUse = getattr(thisModule, 'C1') > > ? (I think, for a module, they should do exactly

Re: switch

2009-12-11 Thread Bearophile
Bruno Desthuilliers: > Well, obviously such business rules must by no mean be hardcoded. You > really need a "rule engine", configurable by your domain experts thru a > DSL that we'll design specially for you. The rule engine will generate > an AbstractScoreFactory that will instanciate appropriat

Re: IndentationError

2009-12-11 Thread Ben Finney
hong zhang writes: > I got error says IndentationError in end of line. > I could not figure out why. Nor can we, without seeing the code to compare indentation levels. > Thanks for help. Please construct a minimal example (not a whole huge program), that we can run to show the behaviour you're

Re: IndentationError

2009-12-11 Thread Lie Ryan
On 12/10/2009 6:32 AM, hong zhang wrote: List, I got error says IndentationError in end of line. I could not figure out why. See following: $ ./cont-mcs File "./cont-mcs", line 264 mcs1 = ht_val+cck_val+green_val+fat_val+sgi_val ^ Inden

Re: Overriding the >> builtin

2009-12-11 Thread Xavier Ho
On Fri, Dec 11, 2009 at 12:05 PM, Kevin Ar18 wrote: > I am aware of the fact that you can somehow replace the __builtins__ in > Python. There is a library here that modifies the >> binary builtins: > http://github.com/aht/stream.py/blob/master/stream.py > > Question: Is there anywhere that expl

Re: accessing local variables from the pdb debugger

2009-12-11 Thread Jean-Michel Pichavant
Lie Ryan wrote: On 12/11/2009 12:37 AM, Jean-Michel Pichavant wrote: Diez B. Roggisch wrote: By just inserting the print foo statement right after changing foo's value, I've rolled back the value to 'foo' ??? A hell of a wtf pdb feature ! Apparently it's fixed in 2.7 and 3.1 D:\Lie Ryan\Deskt

Re: which pi formula is given in the decimal module documentation?

2009-12-11 Thread Mark Dickinson
On Dec 11, 8:16 am, Anh Hai Trinh wrote: > I'm just curious which formula for pi is given here: docs.python.org/library/decimal.html#recipes>? > > def pi(): >     """Compute Pi to the current precision. > >     >>> print pi() >     3.141592653589793238462643383 > >     """ >     getcontext().prec

Re: no module named error

2009-12-11 Thread Diez B. Roggisch
Joe schrieb: Your installation process is botched (no idea why, you don't show us setup.py or anything else I asked for). Sorry, but I do know how it's currently installed is exactly the way I need it to be installed. It is? It wasn't working until you fiddled with sys.path - which you neede

Re: Question about 'remote objects'

2009-12-11 Thread Frank Millman
Frank Millman wrote: > > I am writing a multi-user business/accounting application. It is getting > rather complex and I am looking at how to, not exactly simplify it, but > find a way to manage the complexity. > [...] > > Is there any particular benefit in using remote objects as opposed to > w

Moving from PHP to Python. Is it Possible

2009-12-11 Thread Sancar Saran
Greetings. I'm 35 yrs old self learner and who do daily PHP coding for food more than a decade. After ten years of PHP coding I'm getting bored and give try for learning new things. After 3 days of crawling google, diving in python and cursing, now I can show something on my linux/apache/mo

Re: Recommendation for small, fast, Python based web server

2009-12-11 Thread Antoine Pitrou
Hello, > I've looked at the web servers that come bundled with the Python > standard library[1] and they are too slow. Apparently you have debugged your speed issue so I suppose you don't have performance problems anymore. Do note, however, that Python is generally not as fast as C -- especial

Re: Which graph library is best suited for large graphs?

2009-12-11 Thread Neal Becker
Bearophile wrote: > Wolodja Wentland: >> Which library would you choose? > > This one probably uses low memory, but I don't know if it works still: > http://osl.iu.edu/~dgregor/bgl-python/ > > Bye, > bearophile How about python interface to igraph? -- http://mail.python.org/mailman/listinfo/p

Re: a huge shared read-only data in parallel accesses -- How? multithreading? multiprocessing?

2009-12-11 Thread Antoine Pitrou
Le Wed, 09 Dec 2009 06:58:11 -0800, Valery a écrit : > > I have a huge data structure that takes >50% of RAM. My goal is to have > many computational threads (or processes) that can have an efficient > read-access to the huge and complex data structure. > > "Efficient" in particular means "withou

Re: Which graph library is best suited for large graphs?

2009-12-11 Thread Wolodja Wentland
On Fri, Dec 11, 2009 at 08:55 -0500, Neal Becker wrote: > Bearophile wrote: > > Wolodja Wentland: > >> Which library would you choose? > > This one probably uses low memory, but I don't know if it works still: > > http://osl.iu.edu/~dgregor/bgl-python/ > How about python interface to igraph? Don

Active Directory ADO strange objects returned

2009-12-11 Thread marc wyburn
Hi, I have a script that returns data from active directory using ADO. Everything works except for any fields that use a time value I get an instance of an object returned called . I know it's a time object because if I do object.HighPart or object.LowPart I get a value back. The bit I don't und

Re: Python tricks with applescript in OS-X

2009-12-11 Thread Kevin Walzer
On 12/11/09 3:13 AM, joa...@gmail.com wrote: Greetings, I've written a short document with some working examples of how to interface python with other applications in OS-X via applescript (had to spend some time figuring it out, and thought I might as well write it down). The examples include a

Re: extending dictonary

2009-12-11 Thread InvisibleRoads Patrol
On Sat, 21 Nov 2009 09:25:38 +0100, nospam <"knutjbj(nospam)"@online.no> wrote: > Is there any way to extend the dictonary in such manner that I can > insert muliplay value to each keys and return one of the value as the > default value. I would like to have similar syste that I drawed out below.

Re: extending dictonary

2009-12-11 Thread InvisibleRoads Patrol
On Sat, 21 Nov 2009 09:25:38 +0100, nospam <"knutjbj(nospam)"@online.no> wrote: > Is there any way to extend the dictonary in such manner that I can > insert muliplay value to each keys and return one of the value as the > default value. I would like to have similar syste that I drawed out below.

Re: Moving from PHP to Python. Is it Possible

2009-12-11 Thread zeph
Hi Sancar, 1) PHP does some really nasty things in how it treats globals, and you will have to break yourself of those sorts of habits -- Python offers much cleaner alternatives, like grouping similar functionality into modules which can be imported; the import functionality in python is pretty fl

Re: plain text parsing to html (newbie problem)

2009-12-11 Thread João
Lie Ryan wrote: > You can set MIME type and encoding from the MIME constructor > email.mime.Text.MIMEText("Bold Text", "html", "utf-8") > > are you importing "import mime" or "import email.mime" or "import > email.MIMEMultipart"? Hi Lie. I was importing as, 'from email.mime.text import MIMEText'

Re: Which graph library is best suited for large graphs?

2009-12-11 Thread IngoognI
On Dec 11, 11:12 am, Wolodja Wentland wrote: > > Which library would you choose? looking at the galery at networx, it seems to be all balls 'n sticks, how about writing the data to a file POV-Ray can read and render it there? -- http://mail.python.org/mailman/listinfo/python-list

Re: C to Python

2009-12-11 Thread Stefan Behnel
Benjamin Peterson, 10.12.2009 20:26: > Emeka writes: >> I am finding it difficult getting my head around PyObject_CallObject(x,y). I > need a gentle and thorough introduction to it. I also need examples. Could > someone come to my need? > > PyObject_CallFunction is probably easier to use. Hmm, I

Re: Which graph library is best suited for large graphs?

2009-12-11 Thread Wolodja Wentland
On Fri, Dec 11, 2009 at 07:31 -0800, IngoognI wrote: > On Dec 11, 11:12 am, Wolodja Wentland > wrote: > > Which library would you choose? > > looking at the galery at networx, it seems to be all balls 'n sticks, > how about writing the data to a file POV-Ray can read and render it > there? Huh?

Re: Moving from PHP to Python. Is it Possible

2009-12-11 Thread MRAB
zeph wrote: [snip] 4) It's better to collect all your eventual output into a string that you print - there are examples at [3]. You can import from other modules as needed (even conditionally), grow your string for output, then finally print it like (this example was adapted from one found on [3]

Re: Which graph library is best suited for large graphs?

2009-12-11 Thread Neal Becker
Wolodja Wentland wrote: > On Fri, Dec 11, 2009 at 08:55 -0500, Neal Becker wrote: >> Bearophile wrote: >> > Wolodja Wentland: >> >> Which library would you choose? > >> > This one probably uses low memory, but I don't know if it works still: >> > http://osl.iu.edu/~dgregor/bgl-python/ > >> How a

Re: Moving from PHP to Python. Is it Possible

2009-12-11 Thread Sancar Saran
On Friday 11 December 2009 05:11:12 pm zeph wrote: > Hi Sancar, Hi zeph, Thanks for reply. And here my needs about those 2 two programming technique. > 1) PHP does some really nasty things in how it treats globals, and you > will have to break yourself of those sorts of habits -- Python offers

Virtual file for subprocess

2009-12-11 Thread bobnotbob
I am calling external executable from my python program (using subprocess). This external program's output is a text file which I then read and parse. Is there any way to "sandbox" the calling of this external program so that it writes to a virtual file instead of the hardcoded text? -- http://m

eiger replacement?

2009-12-11 Thread Robin Becker
The current hardware CPU: Intel(R) Pentium(R) 4 CPU 2.40GHz (2394.01-MHz 686-class CPU) Device Model: Hitachi HDT725025VLAT80 Serial Number:VF1100R107LS4K Firmware Version: V5DOA42A User Capacity:250,059,350,016 bytes available here http://www.kikatek.com/product_info.php?products

When to use mechanize and Windmill library during WebScraping ?

2009-12-11 Thread Raji Seetharaman
Hi For 'Webscraping with Python' mechanize or urllib2 and windmill or selenium libraries are used to download the webpages. http://www.packtpub.com/article/web-scraping-with-python The above link makes use of mechanize library to download the web pages. The below link uses windmill library to

Using hash to see if object's attributes have changed

2009-12-11 Thread Bryan
When a user submits a request to update an object in my web app, I make the changes in the DB, along w/ who last updated it and when. I only want to update the updated/updatedBy columns in the DB if the data has actually changed however. I'm thinking of having the object in question be able to re

Re: ANN: WHIFF.0.7 += GAE + jQueryUI + internationalization + testdrive = (last beta?)

2009-12-11 Thread Terry Reedy
Aaron Watters wrote: That was a joke in the tree view. You clicked on the "science link" in the tree hierarchy. I will fix it due to your complaint. Fixed. Now clicking on the same link goes to "Scientific American". Perhaps I was not clear enough. I am using FireFox 3.5 with Flashblock w

MySQL set and enum, calling values

2009-12-11 Thread Victor Subervi
Hi; I have the following code: cursor.execute('describe %s;' % store) colFields, colFieldValues = [itm[0] for itm in cursor], [itm[1] for itm in cursor] ... for col in colFields: ... print '%s: %s\n' % (col, colValue[0]) Don't worry about the colValue[0]. In fact, the code throws no errors. H

Re: Using hash to see if object's attributes have changed

2009-12-11 Thread Robert Kern
On 2009-12-11 12:03 PM, Bryan wrote: When a user submits a request to update an object in my web app, I make the changes in the DB, along w/ who last updated it and when. I only want to update the updated/updatedBy columns in the DB if the data has actually changed however. I'm thinking of havi

Re: switch

2009-12-11 Thread Tim Chase
On 12/10/2009 09:22 PM, John Bokma wrote: Tim Chase writes: Please don't delete attribution line(s), added: Asun Friere writes: I tend to prune them because a good newsreader will thread messages and put my reply in the context of the message to which I'm replying. Both Thunderbird an

A try with WebScraping using Python

2009-12-11 Thread Raji Seetharaman
Hi >From the tutorial found on the net i came to know about WebScraping using Python. I thought to give a try with it. My wish is to extract the contact mail id's from all the posts published till now in the below link http://fossjobs.wordpress.com/ With Firebug add-on its easy to find the l

Re: Moving from PHP to Python. Is it Possible

2009-12-11 Thread imageguy
> So My question is. > For example I had this kind of python file and we want to use this as plugin > template > >   >   <% >   for n in range(3): >       # This indent will persist >   %> >   This paragraph will be >   repeated 3 times. >   <% >   # This line will cause the block to end >   %> >

Re: Recommendation for small, fast, Python based web server

2009-12-11 Thread Irmen de Jong
On 11-12-2009 14:52, Antoine Pitrou wrote: Hello, I've looked at the web servers that come bundled with the Python standard library[1] and they are too slow. Apparently you have debugged your speed issue so I suppose you don't have performance problems anymore. Do note, however, that Python

Re: Using hash to see if object's attributes have changed

2009-12-11 Thread Bryan
On Dec 11, 10:17 am, Robert Kern wrote: > On 2009-12-11 12:03 PM, Bryan wrote: > > > When a user submits a request to update an object in my web app, I > > make the changes in the DB, along w/ who last updated it and when.  I > > only want to update the updated/updatedBy columns in the DB if the >

__mul__ vs __rmul__ (and others) priority for different classes

2009-12-11 Thread dmitrey
hi all, I have created a class MyClass and defined methods like __add__, __mul__, __pow__, __radd__, __rmul__ etc. Also, they are defined to work with numbers, Python lists and numpy.arrays. Both Python lists and numpy arrays have their own methods __add__, __mul__, __pow__, __radd__, __rmul__ etc

HTTPS - HTTPPasswordMgrWithDefaultRealm

2009-12-11 Thread Max Slimmer
1) I have an application that accesses a web site via HTTPS using a certificate. The primary url returns a 302 redirect, urllib2 then goes to this address and gets a 401, which if the passwordMgr has be setup properly then connects. I have been able to determine a set of uri's that if fed to the p

Re: Virtual file for subprocess

2009-12-11 Thread Lie Ryan
On 12/12/2009 4:07 AM, bobnotbob wrote: I am calling external executable from my python program (using subprocess). This external program's output is a text file which I then read and parse. Is there any way to "sandbox" the calling of this external program so that it writes to a virtual file i

Re: pyZui - anyone know about this?

2009-12-11 Thread Stef Mientki
Donn wrote: On Friday 11 December 2009 12:38:46 Daniel Fetchinson wrote: Youtube has a link 'Send message' on the profile of users, maybe sending a message to the person who uploaded the video will give you a useful response. I'm a Tube-tard so that never crossed my mind. Will give it

Re: MySQL set and enum, calling values

2009-12-11 Thread Carsten Haese
Victor Subervi wrote: > [...] if I go to print, say, > colFieldValues[20], which is a set, it prints out the whole set: > set('Extra-small','Small','Medium','Large','XLarge','XXLarge','XXXLarge') > But if I print out colFieldValues[20][0], it prints out "s". The only reasonable explanation of this

Re: Virtual file for subprocess

2009-12-11 Thread Grant Edwards
On 2009-12-11, Lie Ryan wrote: > On 12/12/2009 4:07 AM, bobnotbob wrote: >> I am calling external executable from my python program (using >> subprocess). This external program's output is a text file which I >> then read and parse. Is there any way to "sandbox" the calling of >> this external p

Re: MySQL set and enum, calling values

2009-12-11 Thread Victor Subervi
On Fri, Dec 11, 2009 at 3:12 PM, Carsten Haese wrote: > Victor Subervi wrote: > > [...] if I go to print, say, > > colFieldValues[20], which is a set, it prints out the whole set: > > set('Extra-small','Small','Medium','Large','XLarge','XXLarge','XXXLarge') > > But if I print out colFieldValues[20

How can I get the target platform info of a dll with Python 3.1.1?

2009-12-11 Thread Isti
I have many dll files and I would like to select them into two different folders (PC and PPC). For this I need to know the target platform of the dll file or any other details about its platform. I use Python 3.1.1. I have tried the win32api which does not compatible with this Python version. So,

How can I get the target platform info of a dll with Python 3.1.1?

2009-12-11 Thread István Szirtes
I have many dll files and I would like to select them into two different folders (PC and PPC). For this I need to know the target platform of the dll file or any other details about its platform. I use Python 3.1.1. I have tried the win32api which does not compatible with this Python version. So,

Re: pyserial - escape codes transportation

2009-12-11 Thread Grant Edwards
On 2009-12-11, ObservantP wrote: > need help. newbie. pyserial and dot matrix printer. > issue- escape codes arrive at printer ( verified from hex dump) but do > not get applied. What you're saying is your printer isn't working correctly. > printer make/model STAR POS printer SP500. oddly, prin

Re: pyserial - escape codes transportation

2009-12-11 Thread Grant Edwards
On 2009-12-11, Grant Edwards wrote: > On 2009-12-11, ObservantP wrote: >> need help. newbie. pyserial and dot matrix printer. issue- >> escape codes arrive at printer ( verified from hex dump) but >> do not get applied. > > What you're saying is your printer isn't working correctly. BTW, I (amon

Re: __mul__ vs __rmul__ (and others) priority for different classes

2009-12-11 Thread Terry Reedy
dmitrey wrote: hi all, I have created a class MyClass and defined methods like __add__, __mul__, __pow__, __radd__, __rmul__ etc. Also, they are defined to work with numbers, Python lists and numpy.arrays. Both Python lists and numpy arrays have their own methods __add__, __mul__, __pow__, __rad

Re: Moving from PHP to Python. Is it Possible

2009-12-11 Thread zeph
On Dec 11, 8:58 am, MRAB wrote: > output = [''] > output.append('My Page') > output.append('') > output.append('Powers of two\n') > for n in range(1, 11): >      output.append('%s' % (2 ** n)) > > output.append('') > print ''.join(output) Agreed (I might join on '\n' though), I was just trying to

datetime 'NoneType' sporadic error

2009-12-11 Thread bfrederi
When using the datetime module, I sporadically get " 'NoneType' object has no attribute 'datetime' " on line 40: http://dpaste.com/hold/132156/ Sorry, I don't have the traceback, this is an error that was sent to me by one of the users. It only happens occasionally. Any ideas? -- http://mail.pyt

a list/re problem

2009-12-11 Thread Ed Keith
I have a problem and I am trying to find a solution to it that is both efficient and elegant. I have a list call it 'l': l = ['asc', '*nbh*', 'jlsdjfdk', 'ikjh', '*jkjsdfjasd*', 'rewr'] Notice that some of the items in the list start and end with an '*'. I wish to construct a new list, call it

Re: a list/re problem

2009-12-11 Thread Andre Engels
On Fri, Dec 11, 2009 at 9:49 PM, Ed Keith wrote: > I have a problem and I am trying to find a solution to it that is both > efficient and elegant. > > I have a list call it 'l': > > l = ['asc', '*nbh*', 'jlsdjfdk', 'ikjh', '*jkjsdfjasd*', 'rewr'] > > Notice that some of the items in the list start

Re: a list/re problem

2009-12-11 Thread Vlastimil Brom
2009/12/11 Ed Keith : > I have a problem and I am trying to find a solution to it that is both > efficient and elegant. > > I have a list call it 'l': > > l = ['asc', '*nbh*', 'jlsdjfdk', 'ikjh', '*jkjsdfjasd*', 'rewr'] > > Notice that some of the items in the list start and end with an '*'. I wish

Re: a list/re problem

2009-12-11 Thread Grant Edwards
On 2009-12-11, Ed Keith wrote: > I have a problem and I am trying to find a solution to it that is both > efficient and elegant. > > I have a list call it 'l': > > l = ['asc', '*nbh*', 'jlsdjfdk', 'ikjh', '*jkjsdfjasd*', 'rewr'] > Notice that some of the items in the list start and end with > an

Re: a list/re problem

2009-12-11 Thread Tim Chase
l = ['asc', '*nbh*', 'jlsdjfdk', 'ikjh', '*jkjsdfjasd*', 'rewr'] Notice that some of the items in the list start and end with an '*'. I wish to construct a new list, call it 'n' which is all the members of l that start and end with '*', with the '*'s removed. So in the case above n would be ['

Re: Which graph library is best suited for large graphs?

2009-12-11 Thread anand jeyahar
On 12/11/2009 10:27 PM, Neal Becker wrote: Which library would you choose? Hmm i have tried python-graph and was happy with itbut the most use i did was for complete graphs of 60-65 nodes.. Also there is an experimental branch for faster implementations, which is under development

expat having problems with entities (&)

2009-12-11 Thread nnguyen
I need expat to parse this block of xml: c-P&P LOT 3677 (F) I need to parse the xml and return a dictionary that follows roughly the same layout as the xml. Currently the code for the class handling this is: class XML2Map(): def __init__(self): """ """ self.parser =

Re: a list/re problem

2009-12-11 Thread Peter Otten
Ed Keith wrote: > I have a problem and I am trying to find a solution to it that is both > efficient and elegant. > > I have a list call it 'l': > > l = ['asc', '*nbh*', 'jlsdjfdk', 'ikjh', '*jkjsdfjasd*', 'rewr'] > > Notice that some of the items in the list start and end with an '*'. I > wish

Re: expat having problems with entities (&)

2009-12-11 Thread Rami Chowdhury
On Fri, Dec 11, 2009 at 13:23, nnguyen wrote: > > Any ideas on any expat tricks I'm missing out on? I'm also inclined to > try another parser that can keep the string together when there are > entities, or at least ampersands. IIRC expat explicitly does not guarantee that character data will be h

Re: expat having problems with entities (&)

2009-12-11 Thread nnguyen
On Dec 11, 4:23 pm, nnguyen wrote: > I need expat to parse this block of xml: > > > c-P&P > LOT 3677 > (F) > > > I need to parse the xml and return a dictionary that follows roughly > the same layout as the xml. Currently the code for the class handling > this is: > > class XML2Map(): > >

Re: How to implement Varient/Tagged Unions/Pattern Matching in Python?

2009-12-11 Thread Aahz
In article <358b227c-d836-4243-b79a-57258590a...@a10g2000pre.googlegroups.com>, metal wrote: > >I want to get pattern matching like OCaml in python(ref:http:// >en.wikipedia.org/wiki/Tagged_union) > >I consider the syntax: > >def decl(): > def Plus(expr, expr): pass > def Minus(expr,

Re: expat having problems with entities (&)

2009-12-11 Thread nnguyen
On Dec 11, 4:39 pm, Rami Chowdhury wrote: > On Fri, Dec 11, 2009 at 13:23, nnguyen wrote: > > > Any ideas on any expat tricks I'm missing out on? I'm also inclined to > > try another parser that can keep the string together when there are > > entities, or at least ampersands. > > IIRC expat expli

Problems with debugging Lists

2009-12-11 Thread Sancar Saran
Hello again. I wrote small class for generating and accessing globalized Dictionary. And of course I want to add some kind of debug ability to check what is inside... In php we had print_r function to see entire array structure. After some search I found some equal module named pprint. And so

Re: a list/re problem

2009-12-11 Thread Ed Keith
--- On Fri, 12/11/09, Peter Otten <__pete...@web.de> wrote: > From: Peter Otten <__pete...@web.de> > Subject: Re: a list/re problem > To: python-list@python.org > Date: Friday, December 11, 2009, 4:24 PM > Ed Keith wrote: > > > I have a problem and I am trying to find a solution to > it that is b

Re: eiger replacement?

2009-12-11 Thread Steven D'Aprano
On Fri, 11 Dec 2009 17:45:24 +, Robin Becker wrote: > The current hardware > > CPU: Intel(R) Pentium(R) 4 CPU 2.40GHz (2394.01-MHz 686-class CPU) [...] What does this have to do with Python? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: datetime 'NoneType' sporadic error

2009-12-11 Thread Carl Banks
On Dec 11, 12:33 pm, bfrederi wrote: > When using the datetime module, I sporadically get " 'NoneType' object > has no attribute 'datetime' " on line 40:http://dpaste.com/hold/132156/ > > Sorry, I don't have the traceback, this is an error that was sent to > me by one of the users. It only happens

Re: Which graph library is best suited for large graphs?

2009-12-11 Thread Brian J Mingus
On Fri, Dec 11, 2009 at 3:12 AM, Wolodja Wentland < wentl...@cl.uni-heidelberg.de> wrote: > Hi all, > > I am writing a library for accessing Wikipedia data and include a module > that generates graphs from the Link structure between articles and other > pages (like categories). > > These graphs co

Re: pyserial - escape codes transportation

2009-12-11 Thread ObservantP
On Dec 11, 7:58 pm, Grant Edwards wrote: > On 2009-12-11, Grant Edwards wrote: > > > On 2009-12-11, ObservantP wrote: > >> need help. newbie. pyserial and dot matrix printer. issue- > >> escape codes arrive at printer ( verified from hex dump) but > >> do not get applied. > > > What you're sayin

Re: Object Relational Mappers are evil (a meditation)

2009-12-11 Thread Steve Holden
Paul Rubin wrote: > Mick Krippendorf writes: If I knew what First Anormal Form was I (hope!) >> I read it somewhere once, I just can't find or even remember the source. >> I definitely didn't make it up, though I wish I had. > > I found exactly one google hit for it, which is this clpy thre

Re: Object Relational Mappers are evil (a meditation)

2009-12-11 Thread Steve Holden
Simon Forman wrote: [...] > As far as the OP rant goes, my $0.02: bad programmers will write bad > code in any language, with any tool or system or environment they're > given. If you want to avoid bad code there's (apparently) no > substitute for smrt programmers who are familiar with the tools

Re: a list/re problem

2009-12-11 Thread Matt Nordhoff
Grant Edwards wrote: > On 2009-12-11, Ed Keith wrote: >> I have a problem and I am trying to find a solution to it that is both >> efficient and elegant. >> >> I have a list call it 'l': >> >> l = ['asc', '*nbh*', 'jlsdjfdk', 'ikjh', '*jkjsdfjasd*', 'rewr'] > >> Notice that some of the items in

Re: MySQL set and enum, calling values

2009-12-11 Thread Gabriel Genellina
En Fri, 11 Dec 2009 16:28:23 -0300, Victor Subervi escribió: On Fri, Dec 11, 2009 at 3:12 PM, Carsten Haese wrote: Victor Subervi wrote: > [...] if I go to print, say, > colFieldValues[20], which is a set, it prints out the whole set: > set('Extra-small','Small','Medium','Large','XLarge

Re: When to use mechanize and Windmill library during WebScraping ?

2009-12-11 Thread tyler
On Fri, 11 Dec 2009, Raji Seetharaman wrote: > Hi > > For 'Webscraping with Python' mechanize or urllib2 and windmill or selenium > libraries are used to download the webpages. > > http://www.packtpub.com/article/web-scraping-with-python Be sure to look at Scrapy too: http://scrapy.org Chee

Re: Using hash to see if object's attributes have changed

2009-12-11 Thread Steven D'Aprano
On Fri, 11 Dec 2009 10:03:06 -0800, Bryan wrote: > When a user submits a request to update an object in my web app, I make > the changes in the DB, along w/ who last updated it and when. I only > want to update the updated/updatedBy columns in the DB if the data has > actually changed however. >

Re: a list/re problem

2009-12-11 Thread Steven D'Aprano
On Fri, 11 Dec 2009 12:49:42 -0800, Ed Keith wrote: > I have a problem and I am trying to find a solution to it that is both > efficient and elegant. > > I have a list call it 'l': > > l = ['asc', '*nbh*', 'jlsdjfdk', 'ikjh', '*jkjsdfjasd*', 'rewr'] > > Notice that some of the items in the list

Re: Object Relational Mappers are evil (a meditation)

2009-12-11 Thread Steven D'Aprano
On Fri, 11 Dec 2009 19:20:21 -0500, Steve Holden wrote: > Simon Forman wrote: > [...] >> As far as the OP rant goes, my $0.02: bad programmers will write bad >> code in any language, with any tool or system or environment they're >> given. If you want to avoid bad code there's (apparently) no >>

Re: Recommendation for small, fast, Python based web server

2009-12-11 Thread Antoine Pitrou
Le Fri, 11 Dec 2009 19:40:21 +0100, Irmen de Jong a écrit : > > I don't think that number is fair for Python. I think a well written > Python web server can perform in the same ballpark as most mainstream > web servers written in C. Especially Apache, which really isn't a top > performer. And I'm

Re: How can I get the target platform info of a dll with Python 3.1.1?

2009-12-11 Thread Gabriel Genellina
En Fri, 11 Dec 2009 16:39:37 -0300, Isti escribió: I have many dll files and I would like to select them into two different folders (PC and PPC). For this I need to know the target platform of the dll file or any other details about its platform. Look at sys.platform and the platform module

Re: Which graph library is best suited for large graphs?

2009-12-11 Thread geremy condra
On Fri, Dec 11, 2009 at 5:12 AM, Wolodja Wentland wrote: > Hi all, > > I am writing a library for accessing Wikipedia data and include a module > that generates graphs from the Link structure between articles and other > pages (like categories). > > These graphs could easily contain some million n

  1   2   >