'A'?
How about this:
>>> class A:
... X = 2
... print X
...
2
--
Benji York
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
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
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
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
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/
. 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
u have found 0 matches" in pagetext:
print 'yes'
else:
print 'no'
--
Benji York
--
http://mail.python.org/mailman/listinfo/python-list
options see Google (then here if answers are not forthcoming).
--
Benji York
--
http://mail.python.org/mailman/listinfo/python-list
self._command = command
@property
def command(self):
return self._command
--
Benji York
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
[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
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
[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
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
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
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
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
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
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
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
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
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
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
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
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
never used PyGTK, but it looks nice. I've generally stuck with
wxPython.
--
Benji York
--
http://mail.python.org/mailman/listinfo/python-list
ed in
http://wiki.python.org/moin/PythonHosting.
--
Benji York
--
http://mail.python.org/mailman/listinfo/python-list
;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
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
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
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
>>> 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
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
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
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
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
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
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
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
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
[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
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:
something like "set softtabstop=4".
--
Benji York
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
quot;dir{ENTER}")
shell.SendKeys("echo Hi There{ENTER}")
--
Benji York
--
http://mail.python.org/mailman/listinfo/python-list
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
[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
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
[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
--
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
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
(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
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
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
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
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
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
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
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
hon.org/moin/PythonSoftwareFoundationLicenseFaq
--
Benji York
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
s.html#l2h-298
(NotImplementedError)
--
Benji York
--
http://mail.python.org/mailman/listinfo/python-list
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
self.matrix = []
self.estimator = {}
self.wordInfo = {}
self.contextInfo = {}
--
Benji York
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
uthor would like an example so he can "fix" it.
--
Benji York
--
http://mail.python.org/mailman/listinfo/python-list
).
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
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
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
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.
--
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
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
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
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
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
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
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
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
odified: the effects on the
corresponding symbol table are undefined.
--
Benji York
--
http://mail.python.org/mailman/listinfo/python-list
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
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
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
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
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
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 - 100 of 172 matches
Mail list logo