Book Progression!?!?


,

I just went out and bought my first Python books. What do you think about this book progression from a learning stand point of new programmer. Learning Python Second Edition by Lutz then Programming Python Third Edition by Lutz and then having the Python Pocket Reference Third Edition.

One thing that slightly worries me is that Learning python is on 2.3 and the reference manual is on 2.4 while 2.5 is out :/

Perhaps it would of been wise to wait on the Pocket Reference for a new edition Anyways I have these books now, not sure on Borders return policies, but if I could get some recommendations or if these books serve me well then ill stick to them.

Posted On: Friday 28th of December 2012 01:15:44 AM Total Views:  74
View Complete with Replies

RELATED TOPICS OF Python Programming PROGRAMMING LANGUAGE




lxml 1.3.6 released

Hi all, lxml 1.3.6 is up on PyPI. This is a bug fix release for the stable 1.3 series. It features two important fixes for crash bugs. Updating is recommended. http://codespeak.net/lxml/ http://pypi.python.org/pypi/lxml/ ** Install it with $ easy_install lxml==1.3.6 ** What is lxml """ In short: lxml is the most feature-rich and easy-to-use library for working with XML and HTML in the Python language. lxml is a Pythonic binding for the libxml2 and libxslt libraries. It is unique in that it combines the speed and feature completeness of these libraries with the simplicity of a native Python API. """ Have fun, Stefan 1.3.6 (2007-10-29) ================== Bugs fixed ---------- * Backported decref crash fix from 2.0 * Well hidden free-while-in-use crash bug in ObjectPath Other changes ------------- * The test suites now run ``gc.collect()`` in the ``tearDown()`` methods. While this makes them take a lot longer to run, it also makes it easier to link a specific test to garbage collection problems that would otherwise appear in later tests.
VIEWS ON THIS POST

300

Posted on:

Monday 5th November 2012
View Replies!

com: makepy gencache.EnsureModule

, I' having a problem with gencache.EnsureModule: I used win32com\client\makepy.py to successfully generate Python sources. Unfortunately, after I call win32com.client.Dispatch(), the object I get back is of type "COMObject" instead of one of the generated classes. In particular, I'm trying to interact with SolidWorks Extensibility Type Library and the PROGID is "SldWorks.Application". Using win32com\client\makepy.py -i SolidWorks Extensibility Type Library {801A0000-A66C-11D3-A8BD-0000861EBBD6}, lcid=0, major=1, minor=0 >>> # Use these commands in Python code to auto generate .py support >>> from win32com.client import gencache >>> gencache.EnsureModule('{801A0000-A66C-11D3-A8BD-0000861EBBD6}', 0, 1, 0) Looking in win32com\gen-py, the appropriate file _does_ exist: 801A0000-A66C-11D3-A8BD-0000861EBBD6x0x1x0.py and it does contain the correct class definitions. Then, in my code: >>> mod = win32com.client.gencache.EnsureModule('{801A2001-A66C-11D3-A8BD-0000861EBBD6}', 0, 1, 0) >>> mod None >>> ob = win32com.client.Dispatch("SldWorks.Application") >>> ob Why are the object mod is None and the object ob is instead Any bright ideas as to what's going wrong here
VIEWS ON THIS POST

236

Posted on:

Monday 5th November 2012
View Replies!

Assertion in list comprehension

Does anyone know how to put an assertion in list comprehension I have the following list comprehension, but I want to use an assertion to check the contents of rec_stdl. I ended up using another loop which essentially duplicates the functions of list comprehension. It just look like a waste of coding and computer time to me. I just wish I could put the assertions into list comprehensions. x=[(rec_stdl[0].st/10000.0, rec_stdl[0].cl, rec_stdl[0].bb, rec_stdl[0].bo, rec_stdl[1].bb, rec_stdl[1].bo, rec_stdl[0].ex ) for rec_stdl in rec_by_ex if len(rec_stdl)==2 ] #duplicated loop if __debug__: for rec_stdl in rec_by_ex: l=len(rec_stdl) assert(l0) if l==2: assert(rec_stdl[0].c=="C" and rec_stdl[1].c=="P") assert(rec_stdl[0].ex==rec_stdl[1].ex) assert(rec_stdl[0].st==rec_stdl[1].st) assert(rec_stdl[0].cp==rec_stdl[1].cp)
VIEWS ON THIS POST

152

Posted on:

Monday 5th November 2012
View Replies!

Re: Parsing Help

En Tue, 10 Jul 2007 11:32:48 -0300, Robert Rawlins - Think Blue escribi: > I'm looking for some help building a function which can parse some XML > for > me using ElementTree. The document is of a very consistent format and > I've > copied an example of the document below. > Now, the piece of information I'm looking to retrieve is inside the > element and is, in this example value="0x05" > />, however I want the function to return the standard integer value and > not > the unit8 encoded version, so instead of my function returning '0x05' it > just needs to return '5' which is the standard integer version. Try this: def myFunction(xmlAsString): doc = ET.fromstring(xmlAsString) for att in doc.findall("attribute"): if att.get("id")=="0x0004": # obtain the second grandchildren whose tag="sequence" (begin its parent "sequence" too) seq = att.findall("sequence/sequence")[1] value = seq.find("uint8").get("value") if value[:2]=="0x": return int(value, 16) else: return int(value) Using lxml you could use XPath notation to simplify the navigation a little. -- Gabriel Genellina
VIEWS ON THIS POST

24

Posted on:

Monday 5th November 2012
View Replies!

How to check if file is in use?

Is there anyway in pythn to check whether a file is being used/written to by another process, e.g like the fuser command
VIEWS ON THIS POST

84

Posted on:

Monday 5th November 2012
View Replies!

fetching text from the screen

list, I'm thinking about a python script which fetch some text from the screen independent of what application provides the text on the screen. In this regard it should be similar to the babylon software: www.babylon.com Here my thoughts: 1) getting the mouse position 2) calculate a adequate rectangle around the mouse position 3) fetch the screen content in this rectangle 4) use a OCR library to get the text out of 3) 5) do something usefull with it. Has someone experiences with this task Is this a good roadmap or could someone think of a better way Which OCR library shoud I use Found tesseract-ocr (linux, windows) and simpleOCR (bad, only windows (activeX).
VIEWS ON THIS POST

106

Posted on:

Monday 5th November 2012
View Replies!

WSGI/wsgiref: modifying output on windows ?

On Jun 3, 10:11 pm, "tjoll...@g-NOSPAM-mail.com" wrote: > > > I am currently trying to port my web software AFoC > to Windows and have hit a strange problem: it seams that binary files > (PNG images in this case) get distorted by wsgiref. (I have tried both > the CGIHandler with both Xitami and Apache2 and WSGIServer). I have just realised that the WSGIServer works after all, I do not know why I thought it didn't.
VIEWS ON THIS POST

161

Posted on:

Monday 5th November 2012
View Replies!

itools 0.13.7 released

itools is a Python library, it groups a number of packages into a single meta-package for easier development and deployment: itools.catalog itools.i18n itools.uri itools.cms itools.ical itools.web itools.csv itools.resources itools.workflow itools.datatypes itools.rss itools.xhtml itools.gettext itools.schemas itools.xliff itools.handlers itools.stl itools.xml itools.html itools.tmx Changes: Catalog - Fix the "prof.py" script. CSV - Improved Index & Search API, by Hervé Cauwelier [#339]. Web - Fix the access log, flush the buffer on every line. - Support a non-standard HTTP Date format used by some browsers: '%A, %d %b %Y %H:%M:%S GMT'. CMS - Internationalize Epoz, by Hervé Cauwelier [#345]. - Fix Epoz for IE, by Hervé Cauwelier [#390]. Resources --------- Download http://download.ikaaro.org/itools/itools-0.13.7.tar.gz Home http://www.ikaaro.org/itools Mailing list http://mail.ikaaro.org/mailman/listinfo/itools Bug Tracker http://bugs.ikaaro.org -- J. David Ibáñez Itaapy Tel +33 (0)1 42 23 67 45 9 rue Darwin, 75018 Paris Fax +33 (0)1 53 28 27 88
VIEWS ON THIS POST

86

Posted on:

Monday 5th November 2012
View Replies!

IMPORTANT 2.5 API changes for C Extension Modules and Embedders

If you don't write or otherwise maintain Python Extension Modules written in C (or C++) or embed Python in your application, you can stop reading. Python 2.5 alpha 1 was released April 5, 2006. The second alpha should be released in a few weeks. There are several changes which can cause C extension modules or embedded applications to crash the interpreter if not fixed. Periodically, I will send out these reminders with updated information until 2.5 is released. * support for 64-bit sequences (eg, > 2GB strings) * memory allocation modifications 64-bit changes -------------- There are important changes that are in 2.5 to support 64-bit systems. The 64-bit changes can cause Python to crash if your module is not upgraded to support the changes. Python was changed internally to use 64-bit values on 64-bit machines for indices. If you've got a machine with more than 16 GB of RAM, it would be great if you can test Python with large (> 2GB) strings and other sequences. For more details about the Python 2.5 schedule: http://www.python.org/dev/peps/pep-0356/ For more details about the 64-bit change: http://www.python.org/dev/peps/pep-0353/ How to fix your module: http://www.python.org/dev/peps/pep-0...ion-guidelines The effbot wrote a program to check your code and find potential problems with the 64-bit APIs. http://svn.effbot.python-hosting.com.../ssizecheck.py Memory ocation Modifications ------------------------------- In previous versions of Python, it was possible to use different families of APIs (PyMem_* vs. PyObject_*) to allocate and free the same block of memory. APIs in these families include: PyMem_*: PyMem_Malloc, PyMem_Realloc, PyMem_Free, PyObject_*: PyObject_Malloc, PyObject_Realloc, PyObject_Free There are a few other APIs with similar names and also the macro variants. In 2.5, if allocate a block of memory with one family, you must reallocate or free with the same family. That means: If you allocate with PyMem_Malloc (or MALLOC), you must reallocate with PyMem_Realloc (or REALLOC) and free with PyMem_Free (or FREE). If you allocate with PyObject_Malloc (or MALLOC), you must reallocate with PyObject_Realloc (or REALLOC) and free with PyObject_Free (or FREE). Using inconsistent APIs can cause double frees or otherwise crash the interpreter. It is fine to mix and match functions or macros within the same family. Please test and upgrade your extension modules! Cheers, n
VIEWS ON THIS POST

107

Posted on:

Monday 5th November 2012
View Replies!

displaying my randomly selected numbers in a colorful interface.

dear all, i have arrays of number of size lets say 4000 i.e. 201000..2013999 now i want to do the following. first print all the numbers to a colorful console. be it wx, tk, or web based. then pick a winning number from the range which will now be printed at the center of the page. how can i achieve this goksie
VIEWS ON THIS POST

150

Posted on:

Wednesday 7th November 2012
View Replies!

What happened to _tkinter.so?

Python developers, I have noticed something curious while I was investigating a problem with the PyInstaller. In my environment, the PyInstaller couldn't find TCL/TK installation path even I have it. I found the PyInstaller uses output from ldd to find the a path to TCL/TK libraries. But no dynamic libraries under my Python 5 lib-dynload directoty contain a path to TCL/TK libraries. When I posted this problem to the PyInstaller newsgroup, a guy responded that he didn't have such problem. After several exchanges, what we found was his lib-dynload directory contains _tkinter.so (even he has the same Python2.5.2) while my lib- dynload directory doesn't have it. He installed the Python using package tool (no fresh compile) while I installed my Python from src (clean compile). I recompiled Python 2.4 and confirmed that Python 2.4 creates _tkinter.so. After browsing the Makefile under Python 2.5, I had an impression that Python 2.5 no longer uses _tkinter.so. Am I correct If that is the case, I need to warn the PyInstaller developers that the scheme to find TCL/TK path is no longer valid. Any comments will be highly appreciated. Thank you for your attention. Aki Niimura
VIEWS ON THIS POST

108

Posted on:

Wednesday 7th November 2012
View Replies!

Re: Python on iPhone actually rather good

On Nov 4, 2008, at 10:33 AM, Michael Torrie wrote: > Are there any good books on python and objc I doubt you'll be able > to > make any decent iPhone apps without having a good working knowledge of > Objective C and the python-objc bridge. In my mind that's one of the > cool parts of doing cocoa development in python, but also the biggest > curse of cocoa. I've found "Cocoa Programming for Mac OS X", in combination with the PyObjC tutorials on the web, to be a very accessible combination. I've gone about halfway through the book, just translating the tutorials from ObjC to PyObjC as I go, and it's worked out fine. When I need help, I post to the pythonmac-sig list, which is a friendly and helpful bunch. (I would think that iPhone development would be welcome there as well, since the iPhone is more or less a tiny Mac, at least from a development point of view). Best, - Joe
VIEWS ON THIS POST

79

Posted on:

Wednesday 7th November 2012
View Replies!

cx_Oracle 4.4.1

What is cx_Oracle cx_Oracle is a Python extension module that allows access to Oracle and conforms to the Python database API 2.0 specifications with a few exceptions. Where do I get it http://cx-oracle.sourceforge.net What's new 1) Make the bind variables and fetch variables accessible although they need to be treated carefully since they are used internally; support added for forward compatibility with version 5.x. 2) Include the "cannot insert null value" in the list of errors that are treated as integrity errors as requested by Matt Boersma. 3) Use a cx_Oracle.Error instance rather than a string to hold the error when truncation (ORA-1406) takes place as requested by Helge Tesdal. 4) Added support for fixed char, old style varchar and timestamp attribute values in objects. 5) Tweaked setup.py to check for the Oracle version up front rather than during the build in order to produce more meaningful errors and simplify the code. 6) In setup.py added proper detection for the instant client on Mac OS X as recommended by Martijn Pieters. 7) In setup.py, avoided resetting the extraLinkArgs on Mac OS X as doing so prevents simple modification where deed as expressed by Christian Zagrodnick. 8) Added documentation on exception handling as requested by Andreas Mock, who also graciously provided an initial patch. 9) Modified documentation indicating that the password attribute on connection objects can be written. 10) Added documentation warning that parameters not passed in during subsequent executions of a statement will retain their original values as requested by Harald Armin Massa. 11) Added comments indicating that an Oracle client is required since so many people find this surprising. 12) Removed all references to Oracle 8i from the documentation and version 5.x will eliminate all vestiges of support for this version of the Oracle client. 13) Added additional link arguments for Cygwin as requested by Rob Gillen. Anthony Tuininga
VIEWS ON THIS POST

25

Posted on:

Wednesday 7th November 2012
View Replies!

RELEASED Python 2.6 final

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On behalf of the Python development team and the Python community, I am happy to announce the release of Python 2.6 final. This is the production-ready version of the latest in the Python 2 series. There are many new features and modules, improvements, bug fixes, and other changes in Python 2.6. Please see the "What's new" page for details http://docs.python.org/dev/whatsnew/2.6.html as well as PEP 361 http://www.python.org/dev/peps/pep-0361/ While Python 2.6 is backward compatible with earlier versions of Python, 2.6 has many tools and features that will help you migrate to Python 3. Wherever possible, Python 3.0 features have been added without affecting existing code. In other cases, the new features can be enabled through the use of __future__ imports and command line switches. Python 3.0 is currently in release candidate and will be available later this year. Both Python 2 and Python 3 will be supported for the foreseeable future. Source tarballs, Windows installers, and Mac disk images can be downloaded from the Python 2.6 page: http://www.python.org/download/releases/2.6/ (Please note that due to quirks in the earth's time zones, the Windows installers will be available shortly.) Bugs can be reported in the Python bug tracker: http://bugs.python.org Enjoy, - -Barry Barry Warsaw barry@python.org Python 2.6/3.0 Release Manager (on behalf of the entire python-dev team) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Darwin) iQCVAwUBSOREJ3EjvBPtnXfVAQLAigP/aEnrdvAqk7wbNQLFbmBonIr2YQbd1vEu TyTr5imYXFWGNfv1/JMeMBjMfwpHi1bgPEDTLEZdhDRNj/G1h4NqqnpfJS0lfIaU 4JBKwnsO80se/RGyupcs5f09UdKxOljhbFKEw46CHDkd9lE+cqy2yhetEwyx3c3+ AVC11sjcO54= =Oxo3 -----END PGP SIGNATURE----- , On Thu, Oct 2, 2008 at 11:23 AM, wrote: > > nneonneo> Hmm, I was looking forward to trying this out, but the Windows > nneonneo> installer link > nneonneo> (http://www.python.org/ftp/python/2.6/python-2.6.msi) is > nneonneo> presently broken (as is the link for the 64-bit Windows > nneonneo> version). > > We are aware of it. Because of the timing of the release the person who > normally creates the Windows binaries was already asleep. They should be up > a bit later today. > Surely you're joking! Everybody knows that python developers never sleep :-) Congratulations for the final release! Francesco
VIEWS ON THIS POST

46

Posted on:

Wednesday 7th November 2012
View Replies!

Re: [Tkinter-discuss] (newbie) can't invoke button for twice

On Sat, Sep 20, 2008 at 4:10 PM, dmitrey wrote: > > , > I have the problem: > a func has been binded to a Button: > > RunPause = Button(root, textvariable = t, command = lambda: > invokeRunPause(p)) > > def invokeRunPause(p): > if p.state == 'init': > p.state = 'running' > t.set(' Pause ') > p.GUI_root.update_idletasks() > p.tmp_result = p.solve(*p._args, **p._kwargs) > > elif p.state == 'running': > .... > So the problem is that I can't invoke the button RunPause till my > calculations (in p.solve()) will be finished. I can observe it even > graphically, the button doesn't respond when it is pressed. > Could anyone provide a solution It is not only the button that doesn't respond, the entire application won't respond if you are blocking tcl from processing anything. This call to p.solve blocks, and, in turn the interpreter can't process events and the GUI remains frozen till p.solve returns. Ideally you should break this p.solve in steps, so you can schedule next steps and the GUI will remain responsible, but if you can't break it, and if it doesn't make sense to run it in another process then you use a thread to solve this. > > Thank you ion advance, Dmitrey. > -- > View this message in context: http://www.nabble.com/%28newbie%29-c...p19588292.html > Sent from the Python - tkinter-discuss mailing list archive at Nabble.com. > > _______________________________________________ > Tkinter-discuss mailing list > Tkinter-discuss@python.org > http://mail.python.org/mailman/listinfo/tkinter-discuss > -- -- Guilherme H. Polo Goncalves
VIEWS ON THIS POST

116

Posted on:

Wednesday 7th November 2012
View Replies!

Re: Trying ZODB, background in Relational: mimic auto_increment?

On Thu, 14 Aug 2008 16:41:57 +0200, Thomas Guettler wrote: >auto increment: >>Here's one way >> >> class Sequence(Persistence): >> def __init__(self): >> self.current = 0 >> >> def next(self): >> self.current += 1 >> return self.current >> >> ticketSequence = Sequence() >> >> class Ticket(Persistence): >> def __init__(self): >> self.id = ticketSequence.next() > >I am sorry, but this does not work if several threads or processes >try to get a new id. > >Have a look at: >http://www.zope.org/Documentation/Bo...ersistence.stx >"Resolving Conflicts". > >BTW, that's one of the points why I switched from ZODB to Postgres. > I'm not sure why you say it doesn't work and then link to the documentation which both explains why it works and how to handle the cases where a conflict might cause it to sometimes not work (retry or manually resolve). PostgreSQL is great and makes sequences easier than ZODB does (at least as far as I can tell), but it's hardly _impossible_ to have a working sequence in ZODB, and it's not even difficult, it's just not trivial. Jean-Paul
VIEWS ON THIS POST

130

Posted on:

Wednesday 7th November 2012
View Replies!

Re: How to use win32com to convert a MS WORD doc to HTML ?

Lave wrote: > all ! > > I'm a totally newbie huh > > I want to convert MS WORD docs to HTML, I found python windows > extension win32com can make this. But I can't find the method, and I > can't find any document helpful. You have broadly two approaches here, both involving automating Word (ie using the COM object model it exposes, referred to in another post in this thread). 1) Use the COM model to have Word load your doc, and SaveAs it in HTML format. Advantage: it's relatively straightforward. Disadvantage: you're at the mercy of whatever HTML Word emits. 2) Use the COM model to iterate over the paragraphs in your document, emitting your own HTML. Advantage: you get control. Disadvantage: the more complex your doc, the more work you have to do. (What do you do with images, for example Internal links) To do the first, just record a macro in Word to do what you want and then reproduce the macro in Python. Something like this: import win32com.client doc = win32com.client.GetObject ("c:/data/temp/songs.doc") doc.SaveAs (FileName="c:/data/temp/songs.html", FileFormat=8) doc.Close () To do the second, you have to roll your own html doc. Crudely, this would do it: import codecs import win32com.client doc = win32com.client.GetObject ("c:/data/temp/songs.doc") with codecs.open ("c:/data/temp/s2.html", "w", encoding="utf8") as f: f.write ("") for para in doc.Paragraphs: text = para.Range.Text style = para.Style.NameLocal f.write ('%(text)s\n' % locals ()) doc.Close () TJG
VIEWS ON THIS POST

85

Posted on:

Wednesday 7th November 2012
View Replies!

Open a file within an ISO in python.

Is there a way to open a file that is inside of an ISO in python Say I have an ISO file, danikars.iso and on the iso there is a file called information.txt I want to be able to do something like this. Code: iso_h = openiso("danikars.iso") file_h = iso_h.extract("information.txt") contents = file_h.read() Is there anything that will give me that functionality Or close
VIEWS ON THIS POST

66

Posted on:

Wednesday 7th November 2012
View Replies!

cat6 patch cables

cat6 patch cables http://cracks.12w.net F R E E C R A C K S
VIEWS ON THIS POST

42

Posted on:

Wednesday 7th November 2012
View Replies!

Re: Another MySQL Images Question

There are several problems with your SQL, but not all of them would be caught by the computer. Your SELECT statement is not parameterized. This is a security problem. *Always* parameterize your variables. Your UPDATE statement has an extraneous comma at the end, and it also has quotes around the "%s"es that you don't need, because you already parameterized that query. Your dbapi interface will provide appropriate quoting for whatever type of data you pass it. Cheers, Cliff On Fri, 2008-04-18 at 10:13 -0500, Victor Subervi wrote: > Hi; > If I grab an image in the database thus: > > sql = "select pic1 from products where id='" + str(id) + "';" > cursor.execute(sql) > pic1 = cursor.fetchall()[0][0].tostring() > # pic1 = cursor.fetchall()[0][0] // either this or the above > line > > and try and re-insert it thus: > > cursor.execute('update products set pic1="%s" where id="%s", ;', > (pic1, id)) > > it tells me I have an error in my MySQL syntax. What is the error > TIA, > Victor -- Oook, J. Cliff Dyer Carolina Digital Library and Archives UNC Chapel Hill
VIEWS ON THIS POST

24

Posted on:

Wednesday 7th November 2012
View Replies!

csv dictreader

I am trying to use the dictionary reader to import the data from a csv file and create a dictnary from it but just can't seem to figure it out. Here is my code: >>>import csv >>>reader = csv.DictReader(open('table.csv')) >>>for row in reader: >>>print row my csv files looks like this: Bytecode,Element \x00\x00,0000 \x01\x00,0001 ..... \x09\x00,0009 My output shows: {'Bytecode': '\\x00\\x00', 'Element': '0000'} {'Bytecode': '\\x01\\x00', 'Element': '0001'} .... {'Bytecode': '\\x09\\x00', 'Element': '0009'} 1. how can I get access to this directory 2. why does the values come with two backslashs infront of the "x"
VIEWS ON THIS POST

139

Posted on:

Wednesday 7th November 2012
View Replies!

Re: Making string-formatting smarter by handling generators?

En Wed, 27 Feb 2008 20:40:04 -0200, Tim Chase escribi: >>> Note that your problem has nothing to do with map itself. >>> String interpolation using % requires either many individual >>> arguments, or a single *tuple* argument. A list is printed >>> as itself. > > Just as an exercise to understand this better, I've been trying > to figure out what allows for this interpolation. It doesn't > seem to be via duck-typing: > > >>> # what does a tuple have that a list doesn't > >>> tuple_set = set(dir(tuple())) > >>> list_set = set(dir(list())) > >>> tuple_set - list_set > set(['__getnewargs__']) > > class LikeATuple(list): > def __getnewargs__(self, *args, **kwargs): > pass # now have everything dir(tuple()) has > f = LikeATuple((1,2,3)) > print "%s, %s, %s" % f > > However, if I create a class that derives from a tuple(), it > seems to work fine: > > class MyTuple(tuple): > pass > f = MyTuple((1,2,3)) > print "%i, %i, %i" % f > > it works fine. Is there some secret attribute that I'm missing Yes: the class itself The code checks whether the right argument is a tuple (or subclass of), or a generic mapping. Checking *only* for tuples allows one to usually write "%s" % thing, and only bother to write "%s" % (thing,) when such `thing` could actually be a tuple. Mappings don't have that problem, because the left operand must be written in a different form so Python knows when to treat the right operand as a mapping. See my previous response to Steven D'Aprano. -- Gabriel Genellina
VIEWS ON THIS POST

101

Posted on:

Wednesday 7th November 2012
View Replies!

Re: Newbie question: Classes

> Basically, I have created a program using tkinter without using any class > structure, simply creating widgets and functions (and finding ways around > passing variables from function to function, using global variables etc). > The program has become rather large ( lines) I am trying to now put it into > a class structure, because I hear it is easier to handle. > > So basically, I put all the stuff into a class, making the widgets in the > "def __init__(self, root)" (root being my Tk() ) and then I have had to put > a "self." in front of any instance of any variable or widget. Is this right > it seems like nothing is any easier (except having variables locally). Is > this right Should I be creating more classes for different things or what Use the method that works best for you. If you like the procedural approach more then don't worry about being object oriented. The good thing is that python is multi-paradigm so if custom objects don't make your life easier then just forget about them
VIEWS ON THIS POST

74

Posted on:

Wednesday 7th November 2012
View Replies!

Elixir 0.5.0 released!

I am very pleased to announce that version 0.5.0 of Elixir (http://elixir.ematia.de) is now available. As always, feedback is very welcome, preferably on Elixir mailing list. This is mostly a bug fixes release, but we have also had some pretty important changes to the default values for options. Please look at http://elixir.ematia.de/trac/wiki/Migrate04to05 for detailed upgrade notes. The full list of changes can be seen at: http://elixir.ematia.de/trac/browser.../0.5.0/CHANGES What is Elixir --------------------- Elixir is a declarative layer on top of the SQLAlchemy library. It is a fairly thin wrapper, which provides the ability to create simple Python classes that map directly to relational database tables (this pattern is often referred to as the Active Record design pattern), providing many of the benefits of traditional databases without losing the convenience of Python objects. Elixir is intended to replace the ActiveMapper SQLAlchemy extension, and the TurboEntity project but does not intend to replace SQLAlchemy's core features, and instead focuses on providing a simpler syntax for defining model objects when you do not need the full expressiveness of SQLAlchemy's manual mapper definitions. Mailing list ---------------- http://groups.google.com/group/sqlelixir/about -- Gatan de Menten http://openhex.org
VIEWS ON THIS POST

140

Posted on:

Wednesday 7th November 2012
View Replies!

RE: howto kill a windows process by name ?

Take a look at "killProcName.py", in the win32 extension package. - Adam > -----Original Message----- > From: python-list-bounces+adam=volition-inc.com@python.org > [mailtoython-list-bounces+adam=volition-inc.com@python.org] On Behalf > Of stef mientki > Sent: Friday, October 05, 2007 4:40 PM > To: python-list@python.org > Subject: howto kill a windows process by name > > hello, > > is there a library to kill a windows process by name > >
VIEWS ON THIS POST

162

Posted on:

Wednesday 7th November 2012
View Replies!

a question about decorator

Hi: please look at this code. def A(): print 'warp in A' def why(self, *arg, **kw): print 'in A' print self print arg print kw #self(*arg, **kw) return why class T(object): @A() def test(g, out): print 'in test', out it will out put: warp in A in A () {} the function why will be called, why there is no code to call it. Kyo.
VIEWS ON THIS POST

230

Posted on:

Wednesday 7th November 2012
View Replies!

Using Python with SciTE editor

, I have a problem running Python programs from within SciTE, under Linux --- the input( ) function fails with "IOError: [Errno 9] Bad file descriptor" The same program will run happily in SciTE, under Windows --- gets the input, goes off and calculates wondrous things --- but somehow, in Linux, I'm not set up right. This is true using Fedora Core, and Kunbuntu (KDE in both cases, if that matters). I'm guessing that I need to fix one of my ".properties" configuration files, but I have no idea what to fix. Please help - please, please, pleasepleasePleasePLEASEPLEASE -bob,mon! p.s. I know I've seen this delat with somewhere, but I can't find it.
VIEWS ON THIS POST

88

Posted on:

Wednesday 7th November 2012
View Replies!

Trying to find zip codes/rest example

, A couple months ago there was an example posted in a blog of a rest interface for validating zip codes. If I recall correctly, the backend validator was written in python. The validator demo page had a single text input; next to the text input would appear either a green check or a red X depending on whether the zip code was valid. On the backend, the explanation of the demo included a discussion of using HTTP status codes (200 for a valid zip, 406 for invalid) so that the service could be used from a console as well. I now cannot find this demo and the associated discussion. Does anybody remember this demo and where I might be able to find it
VIEWS ON THIS POST

177

Posted on:

Wednesday 7th November 2012
View Replies!

Cross compiling 2.5.1

I was wondering if anyone could help me with cross-compiling Python 2.5.1 to a MIPS target. The approach I'm using is based off the suggestion in the README file that comes with the python source distribution. I managed to get the configure script to run using the following command line: $ ../Python-2.5.1/configure --host=mips-linux --enable-shared Next I run make and it builds the python interpreter and shared library. However, it then attempts to run the interpreter to complete the rest of the build process, and that of coarse fails. I read several posts on the internet from people who applied patches to the python source to enable cross-compling, but my impression was that 2.5.1 had merged some of this work. Can anyone give me some suggestions on how I get the makery to use the build interpreter instead of the host interpreter to complete the build process
VIEWS ON THIS POST

66

Posted on:

Wednesday 7th November 2012
View Replies!

desperately in need of a tool

Hi. I recently started working for a company that has just implemented its first set of software standards. So far, so good. Here's the problem: one of those standards is that the comments for each routine must indicate every other routine that it calls. As I try to keep my routines small, and factor out methods alot, this can lead to an enormous ammount of extra typing. I really, really, really don't want to do this by hand. Does anyone know of a tool that could do this for me, or at least a tool that can tell what other routines a given routine calls that I could program against (Preferably something that works under pydev, but I'm not going to be choosy.) I'm sure some will wonder about the reasoning of this standard. The company primarily has experience writing scientific alogorythms which can get rather long. It makes a bit more sense to document all routines called for a very long routine, but for short routines that primarily call other routines, as most mine do, well....
VIEWS ON THIS POST

85

Posted on:

Wednesday 7th November 2012
View Replies!

Re: removing items from a dictionary ?

Stef Mientki wrote in news:46A8EFF5.4060600@mailbox.kun.nl: > hello, > > I want to remove some items from a dictionary, > so I would expect this should work: > > Nets = {} > ... fill the dictionary Nets > > for net in Nets: > if net.upper() in Eagle_Power_Nets : > del Nets [ net ] > > > But it gives me > Message File Name Line Position > Traceback > D:\data_to_test\JALsPy\Eagle_import.py 380 > RuntimeError: dictionary changed size during iteration > > > [snip...] > > > thanks, > Stef Mientki I think that you need to find a different iteration condition. Using for n in dict will iterate using an iterator which doesn't support "parallel" deletions. bests, ../alex -- ..w( the_mindstorm )p.
VIEWS ON THIS POST

296

Posted on:

Wednesday 7th November 2012
View Replies!

Re: Color Segmentation w/ PIL?

I don't know of any in Python, but an open source image processing package in Java has been developed at Stanford University - http://www.gemident.net GemIdent . GemIdent was originally designed to segment cells from miscroscopic images and, more generally, can identify objects of interest and do color image segmentation. Maybe some of the code can I apply to your project and you can bridge the gap using Jython. Adam MooMaster wrote: > > I'm trying to write a Digital Image Processing program using the PIL > library, and upon consultation of the Handbook I see that it seems to > have built in functions to run Edge Detection (in the ImageFilter > module), but I don't see anything about Segmentation. Are there any > built-in tools to do this operation Has anyone done this operation > with PIL in the past that can lead me in the right direction > > -- > http://mail.python.org/mailman/listinfo/python-list > > -- View this message in context: http://www.nabble.com/Color-Segmenta...html#a10822775 Sent from the Python - python-list mailing list archive at Nabble.com.
VIEWS ON THIS POST

38

Posted on:

Wednesday 7th November 2012
View Replies!

[ANN] Python Akismet 0.1.5

`Python Akismet 0.1.5 `_ is now available. Fixed a typo/bug in ``submit_ham``.
VIEWS ON THIS POST

27

Posted on:

Wednesday 7th November 2012
View Replies!

ANN: pep8.py 0.2.0 - Python style guide checker

Announcing the first public release of pep8.py, a tool to check your Python code against some of the style conventions in `PEP 8`_. ... _PEP 8: http://www.python.org/dev/peps/pep-0008/ Features -------- * Plugin architecture: Adding new checks is easy. * Parseable output: Jump to error location in your editor. * Small: Just one Python file, requires only stdlib. Download -------- The file pep8.py (and a regression test suite) is available from the Browsershots subversion repository, under the Expat license: http://svn.browsershots.org/trunk/devtools/pep8/ You can look at the source code and change history online: http://trac.browsershots.org/browser...s/pep8/pep8.py Example usage and output ------------------------ :: $ pep8.py optparse.py optparse.py:69:11: E401 multiple imports on one line optparse.py:77:1: E302 expected 2 blank lines, found 1 optparse.py:88:5: E301 expected 1 blank line, found 0 optparse.py:222:34: W602 deprecated form of raising exception optparse.py:347:31: E211 whitespace before '(' optparse.py:357:17: E201 whitespace after '{' optparse.py:472:29: E221 multiple spaces before operator optparse.py:544:21: W601 .has_key() is deprecated, use 'in' You can also make pep8.py show the source code for each error, and even the relevant text from PEP 8:: $ pep8.py --show-source --show-pep8 testsuite/E111.py testsuite/E111.py:2:3: E111 indentation is not a multiple of four print x ^ Use 4 spaces per indentation level. For really old code that you don't want to mess up, you can continue to use 8-space tabs. Or you can display how often each error was found:: $ pep8.py --statistics -qq --filename=*.py Python-2.5/Lib 232 E201 whitespace after '[' 599 E202 whitespace before ')' 631 E203 whitespace before ',' 842 E211 whitespace before '(' 2531 E221 multiple spaces before operator 4473 E301 expected 1 blank line, found 0 4006 E302 expected 2 blank lines, found 1 165 E303 too many blank lines (4) 325 E401 multiple imports on one line 3615 E501 line too long (82 characters) 612 W601 .has_key() is deprecated, use 'in' 1188 W602 deprecated form of raising exception Quick help is available on the command line:: $ pep8.py -h usage: pep8.py [options] input ... options: -h, --help show this help message and exit -v, --verbose print status messages, or debug with -vv -q, --quiet report only file names, or nothing with -qq --exclude=patterns skip matches (default .svn,CVS,*.pyc,*.pyo) --filename=patterns only check matching files (e.g. *.py) --ignore=errors skip errors and warnings (e.g. E4,W) --repeat show all occurrences of the same error --show-source show source code for each error --show-pep8 show text of PEP 8 for each error --statistics count errors and warnings --benchmark measure processing speed --testsuite=dir run regression tests from dir --doctest run doctest on myself Feedback -------- Your feedback is more than welcome. Write email to johann@browsershots.org or post bugs and feature requests here: http://trac.browsershots.org/newtick...onent=devtools
VIEWS ON THIS POST

131

Posted on:

Wednesday 7th November 2012
View Replies!

EuroPython 2007: Call for Proposals

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 ...
VIEWS ON THIS POST

39

Posted on:

Saturday 10th November 2012
View Replies!

SWIG (Python) - "no constructor defined" for concrete class

Yet another SWIG question (YASQ!). I'm having a problem with using an abstract base class. When generating the Python bindings, SWIG thinks that all the concrete classes that derive from this abstract class are abstract too and won't create the ...
VIEWS ON THIS POST

102

Posted on:

Saturday 10th November 2012
View Replies!

ANN: python-ldap-2.2.0

Find a new release of python-ldap: http://python-ldap.sourceforge.net/ python-ldap provides an object-oriented API to access LDAP directory servers from Python programs. It mainly wraps the OpenLDAP 2.x libs for that purpose. Additionally it contains modules for other LDAP-related stuff (e.g. processing ...
VIEWS ON THIS POST

80

Posted on:

Saturday 10th November 2012
View Replies!

Python to C/C++

(sorry michael, didn't mean to personal post On Wed, Mar 19, 2008 at 9:24 AM, Michael Wieher wrote: > I think py2exe does this, but it might be a bit bloated No, py2exe basically bundles the main script and the ...
VIEWS ON THIS POST

38

Posted on:

Saturday 10th November 2012
View Replies!

Parsing links within a html file.

, I have a html file over here by the name guide_ind.html and it contains links to other html files like guides.html#outline . How do I point BeautifulSoup (I want to use this module) to guides.html#outline
VIEWS ON THIS POST

36

Posted on:

Saturday 10th November 2012
View Replies!

Re: Learning Python via a little word frequency program

Andrew Savige wrote: > Here's my first attempt: > > names = "freddy fred bill jock kevin andrew kevin kevin jock" > freq = {} > for name in names.split(): > freq[name] = 1 + freq.get(name, 0) > deco = ...
VIEWS ON THIS POST

94

Posted on:

Saturday 10th November 2012
View Replies!

ide for shedskin python to c compiler

I have a beta ide that I stold for shed skin and bcx basic available. currently it is set up to compile just from one directory.. It is available http://dexrow.blogspot.com/2008/01/b...cr-editor.html It could use a much better script and I would ...
VIEWS ON THIS POST

202

Posted on:

Saturday 10th November 2012
View Replies!

File names are changed into capital letter in Python CE and WM5

Yesterday, I installed PythonCE on my cellphone whose OS is Windows Mobile 5.I wanted to use numpy as calculation tool.But after I copy numpy module in my desktop computer into my phone,I find many file names in directory \numpy were ...
VIEWS ON THIS POST

126

Posted on:

Saturday 10th November 2012
View Replies!

Python AST preserving whitespace and comments

I'm working on Pythoscope[1], a unit test generator for Python and stumbled into the following problem. I need a way to ****yze and modify Python AST tree, but without loosing source code formatting and comments. Standard library ast module ...
VIEWS ON THIS POST

106

Posted on:

Sunday 11th November 2012
View Replies!

Re: Embedding Python

, In the meantime I managed to work out another solution, mainly thanks to reading the source code of some OSS projects. I post it here so somebody else looking for solution to this problem had the example available: ...
VIEWS ON THIS POST

25

Posted on:

Sunday 11th November 2012
View Replies!

small problem with re.sub

I have a html text stored as a string. Now I want to go through this string and find all 6 digit numbers and make links from them. Im using re.sub and for some reason its not picking up ...
VIEWS ON THIS POST

75

Posted on:

Sunday 11th November 2012
View Replies!

__init__ method for containers

List and deque disagree on what __init__ does. Which one is right Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from collections import deque ...
VIEWS ON THIS POST

49

Posted on:

Monday 12th November 2012
View Replies!

optparse escaping control characters

optparse seems to be escaping control characters that I pass as arguments on the command line. Is this a bug Am I missing something Can this be prevented, or worked around This behaviour doesn't occur with non-control characters. For example, ...
VIEWS ON THIS POST

60

Posted on:

Sunday 25th November 2012
View Replies!

graphical ide??

, I am just getting started in Python with the intention of tweaking an opensource wxPython project called Brewsta. I've been reading python documentation and the code, and its starting to make sense, but there seems to be an awful ...
VIEWS ON THIS POST

38

Posted on:

Sunday 25th November 2012
View Replies!

Re: Why Don't Return?

def a(): d = b() print d def b() c = "Hi" return c if __name__ == "__main__": a() Cheers TG On Dec 3, 2007, at 3:05 PM, Victor Subervi wrote: > Hi; > Here is sample function: > > ...
VIEWS ON THIS POST

26

Posted on:

Monday 26th November 2012
View Replies!

The Manly Task of Programming

In thread http://www.programmingforums.org/for...ad.phpt=10046 it was pointed out that professional programmers are mostly men. Can anybody give a good reason why that is so Does it come from the days when computers were huge ungainly machines taking up a wole basement Programming was done with punch-cards that could weigh hundreds of pounds for large programs Then there was the weight of stacks of tapes and disk platters Well, these were a few questions my dad brought up. On the lighter side of things, can you write a Python program to figure out if the author of a thread is male or female
VIEWS ON THIS POST

55

Posted on:

Wednesday 28th November 2012
View Replies!