readline 4.0 and 4.2, so version 4.3
should be sufficient. So let me ask you again, you have both the readline
and the readline-devel package installed? If yes, and configure still
complains, it may be time to look for something entirely different...
Peter
--
http://mail.python.org/mailman/lis
tertools import imap
>>> items_a = List(items, attrgetter("a"))
>>> items_a
<__main__.List instance at 0x402ae2cc>
>>> items_a[2]
2
>>> list(items_a)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> items[2] = A(42)
>>> items
[A(0), A(1), A(42), A(3), A(4), A(5), A(6), A(7), A(8), A(9)]
>>> items_a[2]
42
Peter
--
http://mail.python.org/mailman/listinfo/python-list
all last):
File "", line 1, in ?
File "arbitrary.py", line 2, in ?
import not_there
ImportError: No module named not_there
>>> import arbitrary
Traceback (most recent call last):
File "", line 1, in ?
File "arbitrary.py", line 2, in ?
import not_there
ImportError: No module named not_there
>>>
Peter
--
http://mail.python.org/mailman/listinfo/python-list
with what
appear to be a random collection of wild predictions about
the future, and Python is barely mentioned in any case.
Perhaps you could take the time to write a little about
just *what* you found so "Amazin"...
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Possibly do not use the name "re.py" for your own module, as it
is the name of a standard library module as well.
At least, that's what an analysis of line 81 of "textwrap.py"
suggests might be your problem. Do you have a module named
"re.py"?
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
"re" kicking around that shouldn't be
there, or cx_freeze is doing something weird... at least,
those are the only theories that come to mind.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
xtwrap.py module is being imported by cx_freeze, it is
not finding the correct "re" module when it imports it.
I don't know anything about cx_freeze, and I don't have
an appropriately configured Linux box to help troubleshoot,
so I can't help further, but maybe somebody else
s to a function like
ftp_connect(ip, port, user, pw) etc...? I have no idea how to "break"
the string up so I can get these out of it..
The .split() method of strings should work for you.
If you need more, provide more background... and maybe
let us know that this isn't homework. ;-)
-P
a function, though:
$ cat epsilon.py
def loop():
epsilon=0
S=0
while epsilon<10:
S=S+epsilon
epselon=epsilon+1
print S
$ pychecker epsilon.py
Processing epsilon...
Warnings...
epsilon.py:6: Local variable (epselon) not used
Peter
--
http://mail.python.org/mailman/listinfo/python-list
ogram with pychecker.
--
---
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
---
--
http://mail.python.org/mailman/listinfo/python-list
Arthur wrote:
Steve Holden <[EMAIL PROTECTED]> wrote:
Would there, I wonder, be any enthusiasm for a "Best Xah Lee impression"
prize at PyCon?
And the rules of the game, if he shows?
Arthur, if Xah Lee shows up at Pycon, he most definitely will
not be giving the best impr
Luis M. Gonzalez wrote:
Peter Hansen wrote:
Arthur wrote:
And the rules of the game, if he shows?
Arthur, if Xah Lee shows up at Pycon, he most definitely will
not be giving the best impression...
Have you visited his website?
I kind of like this guy... it's like he has a few bugs in his
Got a strange scenario going on here in that I could have sworn this worked
yesterday. I am issuing binary retrieval calls to an FTP server, writing to a
file, close the file, then removing the file from the remote site. When I do
this, I end up with 0 byte files. I was hoping to avoid parsing a
n those cases (although I
personally would prefer a different name than "Error")
there's often no good alternative to making your own
unique module-specific Exception subclass.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
to need to base an
exception on a new-style class, but perhaps you have a
good one...
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
> Thanks again for your help! :)
You're welcome.
Peter
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Feb 02, 2005 at 11:47:41PM -0500, Caleb Hattingh wrote:
> Hi Alex
>
> Assuming you have a file called "data.txt":
>
> ***
> f = open('data.txt','r')
> lines = f.readlines()
> f.close()
> for line in lines:
> print line
> ***
>
Can you not write this:
f=open("data.txt", "r")
for line
gt; text = "gamma"
>>> classes[0]()
gamma
<__main__.T instance at 0x402a9f8c>
One way to fix this is to introduce a factory function:
>>> def make_class(text):
... class T:
... def __init__(self): print text
... return T
...
>>> cla
Peter Nuttall wrote:
> On Wed, Feb 02, 2005 at 11:47:41PM -0500, Caleb Hattingh wrote:
>> Hi Alex
>>
>> Assuming you have a file called "data.txt":
>>
>> ***
>> f = open('data.txt','r')
>> lines = f.readlines()
>
f "user folders" named like "C:\Documents and Settings\Peter"
and prefer to create sensible folder like c:\users\peter
and set a HOME variable to point to it. Your approach
ignores our HOME variable.
c:\>python
Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)
Bernhard Herzog wrote:
Peter Hansen <[EMAIL PROTECTED]> writes:
Miki Tebeka wrote:
Hi all, I'm trying to write a multiplatform function that tries to
return the actual user home directory.
...
What's wrong with:
from user import home
which does about what your code does.
:-)
I s
Mabon Dane wrote:
I am new to python and took my first attempts at working with this
language today. Is there a market for people who work with Python?
Yes.
--
http://mail.python.org/mailman/listinfo/python-list
ot;fileobject.c")' 'while 1:' ' if not
f.readline(): break'
100 loops, best of 3: 2.08 msec per loop
So not only is
for line in file(...):
# do stuff
the most elegant, it is also the fastest. file.readlines() comes close, but
is only viable for "small" files.
Peter
--
http://mail.python.org/mailman/listinfo/python-list
ariable substitution generally or
ever has "lazy evaluation" semantics...)
Now that I know how to do what Duncan described (thanks
Duncan!), either approach works for me. Of course,
whether I'm a likely eventual user of your particular
program is an entirely different question. ;-)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
s not None:
return item or True in it
Not as elegant as max(), but makes me wonder whether a max() that accepts an
additional upper_bound argument and returns upper_bound as soon as it
encounters a value >= upper_bound would be worth the effort.
Peter
--
http://mail.python.org/mailman/listinfo/python-list
Alexander Zatvornitskiy wrote:
> ÐÑÐÐÐÑ Peter!
>
> 31 ÑÐÐÐÑÑ 2005 Ð 09:09, Peter Otten Ð Ñ ÐÐÑÑÐÐ Ð All
> ÐÐÑÐÐ:
> PO> pychecker may help you find misspelled variable names. You have to
> PO> move the code into a function, though:
>
> PO> $ cat
might be trying to
profit from your efforts without your permission, you'll either be in a
good position to ignore them or sue them, as you will
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Torsten Bronger wrote:
> Peter Hansen <[EMAIL PROTECTED]> writes:
>>What's your use case for del?
>
> Every instance represents a "session" to a measurement instrument.
> After the instance is deleted, the session should be closed to free
> resources.
Yo
if you use the
"threading" module, as is recommended, you won't have to deal with this
issue at all, and your code will generally be simpler.
(To answer your real question I'd have to check the docs for "thread"
and, since I _never_ use that module in spite of heavy use
Maxwell Hammer wrote:
> On Thu, 16 Jun 2005 16:20:23 -0400, Peter Hansen wrote:
>>If the question was well formulated, and it's been more than a couple of
>>days, you should consider reposting. It's very unusual for a post with
>>such a subject (if it was a clear
avy of a project to learn the language?
Not at all, provided you're somewhat expert in the domain already, and
are just using it as a means to help learn Python.
If you are learning both Python and how to break ciphers at the same
time, I'd personally call it a "little" he
D H wrote:
> Peter Hansen wrote:
[some stuff Doug didn't like]
> I don't think you could have misread my simple suggestion to you any
> more completely than you did.
Sorry, I'll try harder next time.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
asking.
Yes, it's an appropriate way to use popen(), and it does seem to work if
you have tai64nlocal in your path.
(Michael, tai64nlocal is a program that converts a special "packed"
timestamp to human-readable form. These timestamps are created, as I
recall, by the multilog program that the developer of Qmail created.)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
D H wrote:
> Peter Hansen wrote:
>> With respect to the author, and an understanding that there is
>> probably much that didn't go into his self-description (add
>> "about.htm" to the above URL), it sounds as though he knows primarily,
>> perhaps
l_name TEXT,
rootpage INTEGER,
sql TEXT
);
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
ng on
the second is entirely up to you. ;-)
(I recall hearing of at least one programmer who made his first million
around the age of 14 after having written some brilliant game back in
the days of Apple IIs and C-64s. These days I'd be surprised if 14 was
still the lower limit for millionair
it and, unfortunately,
unreliable nature of __del__. (Which is probably the real wart in
Python, unfortunately.)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
working
directly with you. I guess you'll have to explore the __del__ approach
through to its conclusion before you'll be confident it won't work (or
perhaps you'll find a solution after all!).
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
follows, but you'd do
well to read all the entries:
http://www.python.org/doc/faq/programming.html#is-there-an-equivalent-of-c-s-ternary-operator
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
en source movement
continues to prove successful.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
they avoid making themselves look like complete and utter fools by
appearing to learn only by looking up things in the index.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
D H wrote:
> Peter Hansen wrote:
>> Bo Peng wrote:
>>
>>> I need to pass a bunch of parameters conditionally. In C/C++, I can do
>>> func(cond1?a:b,cond2?c:d,.)
>>>
>>> Is there an easier way to do this in Python?
>>
>> Please read
arithmetic problems of various types.
>
> The target of the problems (my daughter) would prefer that the thousands
> be delimited. Is there a string function that does this?
You refer to something like putting a comma between groups of three
digits, as in 1,000? This is locale-specifi
t ZODB). I believe Durus is pure Python, but it might have
some C code for performance (like ZODB). It's not SQL, and should
perhaps be thought of (as it describes itself) as an object persistence
solution, rather than a "database".
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
a .pyd which contains a
statically linked version of the complete SQLite library. No additional
installation is required, making it an even simpler solution than I
thought at first.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
king into that file, a suspiciously named ModuleScanner class is right
over there. Now what is your excuse for not finding it yourself in the
first place? You seem to be on Linux, so "That's not how I do it with
Visual Basic" can't be it :-)
Peter
--
http://mail.python.org/mailman/listinfo/python-list
Simon Brunning wrote:
> On 6/15/05, Peter Hansen <[EMAIL PROTECTED]> wrote:
>>__repr__ shouldn't be anything, if you don't have an actual need for it.
>> Neither should __str__.
>
> Oh, I don't know. __str__ is so frequently useful in debugging and
&g
Xah Lee wrote:
> the doc seems to suggest that eval is only for expressions... it says
> uses exec for statements, but i don't seem to see a exec function?
Because it's a statement: http://docs.python.org/ref/exec.html#l2h-563
--
http://mail.python.org/mailman/listinfo/python-list
you were fishing for
compliments:
Your English IS good enough.
;)
--
-------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1
In the case of bitmaps, this
might well be a deciding factor, but each case should be addressed on
its own merits.)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
confirmation socket will
> arrive in the correct order (one after each sended socket)?
No more so than using threads, unless your problem is caused by the
threads themselves (as I suggested above) in which case it might be
easier to just fix the problem.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
w.afilias.info/cgi-bin/whois.cgi .
(It's registered to something called the Institute of Pamela, which
seems to stand for "Peaceful Alliances facilitated by Multilingual,
multiracial Education, handicapable outreach and native Language
Accessibility". I think this thing really
he socket, connect to the server, communicate,
close it down, and go back to waiting all in one place (so to speak...
of course this would be several methods all called from a top-level loop
in that thread). No chance of mis-steps.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Isaac Rodriguez schrieb:
> Does anyone know of a Python API to manipulate CAB files?
If there is a Windows API you can probybly call it from Python
using Mark Hammond's Win32 extensions.
--
---
Peter Maas, M+R Infosys
" module, all this code basically collapses
down to this beauty (with your variable "path" renamed to myPath to
avoid a name collision):
from path import path
dirs = path(myPath).abspath().dirs()
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
atures to see
that it really does what you need.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
re should be
listdir(path, with_path=False)
and cater absolute and relative paths alike.
The need for such an enhancement is not particularly pressing, as
workarounds abound. Here's another one:
>>> glob.glob("/usr/lib/games/../games/*")
['/usr/lib/games/../games/schwarzerpeter']
Peter
--
http://mail.python.org/mailman/listinfo/python-list
#x27;t consider it
outright to be a Bad Thing. I'd say more on the issue, if I knew
anything that I hadn't just read in the documentation. ;-)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
As Konstantin alludes, your request is not specified clearly enough.
In all-caps you write "APPLICATION MONITORING SYSTEM", yet your only
use-case is "it lets the it employee enter the name of the application
and gives him all the details about it", where "the details are ... " a
bunch of fields th
Reasonable enough. As per Mike's suggestion below, building a few web
pages to document the apps is a good start. To expand on that idea,
you could write daemons/cron jobs, perhaps in Python if Python runs on
OS/400, that monitor each app's status and log that information to the
web server. You
rate lines must mean that there was whitespace between them, or the
line break would have occurred before the ' ... but it did seem like a
good theory while it lasted. ;-)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
some of the introspection features available in the
"inspect" module.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
even be able to get
support from Microsoft's update site (such as if you have to reinstall),
isn't it time to move on?
to Linux...
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
essarily release any memory back to the
operating system, and it won't necessarily unload any extension modules
or other shared libraries that are loaded. The whole concept of
"unloading" a module is pretty much undefined in Python, so whatever you
can get is the best you ca
earch for Python web
frameworks. There are perhaps dozens -- though less than a dozen really
popular ones -- and most will do what you want, going by the most
general interpretation of your question. (If you're talking about
duplicating whatever specific architecture appeals to you in
John Machin wrote:
> Peter Hansen wrote:
[sample code]
> Ummm ... doesn't appear to scale well for multiple modules and multiple
> attributes & functions.
It certainly wouldn't! :-) I was posting mainly to elicit more
information, since clearly you wouldn't get
; green := 0
What do you think this actually does?
It doesn't do anything remotely resembling either of the things quoted
above. In fact, the "from color import *" line is pretty much useless here.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
rying to see
whether it is obvious that the listen(1) is at fault -- and it's not
obvious. I thought this response might clarify the meaning of listen(1)
a little bit for some folks nevertheless.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
() before one does a socket.close??
Not normally, AFAIK.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
ually a generator expression as the sole
argument to a generic dict() constructor. Think of the generator
expression as sort of like the list comprehension that it resembles,
minus the square brackets, but which doesn't have to create the entire
list before the dict() constructor starts t
Mandus wrote:
> By using the builtin reduce, I
> move the for-loop into the c-code which performs better.
No. There is no hope of ever writing fast code when you do not actually
measure its performance.
Peter
--
http://mail.python.org/mailman/listinfo/python-list
owing the steering wheel out of the window.
Seriously, try to make do with __import__() and getattr() to clean up your
code a bit.
Driving-analogies-well-beyond-the-abyss-ly yours
Peter
--
http://mail.python.org/mailman/listinfo/python-list
Philippe C. Martin wrote:
> OK Peter, first of all thanks.
>
> You seem to be German and although I leave in the states, I'm French and
> your english is clearly far more advanced than mine: I have yet to
> understand a few of your comments ;-)
My French is mostly read-only
he best possible
efficiency you would probably have to code the loop in C. Incidentally, for
add() this has already been done with the sum() builtin.
Peter
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano wrote:
> On Sat, 25 Jun 2005 21:30:26 +0200, Peter Otten wrote:
>
>> Mandus wrote:
>>
>>> By using the builtin reduce, I
>>> move the for-loop into the c-code which performs better.
>>
>> No. There is no hope of ever writ
st recent call last):
File "", line 1, in ?
NameError: name 'alpha' is not defined
>>> beta
The 'right' way to do the imports if you want both 'alpha' and 'beta' is of
course
from package import alpha
from package import beta
Peter
--
http://mail.python.org/mailman/listinfo/python-list
Peter Maas schrieb:
> vielen Dank für die Zusendung der Daten. Es handelt sich allerdings
> nicht um jpeg-Dateien, wie die Erweiterung nahelegt. Wir konnten sie
> nur mit dem PictureViewer auf einem Apple anzeigen. Sie werden unter
> MacOS als Adobe-Photoshop-Dokument angezeigt.
Sor
Dateien als jpegs bekommen oder sollen wir sie selbst
umwandeln?
Mit freundlichen Gruessen,
Peter Maas
--
---
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.deco
Radiobutton):
def __getattr__(self, name):
if name == "selected":
return self.getvar(self["variable"]) == self["value"]
raise AttributeError
Peter
--
http://mail.python.org/mailman/listinfo/python-list
Jorge Louis de Castro wrote:
> Could anyone tell me whether I can find a non blocking alternative to
> raw_input that works on windows? Is there not a python way of achieving
> this? Can I find it somewhere in the documentation?
> Any help will be highly appreciated
Depending on what your requir
Chinook wrote:
> 3) Any other comments you might offer
> if tv == 'relates to A':
> return True
> else:
> return False
Make that
return tv == 'relates to A'
lest your zen master hit you.
Peter
--
http://mail.python.org/mailman/listinfo/python-list
e.zip ;-)
Probably this is not needed, so an additional test (something like
fileName != 'myfile.zip' would be needed.
HTH,
Peter
could ildg wrote:
> I want to compress a folder and all of its sub files including empty folders
> into a zip file. what's the pythoni
C# when doing .net. Basic
is the ugliest and most mind corrupting language I've come across. And
the OP has a C/C++ background.
--
---
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIub
"""
return getattr(self.stream, name)
> At least, it does provide a workaround...
Note that the xreadlines module hasn't made it into Python 2.4.
Peter
--
http://mail.python.org/mailman/listinfo/python-list
man has one term for both 'dandruff' and
'scale' (Schuppe).
Still not funny? at least you have learned some German.
Peter
--
http://mail.python.org/mailman/listinfo/python-list
Andreas Heiss wrote:
> However, there are no tcl.h and tk.h header files. I haven't ssen those
> files since Tcl/Tk8.0
You may also need to install the development packages (tk-devel and
tcl-devel on Suse)
Peter
--
http://mail.python.org/mailman/listinfo/python-list
ld avoid duplicate state and require only log N instead
of N bits. Wouldn't that be an elegant implementation, at least in theory?
So why bother about the layers below when you have all the information to
write code that works?
Peter
--
http://mail.python.org/mailman/listinfo/python-list
t of the "mainstream of current programming", even if you're the
one doing it...
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Matteo Memelli wrote:
> Hi, I'd like to know if it is possible to use the threading module to
> benchmark a web server.
> Do you think that using the Threading module would be a good idea?
> Any other suggestion?
This sounds like a good time to use Twisted instead of "thread
ing. You are looking
for the capability provided by "domain name servers" (DNSes), not
"whois" servers. But Thomas has just given you the solution...
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
se:
>>> class C:
... def __setattr__(self, e, v):
... print 'setting %s to %s' % (e, v)
... self.__dict__[e] = v
...
>>> o = C()
>>> v = 'mystring'
>>> o.e = v
setting e to mystring
>>> o.e
'mystring'
>>>
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
print
rg = Radiogrid(root,
["alpha beta gamma".split(),
"one two three".split(),
"guido van rossum".split()],
show_state
)
rg.pack()
root.mainloop()
I hope this will move further discussion from the abstract to the
concrete :-)
Peter
--
http://mail.python.org/mailman/listinfo/python-list
Jarek Zgoda wrote:
> Grant Edwards napisał(a):
>
>>> To be blunt, I have no idea what this has to do with Python.
>>
>>
>> Monty Python was mostly Brits?
>
>
> Wasn't they all Brits?
I think one was a lumberjack (but he's okay),
which would make him a Canadian, eh?
--
http://mail.python.org/ma
Elmo Mäntynen wrote:
>
> Peter Hansen wrote:
>>Заур Шибзухов wrote:
>>>Anybody thought about this issue?
>>
>>Perhaps not, but now that you've pointed it out they've taken the time
>>machine back and fixed the problem before it arose:
>
>
w/row 1 selected, and
> accomodates cases where nothing is selected in any column.
Another option would have been to initialize the variables
...
var = tk.IntVar()
var.set(-1)
if trace_write:
...
Peter
--
http://mail.python.org/mailman/listinfo/python-list
muldoon schrieb:
>Now, what forum would you recommend? Any help would be appreciated.
alt.culture.us.*
--
---
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n
e providers, and they're often not interested in providing any
reverse mapping for them. Some do (for example, mine is
pc-136-15.scpe.powergate.ca right now), but many don't...
I'm sure there's a way to identify the domain of the owner of a block of
addresses in which a give
Hi all,
I was wondering if this is possible. In python v2.3 the import systems
was extended via PEP302 to cope with packages. *.py files in a directory
hierarchy can be imported as modules each level in the directory
hierarchy needs to contain at least an empty __init__.py file.
eg. With the file
solution: have to add the zip archives to the PYTHONPATH, can be done in
the env but also as below
import sys, os.path
zipPackages=['base.zip']
for package in zipPackages:
sys.path.insert(0,os.path.join(sys.path[0],package))
import base.branch1.myModule
Peter Tillotson wrote
cheers Scott
should have been
from myZip.zip import base.branch1.myModule.py
and no it didn't work, anyone know a reason why this syntax is not
preferred ??
sorry posted the soln again, it works but feels nasty
Scott David Daniels wrote:
> Peter Tillotson wrote:
>
>> ... Wit
2401 - 2500 of 9341 matches
Mail list logo