Re: Accessing class variable at class creation time

2005-09-23 Thread Benji York
'A'? How about this: >>> class A: ... X = 2 ... print X ... 2 -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing class variable at class creation time

2005-09-24 Thread Benji York
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. -- Ben

Re: [RFC] Parametric Polymorphism

2005-09-25 Thread Benji York
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: Python 2.4 under WinXP, free VC71 toolkit and VC6 libraries

2005-09-27 Thread Benji York
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: number of python users

2005-09-29 Thread Benji York
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: list.join()... re.join()...? Do they exist? (newbie questions...)

2005-10-01 Thread Benji York
at_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?

2005-10-01 Thread Benji York
27;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: Automating, Building, Testing and Deploying to Production Server

2005-10-03 Thread Benji York
t 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

Re: Finding the Process Path

2005-10-03 Thread Benji York
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: New project coming up...stay with Python, or go with a dot net language??? Your thoughts please!

2005-10-04 Thread Benji York
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/

Re: So far

2005-10-06 Thread Benji York
. 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: Matching zero only once using RE

2005-10-07 Thread Benji York
u have found 0 matches" in pagetext: print 'yes' else: print 'no' -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: read serial data from a barcode reader/scanner using python

2005-10-10 Thread Benji York
options see Google (then here if answers are not forthcoming). -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems with properties

2005-10-14 Thread Benji York
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

2005-10-14 Thread Benji York
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: String Identity Test

2005-11-01 Thread Benji York
s 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

Fredericksburg, VA ZPUG Meeting: November 9, 7:30-9:00 PM

2005-11-02 Thread Benji York
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

Re: which feature of python do you like most?

2005-11-08 Thread Benji York
[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

2005-11-08 Thread Benji York
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

2005-11-08 Thread Benji York
[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

Re: Default method arguments

2005-11-15 Thread Benji York
rker: > 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: ANN: Dao Language v.0.9.6-beta is release!

2005-12-04 Thread Benji York
cenarios 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!

2005-12-04 Thread Benji York
27;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: ANN: Dao Language v.0.9.6-beta is release!

2005-12-09 Thread Benji York
urrent 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

2005-12-09 Thread Benji York
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

Re: Proposal: Inline Import

2005-12-09 Thread Benji York
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

Re: Proposal: Inline Import

2005-12-10 Thread Benji York
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 pre

Re: Employablity of python programmers

2005-01-18 Thread Benji York
k with, and the area we live in. We made the right choice. Go after what you really want, and you will too. -- Benji York Sr. Software Engineer Zope Corporation -- http://mail.python.org/mailman/listinfo/python-list

Re: delay and force in Python

2005-01-19 Thread Benji York
i += 1 def even(gen): for x in gen: if x % 2 == 0: yield x numbers = even(count(1, 999)) first = numbers.next() second = numbers.next() print second -- Benji York [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: barchart for webpage needed

2005-01-31 Thread Benji York
one technique: http://www.siteexperts.com/tips/contents/ts13/page1.asp. -- Benji York Sr. Software Engineer Zope Corporation -- http://mail.python.org/mailman/listinfo/python-list

Re: Loop until condition is true

2005-06-21 Thread Benji York
t;, the added complexity to the language (as little as it is) isn't rewarded by a large enough improvement to make it worth it. > It could be an economy of one unuseful test by loop. If by "economy" you mean "optimization", then I would suggest that the difference would be unnoticeable. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: eval() in python

2005-06-21 Thread Benji York
harold fellermann wrote: > >>> s="print 'hello Xah Lee :-)'" > >>> exec(s) > hello Xah Lee :-) Note that because "exec" is a statement, the parentheses above are superfluous. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Python can do it for me?

2005-06-21 Thread Benji York
never used PyGTK, but it looks nice. I've generally stuck with wxPython. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Need Python web hosting ASAP

2005-06-21 Thread Benji York
ed in http://wiki.python.org/moin/PythonHosting. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Loop until condition is true

2005-06-23 Thread Benji York
;from booleans import True, False". Of course the fix is easy, but it still must be applied before the code will run. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: A World Beyond Capitalism 2005,

2005-06-23 Thread Benji York
Ivan Van Laningham wrote: > And what defines a "python activist" anyway? Blowing up Perl > installations worldwide? +1 QOTW -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting part of a list

2005-06-24 Thread Benji York
Fuzzyman wrote: > a = ll[2:] > a.sort() > ll[2:] = a > > To do a partial sort, in place, you'll have to subclass list Or be using 2.4: >>> ll = [3, 1, 4, 2] >>> ll[2:] = sorted(ll[2:]) >>> ll [3, 1, 2, 4] -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: help!

2005-06-24 Thread Benji York
ime('a_file') 1119615705 >>> os.path.getatime('a_file') 1119615705 >>> os.system('cat a_file') 0 >>> os.path.getmtime('a_file') 1119615705 >>> os.path.getatime('a_file') 1119615758 -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: a dictionary from a list

2005-06-24 Thread Benji York
>>> a_list = [1, 2, 3, 'a', 'b', 'c'] >>> dict.fromkeys(a_list) {'a': None, 1: None, 2: None, 3: None, 'c': None, 'b': None} -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: http POST only returning GET data

2005-06-24 Thread Benji York
vm wrote: > Hi, for some reason my POST is not working properly. Look at the URL again, you missed a character. You had: httpSess.request("POST","/",params,headers) It should be: httpSess.request("POST","/q",params,headers) -- Benji York -- htt

Re: Life of Python

2005-06-25 Thread Benji York
ng *is* the way you handle not being able to "[design] the software interactions completely bevorehand". -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: unittest: collecting tests from many modules?

2005-06-26 Thread Benji York
g, does code coverage, lets you select subsets of the tests to run, as well as control verbosity. And, if you feel experimental you might want to preview the new Zope test runner currently under development (svn://svn.zope.org/repos/main/zope.testing). -- Benji York -- http://mail.python.org/ma

Re: Better console for Windows?

2005-06-27 Thread Benji York
liking. While you're there I'd recommend turning on "QuickEdit Mode" on the "Options" tab. Then you can drag with your left mouse button to select an area of text, right click to copy, then right click again to paste. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Inheriting from object

2005-06-29 Thread Benji York
Fuzzyman wrote: > Also, can anyone explain any tangible benefit of inheriting from > object, when not explicitly using any features of new style classes ? One reason is that properties won't work correctly. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Favorite non-python language trick?

2005-06-30 Thread Benji York
stuff is cool, but no where near the maturity (or speed) of OZ/Mozart. OTOH, I can actually get things done with the logilab code. But that might say more about me than Mozart. :) -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-06-30 Thread Benji York
Graham Fawcett wrote: > keep-your-stick-on-the-ice'ly yours, Is that a Red Green reference? Man, I didn't think this could get any more off-topic. :) python-needs-more-duct-tape'ly yours, Benji -- http://mail.python.org/mailman/listinfo/python-list

Re: I have a question.

2005-06-30 Thread Benji York
Nathan Pinno wrote: > Does Python have a random function? If so, can you show me an example > using it? http://docs.python.org/lib/module-random.html -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Python exception hook simple example needed

2005-07-05 Thread Benji York
[EMAIL PROTECTED] wrote: > If anyone has an idea, how to I catch exceptions globally, please write me. I believe there is an example of this in the demo that comes with wxPython (don't have an install handy to check). -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Considering moving from Delphi to Python [Some questions]

2005-07-05 Thread Benji York
Dark Cowherd wrote: > I want some feedback on folllwing: > anybody who has experience in writing [...] data > entry heavy web applications. > Any suggestions? You might be interested in Zope 3's ability to generate data entry/edit forms via schemas. -- Benji York -- http:

Re: Folding in vim

2005-07-05 Thread Benji York
something like "set softtabstop=4". -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Use cases for del

2005-07-06 Thread Benji York
Stian Søiland wrote: > Yes, and we can make > > someunknownlist[] = 2 > > magically do someunknownlist = list() and append 2. I hope you're being sarcastic. :) If not, why don't you like: some_list = [2] -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-06 Thread Benji York
Ron Adam wrote: > "if extraargs:" would evaluate to "if None:", which would evaluate to > "if:" which would give you an error. In what way is "if None:" equivalent to "if:"? -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: python-constraint 1.0

2005-07-07 Thread Benji York
Gustavo Niemeyer wrote: > **python-constraint** [1]_ is a Python module offering solvers for > Constraint Solving Problems (CSPs) over finite domains in simple > and pure Python. Very cool! I can't wait to get some time to play with this. -- Benji York -- http://mail.pyth

Re: Managment of Python Libraries

2005-07-12 Thread Benji York
Joseph Chase wrote: > In the past, I have noticed that I have spent a lot of time managing my C++ > libraries. The main thing you need are good tests. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Fredericksburg, VA ZPUG Meeting

2005-07-12 Thread Benji York
When: July 13, 7:30-9:00 PM Where: Zope Corp offices (513 Prince Edward Street; Fredericksburg, VA 22408) Details at http://www.zope.org/Members/poster/fxbgzpug_announce_2 Hope to see you there! -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I send keystrokes to a console window in Windows XP?

2005-07-16 Thread Benji York
quot;dir{ENTER}") shell.SendKeys("echo Hi There{ENTER}") -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: email format in python

2005-07-18 Thread Benji York
else { > return false; > } > } While it is possible to translate the above code into Python (see http://docs.python.org/lib/module-re.html), you should know that the regex above will not validate all possible email addresses. In general it is a fools errand to try to anywa

Re: How do I send keystrokes to a console window in Windows XP?

2005-07-18 Thread Benji York
[EMAIL PROTECTED] wrote: > This gives me hope, but what I really need to do is to send keystrokes > to an <<>> console window. That's exactly what the code does. Try it out, you'll see how it works quickly enough. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows command line problem

2005-07-19 Thread Benji York
MarkE wrote: > The answer appears to be: > An example command line for running the script was written in a word > document. The "Autocorrect" (sic) feature in word replaces a normal > dash There is a lesson there I wish more people would learn: Word is not a text ed

Re: Windows command line problem

2005-07-20 Thread Benji York
[EMAIL PROTECTED] wrote: > I think the lesson there is 'dont depend on getopt, write your own > command line parser'. I always write my own, as it's so easy to do. While I'll agree that getopt isn't ideal, I find optparse to be much better. -- Benji York --

Re: Difference between " and '

2005-07-21 Thread Benji York
x27;) >>>5 >>Very zen. > But unfortunately incorrect, since the original poster > didn't ask for the difference between the ordinal > values of the single quote and double quote characters Steven, your reply was one of the most subtle and hilarious things I've

Re: What is your favorite Python web framework?

2005-07-23 Thread Benji York
ically (or semi-automatically if you prefer) generating input forms, validating them, applying the results to an object, etc. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: unit test nested functions

2005-07-23 Thread Benji York
(most recent call last): File "", line 1, in ? AttributeError: 'function' object has no attribute 'g' >>> f(1) >>> f.g -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: unit test nested functions

2005-07-23 Thread Benji York
Raymond Hettinger wrote: > [Benji York] > >>Note that when using this technique, f.g will not be bound until after >>you call the function: > > > That is a feature, not a bug. The inner function isn't even created > until the outer function is run. I'm

Re: How to run python script in background after i logout

2005-07-24 Thread Benji York
want the "nohup" command (short for "no hangup", as in the HUP signal). You would run it like so: nohup python script.py & see "man nohup" and "info coreutils nohup" for more info. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Fire event when variable is Set/Get

2005-07-25 Thread Benji York
return self.__x def fset(self, value): self.__x = value def fdel(self): del self.__x return property(**locals()) You can remove any of fget, fset, fdel, or doc without changing any other lines, and there are no "extra" entries in the class's name space. -- season-to-taste-ly yours, Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: regarding porting to windows.

2005-07-25 Thread Benji York
ons you wish to port, I'm sure someone would be able to help, but they'll need better information about what your specific question is. Perhaps this would help: http://www.catb.org/~esr/faqs/smart-questions.html -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Counting processors

2005-07-25 Thread Benji York
Pauldoo wrote: > Is a way in python to obtain the total number of processors present in > the system? I don't know of a platform independent way. If you specify one or more platforms, I'm sure someone will be able to help. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Run batch files in Windows XP

2005-07-25 Thread Benji York
uments. > That must not be right? The batch file will see two parameters (in %1 and %2) if that's not what you want, put double quotes around the %s, like so: os.system('bootmanager.bat "%s"' % "BOOTMANAGER ALL") -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Emacs skeletons

2005-07-26 Thread Benji York
it (I'm a degenerate Vim user), I've found ctags completion very handy. I currently have my (inferior) editor set up to scan the current buffer, other buffers, then tags files when doing completion. I'm sure (the superior) Emacs can do something similar. -- self-editor-abasing-ly

Re: Need to understand python license

2005-07-27 Thread Benji York
hon.org/moin/PythonSoftwareFoundationLicenseFaq -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Hiding

2005-07-29 Thread Benji York
Steven Bethard wrote: > So open("C:\file.txt") is still fine I think it is more like it is recommended, not just OK. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Thaughts from an (almost) Lurker.

2005-07-31 Thread Benji York
sons, but to track the dynamics > af the replies. "Never attribute to malice that which can be adequately explained by stupidity." -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Dabo in 30 seconds?

2005-08-01 Thread Benji York
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

Re: Is this Pythonic?

2005-08-01 Thread Benji York
s.html#l2h-298 (NotImplementedError) -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Python IDE's

2005-08-01 Thread Benji York
Jon Hewer wrote: > But, if i use Vi, then whenever i want to test some code i have to > open up python, import the necessary modules and run it - I like the > idea of developing python in an IDE and just hitting a run button. map :w:!python % -- Benji York -- http://mail.python.or

Re: a pickle's pickle

2005-08-02 Thread Benji York
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

2005-08-02 Thread Benji York
tion 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 comp

Re: Python IDE's

2005-08-02 Thread Benji York
ting 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

2005-08-02 Thread Benji York
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: trying to parse non valid html documents with HTMLParser

2005-08-03 Thread Benji York
uthor 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?

2005-08-03 Thread Benji York
). 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?

2005-08-03 Thread Benji York
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

Re: The ONLY thing that prevents me from using Python

2005-08-05 Thread Benji York
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: python for microcontrollers

2005-08-08 Thread Benji York
Evil Bastard wrote: > I'm currently tackling the problem of implementing a python to assembler > compiler for PIC 18Fxxx microcontrollers Perhaps porting Pyrex would be easier. Pyrex takes a python-like syntax (plus type information, etc.) and emits C, which is then compiled. --

Re: Point and click GUI builder for Python

2005-08-09 Thread Benji York
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.py

Re: [Python-Dev] implementation of copy standard lib

2005-08-16 Thread Benji York
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. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: Testing for presence of arguments

2005-08-17 Thread Benji York
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/mail

Re: creating/modifying sparse files on linux

2005-08-18 Thread Benji York
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

Re: How to get a unique id for bound methods?

2005-08-19 Thread Benji York
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: Sanitizing untrusted code for eval()

2005-08-22 Thread Benji York
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 e

Re: Logging all activity on a tty/pty?

2005-08-24 Thread Benji York
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

Re: Unix diff command under Window.

2005-08-24 Thread Benji York
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: variable hell

2005-08-25 Thread Benji York
odified: the effects on the corresponding symbol table are undefined. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: how to join two Dictionary together?

2005-08-30 Thread Benji York
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

2005-08-30 Thread Benji York
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: Python / web

2005-09-02 Thread Benji York
th 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

2005-09-02 Thread Benji York
st recent call last): > File "", 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 st

Re: learning python

2005-09-04 Thread Benji York
gt;>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

Re: Getting the bytes or percent uploaded/downloaded through FTP?

2005-09-05 Thread Benji York
x27;*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

  1   2   >