Manuel 1.6.0 released - now compatible with Python 3
Ever wished you could test your documentation just like you test your code? Like doctest but wish it was just a little better/different? Manuel lets you test your documentation and build your own test formats. Full info at http://packages.python.org/manuel/. Download from http://pypi.python.org/pypi/manuel. -- Benji York -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Re: eggs considered harmful
On Jun 21, 8:10 am, Harry George [EMAIL PROTECTED] wrote: [snip description of unacceptable behaviors] These are unacceptable behaviors. I am therefore dropping ZODB3 If you have bugs to report against ZODB, I sugest posting to zodb-dev (http://mail.zope.org/mailman/listinfo/zodb-dev). -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: a good programming text editor (not IDE)
BartlebyScrivener wrote: Emacs must be dying if this thread could get all the way to 20 with nobody arguing with the vi folks. heh :) Will the Windows vim and gvim users vouch for its stability on Windows? It's very stable on Windows. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: groupby is brilliant!
Frank Millman wrote: reader = csv.reader(open('trans.csv', 'rb')) rows = [] for row in reader: rows.append(row) Why do you create a list of rows instead of just iterating over the reader directly? -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Process forking on Windows - or what is MQSeries
Andrew Robert wrote: In this situation, it is possible for a process(my python program) to monopolize and block other processes from being triggered. Ideally, this needs to be avoided through the use of a fork. Another option would be to write the incoming messages to your own queue (an on-disk directory perhaps) and have the triggered program return after doing that. Then you can have a separate, long-running program process the messages. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Progamming python without a keyboard
Eric S. Johansson wrote: So if you want to make a serious difference in people's lives from your keyboard, you can help out in two ways. ... Second is working with probably myself and a couple of other folks in gnome at-spi land building a bridge between speech recognition on Windows and complete control of the environment on Linux. I'm interested in what you mean here. My interpretation is that you want to/are building a system to interact with a Linux desktop from a Windows box leveraging the voice recognition built into Windows. Is this right? -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Active Directory Authentication
D wrote: Is it possible to have Python authenticate with Active Directory? Specifically what I'd like to do is have a user enter a username/password, then have Python check the credentials with AD - if what they entered is valid, for example, it returns a 1, otherwise a 0.. Thanks! Install the Win32 extensions from http://starship.python.net/crew/skippy/win32/Downloads.html and do something like this: try: handle=win32security.LogonUser(username, None, password, win32security.LOGON32_LOGON_NETWORK, win32security.LOGON32_PROVIDER_DEFAULT) # We're not going to use the handle, just seeing if we can get it. handle.Close() return True except pywintypes.error, e: # Because of the sheer number of Windows-specific errors that can # occur here, we have to assume any of them mean that the # credentials were not valid. return False -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: unittest.main-workalike that runs doctests too?
John J. Lee wrote: ...I wrote something to do this once, but didn't do as good a job as I might have done and wondered if anybody else has done it properly. The Zope 3 project has zope.testing which has a very nice test runner (and isn't Zope-specific at all). You can get the code (via Subversion) at svn://svn.zope.org/repos/main/zope.testing/trunk and browse the code (including docs) at http://svn.zope.org/zope.testing/trunk/. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: unittest.main-workalike that runs doctests too?
John J Lee wrote: Is there a page that describes the Zope SVN layout? Not that I know of. It basically goes like this: if it's not a top-level project (like zope.testing), it's either in Zope (for Zope 2 stuff) or Zope3 (for Zope 3 stuff). -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Python SSL
James Stroud wrote: I have been trying to make an https client with python You probably don't want to use the standard library for HTTPS; here's a quote from the socket module docs about SSL: Warning: This does not do any certificate verification! I'd recommend M2Crypto instead: http://wiki.osafoundation.org/bin/view/Projects/MeTooCrypto -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Zope 3
bruno at modulix wrote: Zope is a world in itself - and is certainly not the simplest tool to learn (nor the most pythonic). Those statements apply more to Zope 2 than Zope 3 (and Zope 2 is moving more and more toward Zope 3 these days). One of Zope 3's main goals was to focus on the Python programmer as a primary target. That being said there /are/ some powerful and novel concepts used in Z3 (the component framework). You may want to consider other options like Django, Pylon or Turbogears. It's true that Z3 is not currently focused very well on the middle-class developer. It's more of an industrial-strength kind of thing, but considerable thought has been given lately on how to build bridges so everyone can benefit without being full-time Zope masters. Toward that end, I wrote a little quick start guide that might help the OP: http://www.benjiyork.com/quick_start -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Missing interfaces in Python...
Jonathan Daugherty wrote: # Thanks for the responses...Looks like I might have opened Pandora's # box here. Could I accomplish the above with an abstract class? Zope 3 has an interface system which is good. I recommend you look at that. Zope 3's interface system is quite good, but it's also quite different from what he's probably expecting. On the up side, it's probably much better than what he's expecting too. :) -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Very stupid question.
On 3/30/06, *Sullivan Zheng* [EMAIL PROTECTED] wrote: Wow, seems I am not that supid. Why python does not include this function in the file object. It is almost a tradition in other languages... really not elegant or OO. A file isn't an object. You can get a file object by opening a file (on disk), but it doesn't make much sense to have to open a file just to see how big it is. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: a hobbyist's dilemma
John Salerno wrote: Now that I've learned much of Python, I'm sort of stuck with what to do with it. http://www.pythonchallenge.com/ You can (thank|curse) me later. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Difference between 'is' and '=='
mwql wrote: It's really strange, if a = 1 b = 1 a is b == True the same thing applies for strings Not quite: 'abc' is 'abc' True 'abc' is 'ab' + 'c' False -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: doctest, unittest, or if __name__='__main__'
Terry Hancock wrote: When you get into stickier stuff like graphics and web programming, the formal structure of pyunit can be easier to adapt than something which is intrinsically based on string processing. As pointed out earlier in this thread, Zope 3 has embraced doctests in a big way (and they've paid off in a big way too). Obviously we test lots of web apps and had to come up with something to allow us to do decent doctests of them. Unsurprisingly it's documented with a doctest: http://svn.zope.org/*checkout*/Zope3/trunk/src/zope/testbrowser/README.txt -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Have you ever considered of mousing ambidextrously?
Aahz wrote: Heh. When possible, my work situation includes two computers, each with their own keyboard and mouse. To put the keyboards as close together as possible, the mice go on the outside. I prefer a similar setup with 2 duel monitor PCs (one Linux, one Windows), but use x2vnc to control both with one keyboard and mouse. Unfortunately neither x2vnc or Synergy really fulfill my needs though, so I'm working on a replacement. Actually I'm writing this email instead of working on it, back to the (Vim) mines. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Localized month names?
Jarek Zgoda wrote: How do I get a list of localized month names for current locale? The first thing that came to my mind was an ugly hack: import locale locale.nl_langinfo(locale.MON_1) 'January' -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: why no block comments in Python?
Terry Hancock wrote: I'm thinking this might be a use-case for the new support for doctests in a separate file. Having doctests in their own file is (IMHO) a majorly under appreciated feature of doctest. The ability to do either nice user (as in developer) docs with known good examples or well documented not-meant-for-documentation unit/functional/integration tests is terrific. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: why don't many test frameworks support file-output?
kanchy kang wrote: i browsed the following frameworks briefly: nose, OOBTest, testosterone, py.test, Sancho ... and found out they do support imediate screen-output only. You can redirect stdout to a file. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: time.sleep(1) sometimes runs for 200 seconds under windows
Paul Probert wrote: Hi, My app runs in a loop looking for changes in a database, and like a good boy I call time.sleep(1) inside the loop. Unfortunately this sometimes runs for 200 seconds or so, presumably while my OS is calling Bill Gates to tell him what I've been doing. This happens under NT4, W2k, and XP. What do people do to fix this? Thanks! From the docs for time.sleep: The actual suspension time may be less than that requested because any caught signal will terminate the sleep() following execution of that signal's catching routine. Also, the suspension time may be longer than requested by an arbitrary amount because of the scheduling of other activity in the system. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: time.sleep(1) sometimes runs for 200 seconds under windows
Paul Probert wrote: [snip my slightly-snotty quoting of the sleep.time docs] Thanks, but yes, I had read that before posting. One would think, though, that the extra 200 seconds is a bit extreme to be blamable on system scheduling granularity. I didn't intend to invoke scheduling granularity, I was implying that under high system load it may take much longer for the sleep to come back. I'm starting to think we've got a worm of some kind. If so, its invisible to our Norton AV corporate. If you don't see any appreciable load on the machines (I read that you're seeing the same thing on several diverse machines elsewhere in this thread), then yes, I'd agree that /something/ strange is going on. Unfortunately this sounds like one of those things that will require laying on of hands to diagnose. Good luck! Let us know how it turns out, I'm curious. :) -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: editor for Python on Linux
Mladen Adamovic wrote: Answers like vi, emacs and gedit I won't take seriously. I don't know anything about gedit, but why not take Emacs and Vim (not vi) seriously? I would like syntax highlighting, auto ident and if possible auto completition and embedded help. Both certainly give you those and *so* much more. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: editor for Python on Linux
Rene Pijlman wrote: Sriram Krishnan: Check out http://wiki.python.org/moin/PythonEditors. This page can't be taken seriously. vi is not listed. I hope your wink key is broken; I wouldn't wish old-school vi on my worst enemy. Fortunately that page lists the wonderful Vim instead, so seriousness has been maintained. To the OP: a serious editor is a basic necessity of coding, so pick Emacs, Vim, or something equivalent. Just make sure it's customizable and you enjoy customizing it because you'll want to. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: define loop statement?
David Isaac wrote: I would like to be able to define a loop statement (nevermind why) so that I can write something like loop 10: do_something Here's a flagrant hack: import sys VAR_NAME = '__repeat_counter' def set_repeat_counter(value): frame = sys._getframe(2) frame.f_locals[VAR_NAME] = value def get_repeat_counter(value): frame = sys._getframe(2) if VAR_NAME not in frame.f_locals: frame.f_locals[VAR_NAME] = value return frame.f_locals[VAR_NAME] def repeat(limit): set_repeat_counter(get_repeat_counter(limit)-1) return get_repeat_counter(limit) while repeat(10): print 'OK' Without more work it doesn't allow nested loops though. And for the record, if you're worrying about Python's counted loop construct you need better things to worry about. insert-smilies-as-appropriate -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: zope 3.2 and imprt errors
[EMAIL PROTECTED] wrote: I have the following error Python 2.4.2 (#2, Sep 30 2005, 21:19:01) [GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)] on linux2 Type help, copyright, credits or license for more information. from zope.app import container container.interfaces Traceback (most recent call last): File stdin, line 1, in ? AttributeError: 'module' object has no attribute 'interfaces' Try this instead: from zope.app.container import interfaces interfaces.IContained InterfaceClass zope.app.container.interfaces.IContained -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: What editor shall I use?
Dylan Moreland wrote: I myself have just begun using vim. Does anyone have any tips/convenient tweaks for python programming with it? EnhancedCommentify, ShowFunc, spacehi, svncommand, and pythonhelper are nice Vim plugins to use with Python. They can all be found on vim.org. Not Python-specific, but I highly recommend Steve Oualline's Vim book (http://www.amazon.com/gp/product/0735710015). -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: How do I dynamically create functions without lambda?
Alex Martelli wrote: Disagree -- far more people THINK they're clever, than really ARE clever. According to a recent article in the Financial Times, over 40% of a typical financial firm's employees firmly believe they are among the 5% best employees of the firm -- and the situation, believe me, is no different in programming. It's apparently no different anywhere: http://www.phule.net/mirrors/unskilled-and-unaware.html -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: proposal: another file iterator
Jean-Paul Calderone wrote: When I just want the dumb version, I tend to write this: for chunk in iter(lambda: f.read(blocksize), ''): ... Which is only very slightly longer than your version. I would like it even more if iter() had been written with the impending doom of lambda in mind, so that this would work: for chunk in iter('', f.read, blocksize): ... But it's a bit late now. How about this instead (will work in 2.5): for chunk in iter(partial(f.read, blocksize), ''): ... -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Fredericksburg, VA ZPUG Meeting: January 11, 7:30-9:00 PM
Please join us January 11, 7:30-9:00 PM, for the seventh meeting of the Fredericksburg, VA Zope and Python User Group (ZPUG). Squid and Zope! Python and Zope roundtable! Free food! * Andrew Sawyers will discuss using the open source cache server Squid with Zope, including a discussion of the O'Reilly book about Squid (this talk was moved from our November meeting). * We will have a Python and Zope roundtable for questions and ideas about Zope or Python. Have a question you want to ask a Zope core developer or a Python core developer or a community Zope or Python user? Come by! * We will serve delicious food and soft drinks. We've had a nice group for all the meetings. Please come and bring friends! We also are now members of the O'Reilly and Apress user group programs, which gives us nice book discounts (prices better than Amazon's, for instance) and the possibility of free review copies. Ask me about details at the meeting if you are interested. General ZPUG information When: second Wednesday of every month, 7:30-9:00. Where: Zope Corporation offices. 513 Prince Edward Street; Fredericksburg, VA 22408 (tinyurl for map is http://tinyurl.com/duoab). Parking: Zope Corporation parking lot; entrance on Prince Edward Street. Topics: As desired (and offered) by participants, within the constraints of having to do with Python or Zope. Contact: Gary Poster ([EMAIL PROTECTED]) -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
Fredericksburg, VA ZPUG Meeting: January 11, 7:30-9:00 PM
Please join us January 11, 7:30-9:00 PM, for the seventh meeting of the Fredericksburg, VA Zope and Python User Group (ZPUG). Squid and Zope! Python and Zope roundtable! Free food! * Andrew Sawyers will discuss using the open source cache server Squid with Zope, including a discussion of the O'Reilly book about Squid (this talk was moved from our November meeting). * We will have a Python and Zope roundtable for questions and ideas about Zope or Python. Have a question you want to ask a Zope core developer or a Python core developer or a community Zope or Python user? Come by! * We will serve delicious food and soft drinks. We've had a nice group for all the meetings. Please come and bring friends! We also are now members of the O'Reilly and Apress user group programs, which gives us nice book discounts (prices better than Amazon's, for instance) and the possibility of free review copies. Ask me about details at the meeting if you are interested. General ZPUG information When: second Wednesday of every month, 7:30-9:00. Where: Zope Corporation offices. 513 Prince Edward Street; Fredericksburg, VA 22408 (tinyurl for map is http://tinyurl.com/duoab). Parking: Zope Corporation parking lot; entrance on Prince Edward Street. Topics: As desired (and offered) by participants, within the constraints of having to do with Python or Zope. Contact: Gary Poster ([EMAIL PROTECTED]) -- http://mail.python.org/mailman/listinfo/python-list
Re: Which Python web framework is most like Ruby on Rails?
Russell E. Owen wrote: I disagree. Once you've picked a database (not trivial in itself, of course), you typically only have a few options for talking to in in Python. Perhaps it's off-topic for this thread, but I think picking a database is the first mistake most people make. It's a form of premature optimization. Just like any other component in a system, develop your app without a database until you see that you need one, don't just assume you do from the beginning. I was listening to an interview with Ron Jeffries the other day, and when asked what he considers one of his greatest accomplishments (as a software developer), he told a story about working on a large development project for a system that was going to process large amounts of data. At the beginning of the project he was asked what database they should use, he said (something like) wait until we need one. During development several people asked what database they were going to use, he reiterated: wait until we need one. After the system went into production (without a database) he eventually left the company. Years later he found out that they still hadn't chosen a database because they had yet to need one. Sounds like a pretty good application of YAGNI to me. http://xp.c2.com/YouArentGonnaNeedIt.html That's also why I don't see much point to the relational-database-centric web frameworks that are all the rage today, but I'll save that rant for another day. -- Benji -- http://mail.python.org/mailman/listinfo/python-list
Re: Still Loving Python
Ivan Voras wrote: Are there any easy GUI builders for any Python-supported toolkits? wxDesigner is a really good commercial product, it's pretty inexpensive, too. http://www.roebling.de/ -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Proposal: Inline Import
Shane Hathaway wrote: Benji York wrote: OK, good. You won't have to worry about that. :) You didn't give a reason for disliking it. Oh, I don't particularly dislike it. I hadn't come up with a reason to like or dislike it, other than a predilection for the status quo. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: Dao Language v.0.9.6-beta is release!
Christophe wrote: David Rasmussen a écrit : Antoon Pardon wrote: Write shorter functions ;) This has little to do with long functions. A class can contain a large number of methods, whitch are all rather short, and your class will still be spread over several pages. Write classes with a smaller interface ;-) /David What about an editor that will reserve the first lines in the edit window to show the current class ? Could be a cool feature here :) I've been using a Vim script for a while that adds the name of current class, function, or Class.Method to the status line and it helps quite a bit. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Proposal: Inline Import
Shane Hathaway wrote: I'd like a way to import modules at the point where I need the functionality, rather than remember to import ahead of time. This might eliminate a step in my coding process. Currently, my process is I change code and later scan my changes to make matching changes to the import statements. The scan step is error prone and time consuming. By importing inline, I'd be able to change code without the extra scan step. Thoughts? Why not: 1) jump to the top of the file when you need to do an import (1G in Vim), 2) add the import, 3) jump back to where you were (Ctrl-o in Vim) and keep coding. This isn't Vim specific, I suspect all decent editors have similar capabilities (I know Emacs does). Thus eliminating the unpleasant scan step. Oh, and py.std does something similar to what you want: http://codespeak.net/py/current/doc/misc.html#the-py-std-hook. -- Benji -- http://mail.python.org/mailman/listinfo/python-list
Re: Proposal: Inline Import
Shane Hathaway wrote: Benji York wrote: [a quicker, but still manual, way to handle adding new imports] That's something the computer should do for me. It's busywork. Eclipse practically eliminates this busywork when I'm writing Java code: if I autocomplete a name, it also quietly adds the corresponding import statement. It also generates import statements when I copy/paste code. The structure of the Java language makes this relatively easy. Since you mentioned Eclipse, I wonder if PyDev has that feature. You may have to follow a particular coding style (like using the full module name every time). In that case any other sufficiently advanced editor could do the same. [snip] Thus a prerequisite for using inline import is broad approval. OK, good. You won't have to worry about that. :) -- Benji -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: Dao Language v.0.9.6-beta is release!
Ed Leafe wrote: So let's say that you are using 4 spaces as your standard, but by accident type 5. You hit backspace, which deletes 4 spaces, Nope, it would delete a single space. Then an additional backspace would delete the 4. See, I can make up bizarre scenarios where spaces cause problems, too. Only if you don't know how decent editors behave. :) -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: Dao Language v.0.9.6-beta is release!
Peter Decker wrote: On 12/4/05, Mike Meyer [EMAIL PROTECTED] wrote: See, I can make up bizarre scenarios where spaces cause problems, too. Only if you don't know how decent editors behave. :) But the same is also true of tabs causing problems :-). I'm starting to suspect that the same people who are zealous about spaces are also the same people who look down on anyone who doesn't agree with their choice of text editor. Perhaps. As far as editor choice goes, I'm only fervent about people picking a good editor (equivalent to Vim or Emacs) and learning it well. Other than that I don't care. I'm not as diplomatic about tabs. :) -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Default method arguments
bruno at modulix wrote: Another solution to this is the use of a 'marker' object and identity test: _marker = [] class A(object): def __init__(self, n): self.data =n def f(self, x = _marker): if x is _marker: x = self.data print x I'll add my 2 cents to the mix: default = object() class A(object): def __init__(self, n): self.data = n def f(self, x=default): if x is default: x = self.data print x -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: which feature of python do you like most?
[EMAIL PROTECTED] wrote: I have no idea why people are so facinating with python. So I post this question: What do you use in your dairy work with python? I can't imagine why you're confused. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: debugger
mclaugb wrote: Is there a decent debugger to use with IDL? I have briefly about PDB but this looks pretty limited in features and difficult to use. You might like Winpdb: http://www.digitalpeers.com/pythondebugger/ -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: debugger
[EMAIL PROTECTED] wrote: Benji York wrote: You might like Winpdb: http://www.digitalpeers.com/pythondebugger/ Not Found The requested URL /pythondebugger/-- was not found on this server. Apache/2.0.52 (Red Hat) Server at www.digitalpeers.com Port 80 shrug Works for me. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Fredericksburg, VA ZPUG Meeting: November 9, 7:30-9:00 PM
Please join us November 9, 7:30-9:00 PM, for the sixth meeting of the Fredericksburg, VA Zope and Python User Group (ZPUG). Squid and Zope! Using Zope for newspaper publishing! The dangers of object oriented inheritance! Free food! * Andrew Sawyers will discuss using the open source cache server Squid with Zope, including a discussion of the O'Reilly book about Squid. * Allen Schmidt, Sr. Programmer for Fredericksburg.com - the website for the Free Lance-Star - will present on Using Zope for Newspaper Publishing. * Jim Fulton, CTO of Zope Corporation, will present an abbreviated version of the argument given in Clemens Szyperski's Component Software for why both inheritance and delegation (e.g. acquisition) cause tight coupling and therefore should be avoided except in special circumstances. * We will serve delicious fruit, cheese, and soft drinks. We've had a nice group for all the meetings. Please come and bring friends! We also are now members of the O'Reilly and Apress user group programs, which gives us nice book discounts (prices better than Amazon's, for instance) and the possibility of free review copies. Ask me about details at the meeting if you are interested. General ZPUG information When: second Wednesday of every month, 7:30-9:00. Where: Zope Corporation offices. 513 Prince Edward Street; Fredericksburg, VA 22408 (tinyurl for map is http://tinyurl.com/duoab). Parking: Zope Corporation parking lot; entrance on Prince Edward Street. Topics: As desired (and offered) by participants, within the constraints of having to do with Python or Zope. Contact: Gary Poster ([EMAIL PROTECTED]) -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html -- http://mail.python.org/mailman/listinfo/python-list
Re: String Identity Test
Thomas Moore wrote: I am confused at string identity test: a=test b=test a is b True About identity, I think a is not b, but a is b returns True. Does that mean equality and identity is the same thing for strings? Nope: a = 'te' + 'st' b = 'test' a is b False You're seeing a coincidence of the implementation. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Problems with properties
Michael Schneider wrote: The get property access is working, but the the set property is not working. The classes need to be new style for properties to work right. Just change class Task: to class Task(object):. Your setNothing method is unnecessary, if you don't proved a setter an exception will be raised automatically. Also (if you're using Python 2.4) you probably want to look at decorator syntax. So you're class could look like this: class Task(object): def __init__(self,command): self._command = command @property def command(self): return self._command -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Function to execute only once
PyPK wrote: now I want execute() function to get executed only once. That is the first time it is accessed. How about just calculating the value at import time? -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: read serial data from a barcode reader/scanner using python
Edgar wrote: is there a way to program python to read serial data from a barcode reader/scanner http://pyserial.sourceforge.net/ and then using the parallel port of the PC to activate an electromagnetic door lock. http://pyserial.sourceforge.net/pyparallel.html For other options see Google (then here if answers are not forthcoming). -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Matching zero only once using RE
GregM wrote: I am trying to see if a web page contains the exact text: You have found 0 matches It is unclear to me why you're using a regex at all. If you want to find the *exact* text You have found 0 matches perhaps you should do something like this: if You have found 0 matches in pagetext: print 'yes' else: print 'no' -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: So far
CppNewB wrote: Most of them have support for Dialogs, but what about more complex UI's? I may need a resizable frame within a resizable frame? I haven''t found a GUI builder with a great feel yet. I *highly* recommend wxDesigner. I've used it extensively. It's cheap and has a demo version you can download (the demo can't save your designs, but can generate code so you can try it out). -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: New project coming up...stay with Python, or go with a dot net language??? Your thoughts please!
Luis M. Gonzalez wrote: If not Ironpython, Boo (which could be considered almost an static version of Python for .NET) would be a great choice. You could also use Python for .Net (http://www.zope.org/Members/Brian/PythonNet). -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Automating, Building, Testing and Deploying to Production Server
yoda wrote: I realize I'm losing so much time I could spend more productively. I'd therefore like to know the different approaches you guys employ to deploy builds from your staging servers (or laptops:) to the production server in an automated repeatable safe manner. How do you automate the process? We have a system called the buildout that checks out a project's code, downloads and builds any dependencies, and configures a working system. (http://svn.zope.org/Sandbox/zc/buildout/trunk/) We use that for setting up new development environments (each developer generally has several builds of any project at one time). What tools do you use and how? We also have a BuildBot setup that runs a buildout and then runs the tests and emails a list if the tests fail (http://buildbot.sf.net). You can see an example of our public buildbot here: http://buildbot.zope.org. What documentation is available for the various tools? We just publicly released the buildout code a couple of weeks ago, and it seriously needs docs and tests. BuildBot doesn't have great docs, but it's configured via Python, so it's not too bad. What is the best, easiest, most automated, method that provides robust versioning and easy rollback? When we deploy via buildout (as opposed to by using an installer or a simple archive) we generally either just tell the buildout to update itself, or if we want the ability to roll back make a new buildout and switch to it (therefore we can switch back to the previous build). We don't do it this way, but because the buildout for a particular project is itself versioned, you could just svn up to the previous version and rebuild it and you'd be back to where you started. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Finding the Process Path
Peck, Jon wrote: I have Python code running in an application, and I would like to find the full path of the process executable where it is running. Like this? import sys sys.executable '/usr/bin/python' -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: list.join()... re.join()...? Do they exist? (newbie questions...)
googleboy wrote: To get it to work I did this: List[0] = list0 List[1] = list1 List[2] = list2 List[3] = list3 cat_list = list0 + '|' + flatblurb + '|' + flatcontents + '|' + flates + '\n' file.write(concat_list) But it seems to me that there is probably something more pythonic than having to go about it in such a laborious fashion Indeed. :) cat_list = '|'.join(List) -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: How is wxWindows related to Python?
Sathyaish wrote: However, I do not understand its correlation with Python. The documentation page says, wxWindows 2.4.2: A portable C++ and Python GUI toolkit. So, my question is, How is wxWindows related to Python? Pure wxWindows (actually it's been renamed wxWidgets at the demand of Microsoft) is for C++. You're looking for wxPython: http://wxpython.org/ -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: number of python users
Magnus Lycka wrote: To name a few concrete examples, Zope typically bundles its own python in the installation, and can work with just one version and let other software on the same machine use another python of a different version. Note that Zope 3 doesn't do this. The system Python is used by default. You can always provide your own if you wish. Zope 3 is much more like a normal Python library in this respect. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 2.4 under WinXP, free VC71 toolkit and VC6 libraries
Berthold Höllmann wrote: I'm sure ctypes doesnot work on Linux and Solaris, but my code has to. I've used ctypes to great effect on Linux. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: [RFC] Parametric Polymorphism
Catalin Marinas wrote: Sorry if this was previously discussed but it's something I miss in Python. I get around this using isinstance() but it would be cleaner to have separate functions with the same name but different argument types. I think the idea gets quite close to the Lisp/CLOS implementation of methods. Take a look at PJE's generic function implementation. PyCon slides here: http://www.python.org/pycon/2005/papers/53/PyCon05Talk.html. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Accessing class variable at class creation time
Jan-Ole Esleben wrote: That doesn't really give him a way of using the class variable inside a method. Oh! I must have misunderstood the question. I'd like to know more about why the OP wants to do this; a small example would help narrow down the possibilities. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Accessing class variable at class creation time
Carlos wrote: Hi! class A: X = 2 def F(): print A.X F() The above fails because the name A is not yet at global scope when the reference A.X is reached. Is there any way to refer to A.X without making explicit use of the name 'A'? How about this: class A: ... X = 2 ... print X ... 2 -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Linux/Python - SQL*Server Connexion chain
Gilles Lenfant wrote: Have you guys any good experience on connecting a Python (Zope) app running on Linux to a Windoze SQL*Server ? Yep. I wrote bindings to ODBTP (http://odbtp.sourceforge.net/) using ctypes. It worked really well, good performance and quite reliable. You can see an alpha version at http://benjiyork.com/software.html. I'm not using it any more, but have a more recent version that I really should package up. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: testing a website from python
matt wrote: Here's something I did recently at work. It contains unittest code and is using urllib2. http://blog.spikesource.com/pyhton_testcases.htm If you want to test web sites, you might be interested in zope.testbrowser (currently Zope 3 only, but fixing that is on my to do list). You can see an example testbrowser test (which is also both its README and its unit tests) at http://svn.zope.org/*checkout*/Zope3/branches/testbrowser-integration/src/zope/testbrowser/README.txt?rev=38050 If there is any interest I'll try to package up a stand-alone version in the next few days. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: distutils and decorators
Robert Brewer wrote: We're trying to get CherryPy 2.1 RC 1 out the door, but setup.py is giving us some problems. I don't know anything about distutils, so I can't help you there, but I never-the-less can't resist speaking up... In our test suite, we want to test a decorator that we provide. Of course, decorators won't work in Python 2.3 More accurately, the special @ decorator syntax doesn't work in 2.3. I would propose that you *do not* want to test the syntax (that's what the Python test suite is for), but instead test the functionality of the decorator. Therefore I'd switch to 2.3 compatible syntax instead. Something like: def foo(): pass foo = cherrypy.expose(1)(foo) -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Perl's documentation come of age
Ed Hotchkiss wrote: I'm new to Python, not programming. I agree with the point regarding the interpreter. I couldn't (with a quick skimming) find any references to the interpreter in the thread, so I'll guess the original assertion was something like showing new-comers the interpreter is stupid and wastes their time. what is that? who uses that!? As a (more than) full time Python programmer, I can say that I use the interactive interpreter daily, and it contributes significantly to my prototyping of new code and reverse-engineering of existing code. I could imagine that other people might not find it that useful, but the who uses that!? response is hard for me to understand. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: distutils and decorators
Robert Brewer wrote: Actually, in this case we most definitely want to test 2.4's @ syntax. The decorator in question is an aliaser, and therefore is one of the few decorators which must be implemented differently for the 2.3-style decoration and the 2.4-style. See the expose function at: http://www.cherrypy.org/file/trunk/cherrypy/__init__.py?rev=654 I extracted expose from the above URL and wrote this test script (mind the wrapping): import sys, types def expose(func=None, alias=None): Expose the function, optionally providing an alias or set of aliases. def expose_(func): func.exposed = True if alias is not None: if isinstance(alias, basestring): parentDict[alias] = func else: for a in alias: parentDict[a] = func return func parentDict = sys._getframe(1).f_locals if isinstance(func, (types.FunctionType, types.MethodType)): # expose is being called directly, before the method has been bound print 'direct' return expose_(func) else: # expose is being called as a decorator print 'decorator' if alias is None: alias = func return expose_ print 'before decorator (no args)' @expose def foo(): pass print 'before decorator (with args)' @expose(1) def foo(): pass print 'before direct 1' def bar(): pass baz = expose(bar) print 'before direct 2' bux = expose(1)(bar) Here's it's output (2.4.1 on Linux): % python /tmp/1.py before decorator (no args) direct before decorator (with args) decorator before direct 1 direct before direct 2 decorator What am I missing? -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: send mail through webmail
Chris Curvey wrote: If you have to do it thru the web, I would use one of the browser packages (mechanize, mechanoid, PAMIE, or IshyBrowser). Then you can scrape the site, fill out the forms, press the buttons, etc. You can also try the almost-publicly-available package zope.testbrowser (http://svn.zope.org/Zope3/branches/testbrowser-integration/src/zope/testbrowser/ and http://benjiyork.com/zope.testbrowser-0.1.tgz). See the README.txt for general info and over_the_wire.txt for how to use it to access web sites. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: send mail through webmail
Benji York wrote: You can also try the almost-publicly-available package zope.testbrowser (http://svn.zope.org/Zope3/branches/testbrowser-integration/src/zope/testbrowser/ and http://benjiyork.com/zope.testbrowser-0.1.tgz). I forgot to mention that it requires the ZopeInterface package from http://www.zope.org/Products/ZopeInterface. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: testing a website from python
Achim Domma (SyynX Solutions GmbH) wrote: Benji York wrote: If there is any interest I'll try to package up a stand-alone version in the next few days. I think that would be a very usefull tool. Currently I'm using httpunit with Jython but a python only tool would be much nicer. I put a first cut at http://benjiyork.com/zope.testbrowser-0.1.tgz). See the README.txt for general info and over_the_wire.txt for how to use it to access web sites. It requires the zope.interface package from http://www.zope.org/Products/ZopeInterface (version 3.0.1 should work). -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Calling python scripts from C# programs
[EMAIL PROTECTED] wrote: I want to call (execute) some python scripts from my C# program. See http://www.zope.org/Members/Brian/PythonNet. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Brute force sudoku cracker
Sybren Stuvel wrote: def all(seq, pred=bool): What's this? What is bool? See http://docs.python.org/lib/built-in-funcs.html#l2h-10 -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
[Fwd: Sept 14 Fredericksburg, VA ZPUG: Packaging with zpkg, review of Python Cookbook 2nd ed]
Please join us September 14, 7:30-9:00 PM, for the fourth meeting of the Fredericksburg, VA Zope and Python User Group (ZPUG). This meeting has three features of note. - Fred Drake, Zope Corp Senior Software Engineer, Python core developer, and Python documentation maintainer and editor will present a discussion of zpkg, the Zope Packaging Tools (http:// www.zope.org/Members/fdrake/zpkgtools/). - Gary Poster, Zope Corp Senior Software Engineer, will present a brief review of the second edition of the O'Reilly Python Cookbook (http://www.oreilly.com/catalog/pythoncook2/). - We will serve delicious fruit, cheese, and soft drinks. We've had a nice group for all the meetings. Please come and bring friends! An RSVP would be appreciated if you are coming, but is not necessary. More information http://www.zope.org/Members/poster/fxbgzpug_announce_4 and below. Upcoming meetings are already tentatively planned for presenters (although we can still use more, particularly lightning talks): see http://www.zope.org/Members/poster/fxbgzpug_announce_5 and http://www.zope.org/Members/poster/fxbgzpug_announce_6 Hope to see you there! General ZPUG information When: second Wednesday of every month, 7:30-9:00. Where: Zope Corporation offices. 513 Prince Edward Street; Fredericksburg, VA 22408 (tinyurl for map is http://tinyurl.com/duoab). Parking: Zope Corporation parking lot; entrance on Prince Edward Street. Topics: As desired (and offered) by participants, within the constraints of having to do with Python. Contact: Gary Poster ([EMAIL PROTECTED]) -- http://mail.python.org/mailman/listinfo/python-list
Re: python script under windows
Jan Gregor wrote: I run python script on another computer and want to survive that script after my logout. Start at http://www.python.org/windows/win32/#NTServices. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Grouping lists
PyPK wrote: lst = [1,1,1,1,3,5,1,1,1,1,7,7,7] I want to group the list so that it returns groups such as [(0,3),4,5,(6,9),(10,12)]. which defines the regions which are similar. You'll probably want to use groupby from the itertools module. See http://docs.python.org/lib/itertools-functions.html -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Construct raw strings?
Peter Hansen wrote: Benji York wrote: It's not join that's getting you, it's the non-raw string representation in path_to_scan. Use either 'd:\test_images' or 'd:\\test_images' instead. Benji, you're confusing things: you probably meant r'd:\test_images' in the above Doh! I did indeed. Thanks for the backup. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: job scheduling framework?
Chris Curvey wrote: Has anyone seen a simple open source job-scheduling framework written in Python? It sounds like BuildBot (http://buildbot.sf.net) might interest you. It's not exactly meant to be a job control system, but it does have some nice functionality. It might be interesting to extend it in the direction you're talking about. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Construct raw strings?
Thomas W wrote: I got a stupid problem; on my WinXP-box I want to scan the filesystem and enter a path to scan like this : path_to_scan = 'd:\test_images' Note the lack of an r prefix and the \t sequence above. The problem is that some of the parts being joined contains escape characters If I take the seperate parts and join them using the interpreter, like : f = r'd:\test_images\something\foo\bar\test.jpg' it works ok and os.path.exists(f) returns True, but I cannot the that r' in front using the os.path.join-method in my code. It's not join that's getting you, it's the non-raw string representation in path_to_scan. Use either 'd:\test_images' or 'd:\\test_images' instead. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Getting the bytes or percent uploaded/downloaded through FTP?
[EMAIL PROTECTED] wrote: Hi, I'm just wondering if there is any way to get the number of bytes, or the percentage, that have been uploaded/downloaded when uploading/downloading a file throught ftp in Python. I have searched Google many times but could find nothing. If you're using urllib you can do something like this: def reporter(block, block_size, total_size): left = total_size - block * block_size sys.stderr.write('\r') sys.stderr.write('Downloading %s: ' % file_name) if left 0: # the estimate is a bit rough, so we fake it a little sys.stderr.write('%sK left.' % (left/1024)) else: sys.stderr.write('done.') # it's possible that this line is shorter than the previous, # so we need to erase any leftovers sys.stderr.write(' '*10) sys.stderr.write('\b'*10) import urllib urllib.urlretrieve(url, destination, reporter) sys.stderr.write('\n') -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: learning python
placid wrote: Christopher Culver wrote: placid [EMAIL PROTECTED] writes: I was just wondering about good books that teach python (either with programming or no programming experience at all) ? Or some online tutorial? Did you even bother doing a web search? Learn Python or Python tutorial would be enough. yeah, see i didnt even think of that. thanks man That was either a very gracious way to take a public correction, or an expertly executed bit of sarcasm, either way, placid, I applaud you. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Python / web
Mike Meyer wrote: Robert [EMAIL PROTECTED] writes: I know general Python pretty well and interested in using Python for a web project. Others have already suggested Zope/Plone, which seems to be the most popular such system. I only have limit experience with Zope, but I found that it tended to own the resulting code, such that reusing it in another framework would be a PITA. This is much less the case for Zope 3, the separation between domain and presentation code is much easier to maintain. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: defining classes
LeRoy Lee wrote: I have been searching for the answer to this as it will determine how I use classes. Here are two bits of code. class foo2: def __init__(self): self.j = 5 h = foo2() h.j Traceback (most recent call last): File stdin, line 1, in ? AttributeError: foo2 instance has no attribute 'j' Works for me (Python 2.4). class foo2: ... def __init__(self): ... self.j = 5 ... h = foo2() h.j 5 Perhaps there is some strange state in your interpreter. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: how to join two Dictionary together?
See http://docs.python.org/lib/typesmapping.html for a description of the update method. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: OpenSource documentation problems
Terry Hancock wrote: OTOH, there are lots of poorly-documented third-party Python modules (as in any language). Zope is a particularly nasty example -- though I think I understand some of the reasons behind that (rapidly changing API, poor interaction with doc tools, etc). Are you referring to Zope 2 or 3 here? I ask because I consider the Zope 3 code (at least the parts written in the last couple years) to be some of the best (externally) documented code I've worked with. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: variable hell
Peter Maas wrote: suffix = 'var' vars()['a%s' % suffix] = 45 avar 45 Quoting from http://docs.python.org/lib/built-in-funcs.html#l2h-76 about the vars built in: The returned dictionary should not be modified: the effects on the corresponding symbol table are undefined. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Logging all activity on a tty/pty?
Dan Stromberg wrote: Is there a way, using python, to (voluntarily) log all activity in a given shell, in a way that should work on pretty much all *ix's with a port of python? If it's just a simple transcript you're wanting see man script. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Unix diff command under Window.
TonyHa wrote: Does any one have using Python to write a Unix diff command for Window? No, but you can get the *actual* diff command for Windows: http://unxutils.sourceforge.net/ -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Sanitizing untrusted code for eval()
Jim Washington wrote: I'm still working on yet another parser for JSON (http://json.org). Hi, Jim. The only problem is, it uses eval(). It's important to sanitize the incoming untrusted code before sending it to eval(). Does anyone know of any other gotchas with eval() I have not found? Or is eval() simply too evil? I'd say that eval is just too evil. I do wonder if it would be possible to use eval by working from the other direction. Instead of trying to filter out dangerous things, only allow a *very* strict set of things in. For example, since your doing JSON, you don't even need to allow multiplication. If you only allowed dictionaries with string keys and a restricted set of types as values, you'd be pretty close. But once you're at that point you might as well use your own parser and not use eval at all. shrug -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: How to get a unique id for bound methods?
Russell E. Owen wrote: The id of two different methods of the same object seems to be the same, and it may not be stable either. Two facts you're (apparently) unaware of are conspiring against you: 1) the id of an object is consistent for the lifetime of the object, but may be reused after the object goes away 2) methods are bound on an as-needed basis and then normally discarded (unless you do something to keep them around) An illustration: class cls(object): def meth1(self): pass def meth2(self): pass c = cls() m1 = c.meth1 print id(m1) -1209779308 m2 = c.meth1 print id(m2) -1209652732 I guess that just means bound methods aren't objects in their own right, but it surprised me. Nope, they're objects, they just don't tend to be around very long. The hash function looks promising -- it prints out consistent values if I use it instead of id in the code above. Is it stable and unique? The documentation talks about objects again, which given the behavior of id makes me pretty nervous. Any advice would be much appreciated. I think you'll get the best advice from this group if you tell us what the larger problem is that you're trying to solve. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: creating/modifying sparse files on linux
Terry Reedy wrote: megastring = 100*'a' # t 1 sec on my machine (other than keep appending to a string until it reaches 1MB len)? You mean like (unexecuted) s = '' for i in xrange(100): s += 'a' #? This will allocate, copy, and deallocate 100 successively longer temporary strings and is a noticeable O(n**2) operation. Not exactly. CPython 2.4 added an optimization of += for strings. The for loop above takes about 1 second do execute on my machine. You are correct in that it will take *much* longer on 2.3. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Testing for presence of arguments
Madhusudan Singh wrote: I know how to set optional arguments in the function definition. Is there an intrinsic function that determines if a certain argument was actually passed ? Like the fortran 95 present() logical intrinsic ? People generally use a value that isn't a valid option, often None. def my_func(a, b, c=None): if c is None: do something If None is a valid value, make one that isn't: unspecified = object() def my_func(a, b, c=unspecified): if c is unspecified: do something -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] implementation of copy standard lib
Simon Brunning wrote: I think that copy is very rarely used. I don't think I've ever imported it. Or is it just me? I rarely use copy, and almost always regret it when I do. wink -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Point and click GUI builder for Python
Madhusudan Singh wrote: Is there such a thing for python ? Like Qt Designer for instance ? I've had great success with wxDesigner (http://www.roebling.de/). It is a commercial product ($129 for a single license), but it does an exceptional job. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: The ONLY thing that prevents me from using Python
Kevin wrote: I have been using java (jsp/servlets), vb/asp and perl for a few years. Almost all my projects are web site development related, and many of my clients' web sites are hosted on those shared web hosting services. The problem is that it's difficult to find hosting services with Python installed and supported. See http://wiki.python.org/moin/PythonHosting and remember that Google is your friend. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: trying to parse non valid html documents with HTMLParser
florent wrote: True, I just want to extract some data from html documents. But the problem is the same. The parser looses the position he was in the string when he encounters a bad tag. Are you saying that Beautiful Soup can't parse the HTML? If so, I'm sure the author would like an example so he can fix it. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Parallel port programming on windows XP/2000?
Novice Experl wrote: I'd like to write a simple application that interfaces with the parallel port Use pyParallel. You don't have to worry about the Java stuff unless you're using Jython. Just follow the instructions on the page (download, unarchive, python setup.py install). After that you have to understand how the parallel port works, but I'll assume you already do or can use the web to figure it out. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: In-place decorate-sort-undecorate - best implementation?
Tom Anderson wrote: I don't have python 2.4; anyone care to check how they compare there? I used the following timer function: I think on 2.4 the new key option to list.sort would be the fastest way to accomplish what you want. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: a pickle's pickle
[EMAIL PROTECTED] wrote: So basically trainer always gets an existing TrainingMatrix(the class) pickled object if there is a file to read from, otherwise it just makes a new instance. Either way, the instance trainer is pickled at the end. Right, but the data you're interested in is contained in the class, not the instance. You need to move the mutable class attributes into the instance. Like so: class TrainingMatrix: totalWordsProcessed = 0 numWords = 0 numContexts = 0 matrixWords = 0 def __init__(self): self.matrix = [] self.estimator = {} self.wordInfo = {} self.contextInfo = {} -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Fredericksburg, VA Zope and Python User Group
Please join us August 10, 7:30-9:00 PM, for the third meeting of the Fredericksburg, VA Zope and Python User Group (ZPUG). This meeting has four features of note. - Brian Lloyd, the author of Python for .Net (http://www.zope.org/ Members/Brian/PythonNet/) and the Zope Corporation VP of Engineering, will discuss his .Net platform and give a brief .Net overview. - Benji York, Zope Corp Senior Software Engineer, will discuss current functional testing practices on Zope 3, including using Selenium on Zope 3, using demo storage for functional testing, and using his own compelling new functional test package. Note that the majority of this discussion has strong applicability to automated testing of all web frameworks and applications. - We will serve the now-usual geek-chic fruit, cheese, and soft drinks. - Fred Drake, Zope Corp Senior Software Engineer, Python core developer, Python documentation maintainer and editor, and co-author of the O'Reilly book Python XML will give two of his books (http:// www.amazon.com/exec/obidos/tg/detail/-/0596001282/) to new attendees. Upon pressure, he admitted that he would be willing to autograph them if bribed with fruit, cheese, and soft drinks. Note that we are eager to have non-Zope-Corporation employees give presentations. :-) We had three new attendees last meeting, for a total of ten. Please come and bring friends! More information http://www.zope.org/Members/poster/ fxbgzpug_announce_3 and below. Hope to see you there! Gary General ZPUG information When: second Wednesday of every month, 7:30-9:00. Where: Zope Corporation offices. 513 Prince Edward Street; Fredericksburg, VA 22408 (tinyurl for map is http://tinyurl.com/duoab). Parking: Zope Corporation parking lot; entrance on Prince Edward Street. Topics: As desired (and offered) by participants, within the constraints of having to do with Python. Contact: Gary Poster ([EMAIL PROTECTED]) -- http://mail.python.org/mailman/listinfo/python-list
Re: Python IDE's
Adriaan Renting wrote: vi/vim is a godssend if you need a working system that needs to fit in 4 Mb or ROM, but it's an editor not an IDE. When talking about IDE's I mean a lot more as 'just' an editor, below is my 'wishlist', I would be very interested what solutions you use, how much time it took you to set up this solution, and which parts of my 'wishlist' it implements. First, a disclaimer: your point of how much time it took you to set up? is definitely valid. I would assert that it is also valid to ask how much time did it save you once it was set up to work precisely the way you wanted it to? - Integrated help. - Code completion. - Integrated debugger. I've seen (but not used, because I don't want these features) Vim scripts to do these. They exist for Emacs too. - Integrated GUI design. The IDE should have a graphical tool for designing GUIs, and the editor should be aware of it and propagate changes in an inobtrusive way. Not in Vim (or Emacs), but the best GUI designers /I've/ seen are stand-alone anyway. In other words, their not in an IDE either. - Code aware editor. - Integration with version control system. - Code documentation/inspection tools. I use Vim for these. Ability to generate include and inheritance trees On the rare occasions I do something like this it's with apidoc. LOC counters I use sloccount (outside of Vim). profiling what lines of you code get executed most/never I use a testing framework or profiler for that (outside of Vim) helpfile generation from code, etc. I don't do that, but if I did, it would probably be outside of Vim. Tools for communication with coworkers Gaim and Thunderbird bugtracking Zope collector and Roundup which targets need which files, automatic install scripts/tools, etc. (If I understand you correctly) I use a tool we developed internally to do this. - Accessible user interface. All functionality should be accessible through some menu structure, so I don't need to depend on my memory. Prefereable reprogrammable/assignable shortcut keys for all functionality, maybe even some form of macros, plugins, etc. Vim (and Emacs) does this (there are a few non-menu accessible things, but they can be added to menus as you please). - For C/C++: memory leak detection External tools. Why I want this? Because I want to spend my time programming my code, not my developement environment. Why would I spend the time setting this up? Because I want to spend my time programming my code, not fighting my development environment. :) I wonder why you would want some of these things integrated into an IDE (communication, LOC counter, etc.) -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: trying to parse non valid html documents with HTMLParser
florent wrote: I'm trying to parse html documents from the web, using the HTMLParser class of the HTMLParser module (python 2.3), but some web documents are not fully valids. From http://www.crummy.com/software/BeautifulSoup/: You didn't write that awful page. You're just trying to get some data out of it. Right now, you don't really care what HTML is supposed to look like. Neither does this parser. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: Dabo in 30 seconds?
Cliff Wells wrote: As I mentioned earlier, programming is half brains and half tenacity. +1 QOTY (quote of the year) -- Benji York -- http://mail.python.org/mailman/listinfo/python-list