swer on a platter, so you'll actually learn something.
Kudos to you for actually attempting it and posting your code though. ;-)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
your hide and tide you over until you can learn to use a source code
control system (I highly recommend Subversion as both free and
effective). ;-)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
http://web.archive.org/web/20040214101340/www.timo-tasi.org/python/timeoutsocket.py
(Give it time, it has to retrieve it from some massive offline storage
or something. Might take a minute or two to come up.)
I'll leave it up to you to figure out which one is the most recent version.
-Pet
upplied in the parameters
> of the function call was 2 or 3, because "a", "e", 8, and "b" is repeated 2
> or 3 times.
Why would it return 1? Is that instead of True, or does it represent a
count of items, or the position of something in the list, or what?
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
)
or
[list(t) for t in zip(*a)] if you need lists instead of tuples.
(I believe this is something Guido considers an "abuse of *args", but I
just consider it an elegant use of zip() considering how the language
defines *args. YMMV]
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
ly describing the conditions
that led to that failure too (i.e. your input file, etc).
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Joseph Garvin wrote:
> Peter Hansen wrote:
>
>> (I believe this is something Guido considers an "abuse of *args", but
>> I just consider it an elegant use of zip() considering how the
>> language defines *args. YMMV]
>>
>> -Peter
>>
>&g
[], default_contents=[])
>>> foo.add(1)
>>> foo.addDefault("x")
>>> foo
SomeClass(contents=[1], default_contents=['x'])
>>>
>>> bar = SomeClass()
>>> bar
SomeClass(contents=['x'], default_contents=['x'])
>>> bar.add(2)
>>> bar
SomeClass(contents=['x', 2], default_contents=['x'])
Peter
--
http://mail.python.org/mailman/listinfo/python-list
override the implementation of _getlongresp() to do what you need. The
best way to learn about this sort of thing is to view the source
directly and read...
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Jesse Noller wrote:
> for f in os.listdir(os.path.abspath(libdir)):
> module_name = f.strip('.py')
> import module_name
>
> Obviously, this throws:
> ImportError: No module named module_name
>
> Is there some way to do this?
Use the __import__ builtin function.
--
http://mail.python.org
Richard wrote:
> On Wed, 13 Jul 2005 20:53:58 -0400, Peter Hansen wrote:
>>a = ((1,2), (3, 4), (5, 6), (7, 8), (9, 10))
>>zip(*a)
> This seems to work. Thanks.
>
> Where do I find documentation on "*args"?
In the language reference: http://docs.python.org/ref
# correct
button = Tkinter.Button(..., command=some_function,...)
to pass the *function* to the widget instead of the *result* of a function
call. And, next time, remember to post some code alongside with your
question.
Peter
--
http://mail.python.org/mailman/listinfo/python-list
here
know the API call required, so by not mentioning it you're severely
limiting the number of answers you are likely to get.)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Have you tried using pycurl? That may be an easier way to port over your CURL
code directly. Relatively easy to use, too.
-Pete
[EMAIL PROTECTED] wrote:
> Hi,
>
> Sorry to post what might seem like a trivial problem here, but its
> driving me mad!
>
> I have a simple https client that uses h
o, does the same thing happen
if you use the interactive interpreter to read the file "manually"?
These are all basic troubleshooting techniques you can use at any time
on any problem...
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
;list(%s for __ in [seq]
%s)" % ('+'.join(L[:num]), 'for %s in __ ' * num % tuple(L[:num])))
# (there are spaces at any line breaks above)
>>> cartesian('abcde', 6)
['aa', 'ab', 'ac', 'ad', 'ae', 'ba',
...
'ec', 'ed', 'ee']
>>> len(_)
15625
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
se Jasen Orendorrf's "path" module which
will make all your path-related code half the size and twice as easy to
read and write.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Urlopen error - (7, 'getaddrinfo failed')
It means their tracker is overworked. Nothin you can do
about it.. let it run.. it should start workin sooner or
later.
--
http://mail.python.org/mailman/listinfo/python-list
(though harmless), because of the arrival of "generator
expressions" in the language. (Bengt knows this already, of course, but
his brain is probably resisting the reprogramming. :-) )
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano wrote:
> On Sat, 16 Jul 2005 10:25:29 -0400, Peter Hansen wrote:
>>Bengt Richter wrote:
>>
>>> >>> identity = ''.join([chr(i) for i in xrange(256)])
>>
>>And note that with Python 2.4, in each case the above square b
t to mention undocumented. (At least in the
string module docs.) Where did you learn that, George?
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Jp Calderone wrote:
> On Sat, 16 Jul 2005 19:01:50 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote:
>> George Sakkis wrote:
>>>>>> identity = string.maketrans('','')
>>
>> Wow! That's handy, not to mention undocumented. (At
George Sakkis wrote:
> "Peter Hansen" <[EMAIL PROTECTED]> wrote:
>>>> Where did you learn that, George?
>
> Actually I first read about this in the Cookbook; there are two or three
> recipes related to string.translate. As for string.maketrans, it
> d
27;getmtime', 'defpath',
'dirname', 'isfile', 'supports_unicode_filenames', 'pathsep', 'getsize',
'samestat', 'split', 'devnull', 'islink', 'curdir', 'samefile', 'realpath',
'commonprefix', 'abspath', 'normcase', 'getatime', 'isdir', 'join',
'altsep', 'getctime', 'isabs', 'normpath', 'ismount', 'splitdrive',
'extsep'])
Peter
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano wrote:
> On Sat, 16 Jul 2005 16:42:58 -0400, Peter Hansen wrote:
>>Come on, Steven. Don't tell us you didn't have access to a Python
>>interpreter to check before you posted:
>
> Er, as I wrote in my post:
>
> "Steven
> who i
read from the main thread or another one,
> and
> have no idea how to do it.
If this external call into the C++ module is "long running", and doesn't
itself provide a way to terminate before it's done, you can't do what
you want unless you use a separate proc
which you replied. Anyone who was not interested
in the Python Programming Contest thread is unlikely to have seen your
question.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
JZ wrote:
> I think Django is more mature than Subway or CherryPy and can quickly
> become the black horse in area of pythonic frameworks.
I'm not familiar with this expression. What do you mean by "black horse"?
--
http://mail.python.org/mailman/listinfo/python-list
-goto technique will be
more appropriate in Python.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Gerhard Haering wrote:
> On Mon, Jul 18, 2005 at 09:06:21AM -0400, Peter Hansen wrote:
>>I'm not familiar with this expression. What do you mean by "black horse"?
>
> Maybe "the Ferrari of pythonic frameworks" (black horse on yellow
> background bein
On 18 Jul 2005 07:52:06 -0700, Jason <[EMAIL PROTECTED]> wrote:
> How do I form a new wxPython date using day, month and year?
>
> I've tried the wx.DateTimeFromDMY but it crashes in Pythonwin when I
> test it out and I get all manner of complaints when I try it from the
> command line.
>
> Surel
On 7/18/05, Jeremy <[EMAIL PROTECTED]> wrote:
> I am using regular expressions and I would like to use both
> re.IGNORECASE and re.VERBOSE options. I want to do something like the
> following (which doesn't work):
>
> matsearch = r'''^\ {0,4}([mM]\d+) '''
> MatSearch = re.compile(matsearch, re.VE
Michael Ströder wrote:
> Peter Hansen wrote:
>
>>>>>''.join(chr(c) for c in range(65, 91))
>>
>>'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
>
>
> Wouldn't this be a candidate for making the Python language stricter?
Why would that be t
ction
> ends.
Basically that is correct. Anyway, threads in Python are trivial to
play with, even at the interactive prompt, so why not just try them out
and see how things go?
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Chad wrote:
> I have installed a TWAIN module(from
> http://twainmodule.sourceforge.net) today and figured out how to
> acquire an image. The only problem is that the image is way too large
> in terms of filesize. It is over 1MB.
>
> I can do either one of two things. Try to figure out how to m
n't
installed something else that magically changed the behaviour of Ctrl-Z?
(I get the documented behaviour with Python 2.4.1, under Win XP.)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
pment could access yours
in order to test out the script as we write it. ;-)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
gate just that
issue: how to capture text from a console window in Win32. I don't
recall the answer but I'm sure you can find it.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Sybren Stuvel wrote:
> Mike Meyer enlightened us with:
>
>>>I dislike gotos because it is too easy to inadvertently create
>>>infinite loops. <10 WINK; 20 GOTO 10>
>>
>>And it's impossible without them?
>
>
> I thought the same thing, but then I read it again and thought about
> the "inadverten
if you
need help finding them.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
7;s New in Python X.Y" pages that are
released with new versions of Python, to stay current. Then read them
again a few months later. Then again when you finally get around to
installing the new version (if you lag behind). And again a few months
later... ;-)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
, surely you aren't arguing that
what wx does is somehow unusual or bad.)
Or are you simply saying that parts of wx are slow and take a while to
complete operations? If that's all, I haven't seen such behaviour...
what areas are of concern?
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
to import
alpha, then alpha.beta, then alpha.beta.gamma... read the source for the
strategy that is actually taken if you really care.
Peter
--
http://mail.python.org/mailman/listinfo/python-list
ten
using "path" is much easier to read, not necessarily much easier to
write (for non-newbies).
I'd summarize this by saying that the integration of "path" in the
stdlib would make it easier for newbies to write code (that might not be
obvious to a non-newbie...
Jp Calderone wrote:
> On Thu, 21 Jul 2005 02:33:05 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote:
>> (And since there is even a wxPython main loop
>> integrated with and provided in Twisted, surely you aren't arguing that
>> what wx does is somehow unusual o
You could use a sniffer in promiscuous mode. pypcap -- or something
like. This will record every packet seen by your network card. Whether
is will work depends on whether you are on a true braodcast network.
if a box is on and completely inactive you'll never see it, but most
boxes do something
Steven D'Aprano wrote:
> It may shock some people to learn that difference in the sense of
> mathematical subtraction is not the only meaning of the word, but there
> it is. One wouldn't, I hope, misunderstand "What is the difference
> between spaghetti marinara and spaghetti pescatora?" and att
t connection, though it's clear what things
you might be losing.
-2 for this idea.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
h object, but it's worth
considering that you might adopt a different opinion after using it for
a while.
I did.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Francois De Serres wrote:
> hiho,
>
> what's the clean way to translate the tuple (0x73, 0x70, 0x61, 0x6D) to
> the string 'spam'?
>>> mytuple = (0x73, 0x70, 0x61, 0x6D)
>>> ''.join(chr(v) for v in mytuple)
'spam'
--
http://mail.python.org/mailman/listinfo/python-list
Remember that you need to import "sys" before you can access that, and
that the values will be returned as strings, so if they should be
treated as numbers it's up to you to convert them.
Use of the getopt or optparse modules is recommended to work with
command line arguments m
P Tablet
Edition 2005 (SP2).
I've never had the slightest problem running any kind of Python program
due to it being a tablet.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
classes of basestring,
aren't they?
And current code should have exactly the same issues when using str or
unicode in all the calls that path() merely wraps.
So does it matter in practical use when one faces this issue and is
*not* using "path"?
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Stefan Rank wrote:
> (It would be nice to get `path`(s) easily from a `file`, at the moment
> there is only file.name if I'm not mistaken).
When files are opened through a "path" object -- e.g.
path('name').open() -- then file.name returns the path object tha
t;
> path(u'a/bc/d')
Just a note, though you probably know, that this is intended to be
written this way with path:
>>> p / q
path(u'a/b/c/d')
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
d do it differently the next time.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Michael Hoffman wrote:
> Peter Hansen wrote:
>
>> When files are opened through a "path" object -- e.g.
>> path('name').open() -- then file.name returns the path object that was
>> used to open it.
>
> Also works if you use file(path('na
ou need is a string with the path to the
> file.
Which this should do:
os.chmod(outfile.name, 0700)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
e, these changes
seem to me somewhat arbitrary. .bytes() and friends have felt quite
friendly in actual use, and I suspect .read_file_bytes() will feel quite
unwieldy. Not a show-stopper however.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
either absolute or relative, but cannot be both at
the same time.
This is therefore not an issue of "representation" but one of state.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Reinhold Birkenfeld wrote:
> Peter Hansen wrote (on Paths not allowing comparison with strings):
>>Could you please expand on what this means? Are you referring to doing
>>< and >= type operations on Paths and strings, or == and != or all those
>>or something else
On 7/19/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Is anyone know about a DB form generator unit under wxPython ?
> What that's means ?
>
> I add information about a Query, or a ListOfDict, I set some other infos
> (Lookups, others), and it is generate a Form with edit boxes, listboxes,
>
Point taken. What about ditching the "file" part, since it is redundant
and obvious that a file is in fact what is being accessed. Thus:
.read_bytes(), .read_text(), .write_lines() etc.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Reinhold Birkenfeld wrote:
> Peter Hansen wrote:
>> if mypath.splitpath()[0] == 'c:/temp':
vs.
>> if mypath.splitpath()[0] == Path('c:/temp'):
>
> But you must admit that that't the cleaner solution.
"Cleaner"? Not at all. I&
Steven D'Aprano wrote:
> Still, the subject is rapidly losing whatever interest it may have had.
It had none. Kill it. "Kill the witch!"
--
http://mail.python.org/mailman/listinfo/python-list
On 7/24/05, Torsten Bronger <[EMAIL PROTECTED]> wrote:
> Is PyGTK more Pythonic by the way? I had a look at wxPython
> yesterday and didn't like that it has been brought into the Python
> world nearly unchanged. You can see its non-Python origin clearly.
> How does PyGTK feel in this respect?
T
the last line and that line is missing a trailing
newline
line[:-1]
mutilates 'zymotechnics' to 'zymotechnic'. In that case the dictionary would
contain the key 'ccehimnotyz'. Another potential problem could be
leading/trailing whitespace. Both problems can be fixed by using
line.strip() instead of line[:-1] as in Robert Kern's code.
Peter
--
http://mail.python.org/mailman/listinfo/python-list
r, it works now, so I'm happy.
Happy as long as you don't know what happened? How can that be?
Another guess then -- there may be inconsistent newlines, some "\n" and some
"\r\n":
>>> garbled = "garbled\r\n"[:-1]
>>> print &quo
he ".connect" method passing connection
> name, resulting in a connection without the pop up list with connection
> names?
TCP connections don't normally have any "connection name", so this must
be a platform-specific question. Have you thought of asking
t; your existing product when that happens? Re-train on a new platform,
> and re-write from scratch?
Port it to FreePascal :)
--
-------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mai
sonably prefer .rstrip() (which removes
only from the right-hand side, or end), or even something like
.rstrip('\n') which would remove only newlines from the end.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
= scripts / self.config['system']['commandfile']
instead of what used to be:
scripts = userfolder.joinpath(scriptfolder)
scriptpath = scripts.joinpath(self.config['system']['commandfile'])
Even so I'm only +0 on it.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
quot;base", such as "basename".
-1 on that specific name if it could be easily confused with "basename"
types of things.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
framework are a different story. As with most Open Source projects,
such code is in flux and one uses it at one's own risk (reporting, I
hope, bugs that are encountered so that they can be fixed).
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
should it raise
ValueError or TypeError or something if it's not a basestring?
Given that pretty much *everything* in Python can have str() called on
it, I think we should ask for a modicum of type-safety here and reject
non-strings as input.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Reinhold Birkenfeld wrote:
> Peter Hansen wrote:
>> Would basestring() be a better name?
> "tobase"?
> "tostring"?
> "tobasestring"?
Of these choices, the latter would be preferable.
> Alternative is to set a class attribute "Base&
ctly supported by Python, so if it's
possible it is going to be found in the docs or the mailing list for the
Series 60, not (unless you strike it lucky) in comp.lang.python.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
start command using "start /?" at a DOS prompt.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
ommand line for the call to myfile.bat, exactly as though
it had been executed manually with the same input.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
is concerned.
The issue with that is that as long as we are subclassing strings, the +
is already defined for a useful operation and the subclass probably
shouldn't be changing the way that works.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
#x27;t make the slightest attempt to
find this information on your own, and I know the question has been
asked many times before, so I really think you can find what you need
with Google, but if not, please at least tell us where you've tried to
look so we can then improve the resources ava
cceed. I
> have confirmed that it's not a naming conflict (i.e., there's not some
> other Python module also named "test").
Are you certain? The way to check is with "test.__file__" after
importing test. There _is_ a standard library package called test, and
Dan wrote:
>>>no executable code in
>>>__init__.py is executed, even though "import test" seems to succeed.
>
> I've discovered that "import test" *does* cause executable code in the
> package to be executed. However, I can't execute it on the command line
> using "python test". Is there a way to
7;s no excuse for not
experimenting for an hour first...
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
e case of multiple inheritance.
Also note that often (usually) you would like the __init__ call to come
*before* other location initializations, and it's the safest thing to do
unless you have clear reasons to the contrary.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
On 26 Jul 2005 12:44:13 -0700, Ernesto <[EMAIL PROTECTED]> wrote:
> Would anyone know a good place to start for learning how to build
> simple GUI's in Windows XP? I just want users to be able to select a
> few parameters from a pull-down menu, then be able to run some batch
> files using the par
dules, which
get bundled by your builder tool and are therefore installed
transparently along with your app by your installer, this is a total
non-issue at least with those packages.
After all, it's not 1970 any more. ;-)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
And "property" (the way you are using it) is spelled "attribute".
In Python, properties are something else, similar to but more than just
attributes.
Use of such terms according to conventional Python usage will in future
make it somewhat easier to be understood and for you to understand the
responses.
Cheers,
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
om the
remainders, adapt your cover letter to *custom-fit* each opportunity.
Mass-mailed resumes with generic cover letters are a good way to kill
trees but not a particular effective way to get noticed by an employer,
at least not noticed in a good way...
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
here errors are not raised.
(While the issue of "addition" vs. "join" is merely a (human) language
issue... one could just as well say that those two numbers are being
"joined" by the "+".)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I'm looking for an advanced concurrency module for python and don't seem
to be able to find anything suitable. Does anyone know where I might
find one? I know that there is CSP like functionality built into
Stackless but i'd like students to be able to use a standard python build.
I'm tryi
it's truly just an alias you want, then something like this should
work better. Replace everything in the if mo: section with this:
if mo:
newName = mo.group(1)
existingName = mo.group(2)
existingMethod = getattr(self, 'do_' + existingName)
setattr(self, 'do_' + newName, existingMethod)
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
file of
> the pySerial package to hang for a few seconds, then return.
Are you certain it is this line that is blocking, and not the preceding
line which is a call to SetCommTimeouts()? How did you prove which line
it is? (I don't have an answer to the problem, just wanted to
es.
In none of my own serial-based programs (perhaps a few dozen such to
date) have I ever opened and closed a port other than at startup and
shutdown (just as your C++ program does). Unless you've got a good
reason to do otherwise, if this solves your problem it's certainly the
working on at the time, but such is the nature of Zen.
It also applies to Motorcycle Maintenance, of course... (as in "Zen and
the Art of").
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
y separate layer on top of the existing Cmd stuff, probably
through overriding .default() and doing a lookup in a dictionary, then
building a command line with the original command and maybe executing it
with .onecmd() if that can work from within the .cmdloop(). Lots of
possibilities there; haven
return
while 1:
yield None
seqs = [chain(seq, done_iter()) for seq in seqs]
return izip(*seqs)
Whether we ran out of active sequences is only tested once per sequence.
Fiddling with itertools is always fun, but feels a bit like reinventing the
wheel in this case. The only excuse being that you might need a lazy
map(None, ...) someday...
Peter
--
http://mail.python.org/mailman/listinfo/python-list
Cheers Guys,
I have come across twisted and used in async code. What i'm really
looking for is something that provides concurrency based on CSP or pi
calculus. Or something that looks much more like Java's JSR 166 which is
now integrated in Tiger.
Peter Tillotson wrote:
> Hi,
>
r of opinion.
I find the former more readable. Somewhat. Not enough to make a big
deal about it.
I can live with the latter, but as *someone who has used the path module
already* I can only say that you might want to try it for a few months
before condemning the approach using / as being unacceptable.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
d (and caught or not) in a
Thread do not have any effect on the main thread, and thus don't affect
the interpreter as a whole.
-Peter
--
http://mail.python.org/mailman/listinfo/python-list
2601 - 2700 of 9344 matches
Mail list logo