Re: Problem processing Chinese

2005-10-14 Thread Peter Otten
elf to plain ASCII. But if you split your text into a list >>> u.split() [u'\u8bb0\u8005', u'\u8c22\u91d1\u864e', u'\u3001'] you probably think you are back to square one. That is because Python prints the repr() of the list items (otherwise a comma wo

Re: Help with cPickle for deserializing datetime.datetime instances

2005-10-14 Thread Peter Otten
Mingus Tsai wrote: > When these three statements run, the IDLE crashes! Is there a traceback that you can provide (cut and paste)? Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Yes, this is a python question, and a serious one at that (moving to Win XP)

2005-10-14 Thread Peter Hansen
never knew before) have to be disseminated through the grass roots, so to speak. Definitely like the MS world is not set up for real developers easily to be productive. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: get_payload problem with large mail attachments

2005-10-14 Thread Peter Otten
st be string or read-only buffer, not None None seems to be the expected result of get_payload(decode=1) for multipart parts. > if part.get_content_maintype() == 'multipart': > continue Could it be that your test for multipart isn't correct? I would try if

Re: Problems with properties

2005-10-14 Thread Peter Otten
("dir c:", t.command) if __name__ == "__main__": unittest.main() Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing Parallel Port in Python Error : Priviledged Instruction

2005-10-15 Thread Peter Hansen
ost likely to be of help to us, if you can't retype all of it. Also consider reporting on version numbers of things: Python, Pyparallel, WinXP (SP2 for example?), just in case that matters. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get a raised exception from other thread

2005-10-15 Thread Peter Hansen
e completed by the time the thread finishes ... Are you looking, for example, for some kind of thread.waitUntilCompletionAndReRaiseExceptions() method? -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get a raised exception from other thread

2005-10-15 Thread Peter Hansen
would be better if you posted a small amount of code that shows the problem. Exceptions raised in threads can definitely be caught in the run() method if the code is written correctly, so that is not in itself an issue. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get a raised exception from other thread

2005-10-16 Thread Peter Hansen
thread.stop()# block here until the thread exits I hope that clarifies things a little more... -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: TypeError: unbound method PrintInput() must be called with test instance as first argument (got test instance instead)

2005-10-16 Thread Peter Otten
= %s"%(input) # file input_file.py import test CMD = (test.Test.PrintInput, float(2)) # file main.py #!/usr/bin/env python import input_file import test if __name__== "__main__": print "Unit testing" inst = test.Test() CMD = input_file.CMD print CMD cmd = CMD[0] param = CMD[1:] cmd(inst, param) # this was the problematic line Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Python on the Power PC

2005-10-16 Thread Peter Milliken
ry over to my Pocket PC seems to make the file work - thanks for the help! :-) Peter <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm using the same distribution (or at least that is what I started > with). Try using the following sitecustomize.py file: > >

Re: Python on the Power PC

2005-10-16 Thread Peter Milliken
Nope, spoke too soon! The Pocket PC seemed to be doing something and I thought it was OK - obviously you can't just copy "lib-tk" into the Pocket PC Python\Lib directory. What else might I be missing? Peter "Peter Milliken" <[EMAIL PROTECTED]> wrote in message

Re: Question on class member in python

2005-10-17 Thread Peter Otten
perty(getMember) ... def __init__(self): ... self.a = self.b = 42 ... >>> A().member 1764 I. e. you are not trapped once you expose a simple attribute. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get a raised exception from other thread

2005-10-17 Thread Peter Hansen
eption here? I'm quite sure the problem you are trying to solve can be solved, but you are still describing part of the solution you believe you need, rather than explaining why you want to do this (which may let us show you other, simpler or cleaner ways to accomplish your goals). -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: unittest of file-reading function

2005-10-18 Thread Peter Hansen
ut often that's better anyway (decouples file management and parsing). Another approach is to create a "mock file" object. Depending on your needs, this can be a very simple or a very complex thing to do. I can offer more detail/suggestions here if you need. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Dealing with Excel

2005-10-18 Thread Peter Hansen
full access to formatting and all other such features? I would assume it's reasonably well documented and you could just generate that output directly. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: write a loopin one line; process file paths

2005-10-18 Thread Peter Hansen
Xah Lee wrote: > If you think i have a point, ... You have neither that, nor a clue. (Newsgroups line trimmed to reduce the effects of cross-posting trolls.) -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get a raised exception from other thread

2005-10-18 Thread Peter Hansen
one raises a new exception). From what you describe, however, it sounds like you just need to know that the exception occurred, not the precise line of code down in TCPServer() where it was originally raised. I hope that helps and/or gives you some leads on a better solution. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get a raised exception from other thread

2005-10-21 Thread Peter Hansen
(description),title="TCPServer",style=wx.OK | > wx.ICON_ERROR) > return > > Peter, thank you very much. You're quite welcome. It's nice to be able to provide a "perfect" answer, for a change. :-) One suggestion about the above: "description"

Re: Converting 2bit hex representation to integer ?

2005-10-21 Thread Peter Hansen
early. Assuming your input represents a C-style integer (i.e. fixed size) rather than a Python long integer (of arbitrary length), you should be able to use just struct.unpack('i', mybinarydata)[0] to get the result you need... -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs Ruby

2005-10-21 Thread Peter Hansen
Bryan wrote: > Dave Cook wrote: >> Cale? You mean Python has more ruffage? > > i think you mean "kale" not "cale". nothing like a hot bowl of tofu > kale soup while reading the recipes in the "python cookbook". Well, if he's going to talk about "ruffage" instead of "roughage", perhaps he real

Re: C replacement for Queue module

2005-10-22 Thread Peter Hansen
while they are very robust, if your own needs allow putting many items in at the same time, or getting many items out, for example, then perhaps you could come up with a much faster alternative based on the primitives (e.g. Event, Condition, etc) and perhaps some wrapped data structure ot

Re: Listening for keypress in the background

2005-10-22 Thread Peter Hansen
unning under GNOME in Mandrake GN/Linux 10. Search Google for "python keylogger". -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Listening for keypress in the background

2005-10-23 Thread Peter Hansen
Mathias Dahl wrote: > Peter Hansen <[EMAIL PROTECTED]> writes: >>>How can I make it listen for a certain keypress (say, Windows-key + >>>space) in a controlled fashion even when it is not the program having >>>focus? >>> >>>I need to do this ru

Re: C replacement for Queue module

2005-10-23 Thread Peter Hansen
, rewriting the entire Queue in C just to avoid the Python method calls (which have high setup overhead) might be the only real option. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Missing modules '_ssl', 'ext.IsDOMString', 'ext.SplitQName'

2005-10-23 Thread Peter Hansen
and you've tested all areas of it, then you can chalk the above up to a "py2exe feature". -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: wxpython - passing arg to wx.app OnInit

2005-10-23 Thread Peter Hansen
ot;global" and just to access it directly from the Application's OnInit() method. This wiki page demonstrates: http://wiki.wxpython.org/index.cgi/UsingCommandLineArguments -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: How to separate directory list and file list?

2005-10-23 Thread Peter Hansen
>>> from path import path >>> path('.').files() # returns list of files in current dir -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: bsddb version?

2005-10-23 Thread Peter Hansen
u to do the work to find out what it is on Python2.3... I hope you can manage the effort. ;-) -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: wxpython - passing arg to wx.app OnInit

2005-10-23 Thread Peter Hansen
zer wx.App.__init__(self, *pargs, **kwargs) def OnInit(self): # use self.clargs here app = Application(redirect=0, clargs=[dbfn]) or whatever... I just guessed at what you meant to do with dbfn though, but I think the basic idea is clear enough. -Peter -- http://mail.python.or

Re: testing '192.168.1.4' is in '192.168.1.0/24' ?

2005-10-23 Thread Peter Hansen
[EMAIL PROTECTED] wrote: > Is there standard library modules handling this ? currently I need to > turn it into a long integer and do the shift and compare. A little Googling turned up this: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440560 -Peter -- http://mail.python.org/m

Re: testing '192.168.1.4' is in '192.168.1.0/24' ?

2005-10-24 Thread Peter Hansen
hard to prove it without an exhaustive review of the source code. ;-) -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: output from external commands

2005-10-24 Thread Peter Hansen
point of doing "%s" % f? How is this different from just > file = [f for f in glob.glob("*")]? Answering narrowly, the difference is that using "%s" calls str() on the items in the result list, while your suggestion does not. ("Why not just use str(f) instead of the less clear '%s' % f?" would be a valid question too though.) -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Tricky Areas in Python

2005-10-24 Thread Peter Hansen
s. They fit in a similar place in one's mind, anyway -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: python cgi script not understood as html

2005-10-24 Thread Peter Hansen
\r\n, not just with \n. Not sure this is the solution to your specific problem though... -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Tricky Areas in Python

2005-10-25 Thread Peter Hansen
cked out repeatedly by working for companies who were incompetent at terminating for cause (and there are _many_ such companies). (We didn't make the same mistake and fired them reasonably quickly.) -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: more than 100 capturing groups in a regex

2005-10-25 Thread Peter Hansen
Joerg Schuster wrote: > I just want to use more than 100 capturing groups. If someone told me > that it is very unlikely for Python to get rid of the said limitation, > I would recode part of my program in C++ using pcre. It is very unlikely for Python to get rid of the said limitation

Re: Missing modules '_ssl', 'ext.IsDOMString', 'ext.SplitQName'

2005-10-25 Thread Peter Hansen
? It would be very unusual to receive no error message of any kind. If you are getting a message, please post the entire traceback/message here, as we can only guess what's happening. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Execute C code through Python

2005-10-25 Thread Peter Hansen
for > it to run inside the python interface? Google found the following (after I read the docs for subprocess and learned about the "startupinfo" flag, and searched for "subprocess startupinfo"). Does this help? http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/409002 -Peter -- http://mail.python.org/mailman/listinfo/python-list

Embedded Python interpreter, runtime libs, and crashing

2005-10-25 Thread Peter Newman
g configuration works flawlessly. Release is another story altogther. It usually crashes with a segmentation fault or access violation (reading memory address 0). At one point it ran, but the code seemed to be executing in the wrong order (stuff getting called before initialization func

Re: Looping Problem (Generating files - only the last record generates a file)

2005-10-26 Thread Peter Otten
The effect of aligning it with the for-statement is that it is executed only once /after/ the loop has run to completion. At that point town and latlong are still bound to the values they were assigned in the last iteration (with an empty datafile.txt the loop would never be executed and you would get a NameError). Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: replace words

2005-10-26 Thread Peter Otten
atch from .taken ... not. import re s = ("been .taken. it may be .left. there, " "even if the .live coals were not. cleared") r = re.compile(r"\.(.*?)\.") print r.sub(r".start \1 end.", s) Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: more than 100 capturing groups in a regex

2005-10-26 Thread Peter Hansen
Joerg Schuster wrote: > So what? Search in http://docs.python.org/lib/re-syntax.html for "99" and read the following sentence carefully. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Missing modules '_ssl', 'ext.IsDOMString', 'ext.SplitQName'

2005-10-26 Thread Peter Hansen
? > File "xml\dom\ext\reader\__init__.pyc", line 20, in ? > LookupError: unknown encoding: utf-8 Which version of py2exe are you using? Does this page help? http://starship.python.net/crew/theller/moin.cgi/EncodingsAgain -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: help with sending data out the parallel port

2005-10-27 Thread Peter Hansen
ltime control on a non-realtime operating system is generally difficult or impossible, but it does depend on how precise you need to be, and how "soft" your realtime requirements are. My gut feeling is that you cannot achieve what you want using Python on Windows (or Linux!), b

Re: Counting Threads

2005-10-27 Thread Peter Hansen
lobalThreadCount > return GlobalThreadCount Style/usage note: although as I mentioned you don't want to use "global" variables anyway, even if you did the above line is unnecessary. You only need to use "global" if you are going to *rebind* the global name (i.e. assign a new value to it), not if you are merely reading the value and returning it, as above. What you wrote would work, it's just not needed or usual. (But, again, using a global at all is wrong anyway.) -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Automatic binding of **kwargs to variables

2005-10-29 Thread Peter Otten
x27;d like to bind them automatically Why don't you just change the method signature to foo(self, x, y, z, whatever, **kwargs)? Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Scanning a file

2005-10-29 Thread Peter Otten
t much "fiddling" needed, as you can see, and what little "fiddling" >>is needed is entirely encompassed by the generator... >> > Do I get a job at google if I find something wrong with the above? ;-) Try it with a subst of length 1. Seems like you missed an opportunity :-) Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Automatic binding of **kwargs to variables

2005-10-29 Thread Peter Otten
ry and > pollute a function's namespace with arbitrary variables. Some kind of > bunch-like object would seem to be the most satisfactory way to go. Using a bunch doesn't remove the necessity of an existence-test either (for optional attributes). Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Scanning a file

2005-10-29 Thread Peter Otten
;no', 'no', 'no', 'no', 'no'] Ouch. Seems like I spotted the subtle cornercase error and missed the big one. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Automatic binding of **kwargs to variables

2005-10-29 Thread Peter Hansen
d? elif name in expected_form1_kwargs and name not in kwargs: What you wrote doesn't do what you think it does... it actually tests for whether True or False is a key in kwargs, depending on whether "name in expected_form1_kwargs" returns True or False. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Scanning a file

2005-10-30 Thread Peter Otten
David Rasmussen wrote: > None of the solutions presented in this thread is nearly as fast as the > > print file("filename", "rb").read().count("\x00\x00\x01\x00") Have you already timed Scott David Daniel's approach with a /large/ bl

Re: Scanning a file

2005-10-30 Thread Peter Otten
David Rasmussen wrote: > None of the solutions presented in this thread is nearly as fast as the > > print file("filename", "rb").read().count("\x00\x00\x01\x00") Have you already timed Scott David Daniels' approach with a /large/ bl

Re: How do I sort these?

2005-10-30 Thread Peter Otten
> Now suppose we sort the first and use the elements' indices to preserve > order where equal > >>> sorted((f,i) for i,f in enumerate(first)) > [(1, 5), (1, 6), (1, 7), (1, 8), (1, 9), (2, 0), (2, 1), (2, 2), (2, 3), > [(2, 4)] > > Separate out the first list elements: > >>> [t[0] for t in sorted((f,i) for i,f in enumerate(first))] > [1, 1, 1, 1, 1, 2, 2, 2, 2, 2] > > Now select from the second list, by first-element position correspondence: > >>> [second[t[1]] for t in sorted((f,i) for i,f in enumerate(first))] > ['E', 'D', 'C', 'B', 'A', 'J', 'I', 'H', 'G', 'F'] > > Which did the OP really want? ;-) I don't know, but there certainly is no subtle requirement to not provide the key argument: >>> import operator >>> first = [2]*5 + [1]*5 >>> second = list(reversed("ABCDEFGHIJ")) >>> [s for f, s in sorted(zip(first, second))] ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'] >>> [s for f, s in sorted(zip(first, second), key=operator.itemgetter(0))] ['E', 'D', 'C', 'B', 'A', 'J', 'I', 'H', 'G', 'F'] Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Message about not deleted folders using Inno Setup

2005-10-30 Thread Peter Hansen
hon angle to your question, a mailing list or something for InnoSetup would be a more appropriate place to ask. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Scanning a file

2005-10-30 Thread Peter Otten
quence 0010010 the substring 0010 > occurs twice. Coincidentally the "always overlap" case seems the easiest to fix. It suffices to replace the count() method with def count_overlap(s, token): pos = -1 n = 0 while 1: try: pos = s.index(token, pos+1) except ValueError: break n += 1 return n Or so I hope, without the thorough tests that are indispensable as we should have learned by now... Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: looking for a good python module for MS SQL server

2005-11-01 Thread Peter Decker
On 11/1/05, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > Things didn't change, as last update to adodbapi was long time ago... I > had no problems with stored procedures accessed using cursor's execute() > method (i.e. execute('exec sp_someproc, param')), but I never tried to > get any results, just c

Re: Xah's edu corner: the Journey of Foreign Characters thru Internet

2005-11-02 Thread Peter Hansen
trollism, which is anything but well-intentioned. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Flat file, Python accessible database?

2005-11-02 Thread Peter Hansen
iguration steps required, nothing but creating tables (and that's a standard step with any SQL-like database). What environment were you using, and what kind of issues did you encounter? (I ask because I often recommend SQLite, but would like to temper that advice if in some cases these

Re: callback for ctypes

2005-11-02 Thread Peter Hansen
David Wahler wrote: > Also, I can't find any references for this "QImage Camera". Could you > post some additional information? Trying "Qimaging" instead. -- http://mail.python.org/mailman/listinfo/python-list

Re: Importing Modules

2005-11-02 Thread Peter Hansen
? What will you do with the modules once they are imported? Also: the second part of the question doesn't mean anything to me. What do you mean by "conditionals, such as regexes", in the context of importing modules? -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Importing Modules

2005-11-02 Thread Peter Hansen
the above approach would not be "best", but I think that just goes to show that until we know why you want this, we cannot possibly answer your question properly.) -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Py2Exe produced "binary" shows terminal screen on execution

2005-11-02 Thread Peter Hansen
ly replace console=["myscript.py"] with windows=["myscript.py"].''' -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Flat file, Python accessible database?

2005-11-02 Thread Peter Hansen
noying extra setup step. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: reading internet data to generate random numbers.

2005-11-02 Thread Peter Hansen
y speaking, the internet is not "streamed" at all, but perhaps you have some special meaning in mind that isn't in general use. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Hexadecimal Conversion in Python

2005-11-02 Thread Peter Hansen
DaBeef wrote: > I have been coding for 5 years. This is a proprietary protocol, so it > is difficult converting. I did this in java but was just able to > convert a stream. What exactly did you do in Java to get the results you want? Python's library is certainly *not* "limited" in this area,

lists <-> tuple

2005-11-02 Thread Peter Notebaert
I am new to Python and have to create an import library in C that uses matrices. These matrices can be one-dimensional (vectors) or two-dimensional. If I look in the ActivePython 2.4 documentation at data structures, then I see at least 2 posibilities to represent them: Lists and Tuples. The d

Re: how to write a blog system with Python

2005-11-02 Thread Peter Hansen
ice wrote: > I am a fresh here , and I have no idea of it. > Do you have any comments? Why do you want to write your own system? There are already lots of blog programs written in Python which you could just use, or customize. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: reading internet data to generate random numbers.

2005-11-03 Thread Peter Hansen
t stream", so I assumed he had something like that in mind. And to think that if you'd just waited for the OP to explain what the heck he meant by "the Internet stream", you'd have saved ever so much time. ;-) (But then, if we always did that Usenet wouldn't be any fun.) -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Can Anyone Help me on this

2005-11-03 Thread Peter Hansen
ow about this instead (Python 2.4 or later): list2 = list(reversed('123456789')) -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: reading internet data to generate random numbers.

2005-11-03 Thread Peter Hansen
Steven D'Aprano wrote: > On Thu, 03 Nov 2005 16:40:43 -0500, Peter Hansen wrote: >>Steven D'Aprano wrote: >> >>>On Thu, 03 Nov 2005 15:51:30 +, Grant Edwards wrote: >>> >>>>I've never heard of anybody using the data as source of >&

Re: putting an Icon in "My Computer"

2005-11-03 Thread Peter Hansen
in32 stuff or maybe ctypes using Python.) (Of course, you might also luck out, as people often do, since there are real Windows expert types hanging out here and they might help you out anyway.) -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: help converting some perl code to python

2005-11-04 Thread Peter Otten
] if line in keys: key = line elif key == start: # your code elif key == files: # your code might work even better because 'your code' doesn't get to see the sections' begin/end markers. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: how to call basic browser functions?

2005-11-04 Thread Peter Hansen
g. (Note that if in addition to downloading the actual contents of the page, you will require more sophisticated features of a real browser, such as Javascript or Java execution, you'll need capabilities far beyond what urllib2 can provide. And you probably don't want to go there right now.) -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Python doc problem example: gzip module (reprise)

2005-11-05 Thread Peter Hansen
ek, for 8 months" vastly decreases the value of those 52 hours, even if it makes it sound much more impressive. I'm not surprised now at what we keeping seeing here... -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: how to compile c-extensions under WinXP?

2005-11-05 Thread Peter Notebaert
lable at http://msdn.microsoft.com/visualc/vctoolkit2003/ However I am not sure if everything will work with this stripped version. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: lists <-> tuple

2005-11-05 Thread Peter Notebaert
"Jim" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> Tuples or lists for matrix-like functionality? > > Use lists. Tuples are meant for small immutable sets of things that go > together. Lists are more like arrays, and you can assign to one > existing element if you want. > > On

Re: lists <-> tuple

2005-11-05 Thread Peter Notebaert
"Robert Kern" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Peter Notebaert wrote: >> I am new to Python and have to create an import library in C that uses >> matrices. >> >> These matrices can be one-dimensional (vectors) or two-dimens

Re: Modify HTML data

2005-11-05 Thread Peter Hansen
Swarna wrote: > I am using scp in python to copy a html file on remote server, to my > local machine. Now, i need to update this html file in my local machine > ( by adding a new Hyperlink to the existing table od hyperlinks ) and > copy it back (overwriting the old copy ) to the remote server. If

Re: __new__

2005-11-06 Thread Peter Otten
ot; b = object.__new__(B) print "---" A() # prints 'init B' A.__init__(b)# prints 'init A' print "---" b = 42 A() # prints nothing the "Nutshell" example should be changed to x = C.__new__(C, 23) if isinstance(x, C): x.__init__(23) to comply with the current implementation (I used Python 2.4). Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Pylab and pyserial plot in real time

2005-11-06 Thread Peter Hansen
ing you whether the problem is with the serial reading or with the plotting. If it's still not plotting, you can assume you have missed a critical step in using pylab and you should probably go back a step and make sure you can run whatever tutorial or example code is included with pylab.

Re: Icon on wx.MDIParentFrame

2005-11-06 Thread Peter Hansen
many demo screens it is in could be a challenge.) The demo used to be included in the standard distribution but is now separate, so maybe you missed it. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Modify HTML data

2005-11-06 Thread Peter Hansen
Swarna wrote: > Peter Hansen wrote: >>Swarna wrote: >>>I am using scp in python to copy a html file on remote server, to my >>>local machine. Now, i need to update this html file in my local machine >>>( by adding a new Hyperlink to the existing table

Re: Python gui

2005-11-06 Thread Peter Decker
On 6 Nov 2005 12:08:23 -0800, gsteff <[EMAIL PROTECTED]> wrote: > PyGTK is just easier to code with. The api is much nicer. That's why I think that Dabo's UI module is the best of all worlds. It wraps wxPython, so the controls look great on any platform, but provides a cleaner and more consisten

Re: PyFLTK - an underrated gem for GUI projects

2005-11-06 Thread Peter Hansen
d takes 1-2 seconds to load (actually less than one second after the first invocation following a fresh reboot). Yes, 12MB is pretty heavy, but if it's taking that long to load I think something might be wrong on your machine. (Python 2.4, wx 2.6.1.0, py2exe 0.6.3, Win XP SP2) -Peter -

Re: PyFLTK - an underrated gem for GUI projects

2005-11-06 Thread Peter Hansen
Bugs wrote: > Peter Hansen wrote: >> The wxPython program below, py2exe'd on my machine (1.6GHz Pentium M), >> comes to only 12MB (2-3MB of which is Python itself), and takes 1-2 >> seconds to load (actually less than one second after the first >> invocation fol

Re: how to present Python's OO feature in design?

2005-11-06 Thread Peter Hansen
s, however, such as automated testing (e.g. Test-Driven Development) and an agile development methodology, it certainly does work, and very well. And definitely still without the "mind-gnashing red tape" of Java, UML and their ilk. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Underscores in Python numbers

2005-11-07 Thread Peter Hansen
arch?group=comp.lang.python&q=numeric+literals+underscores -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: overloading *something

2005-11-08 Thread Peter Otten
t(a) ['a', 'b', 'c'] >>> tuple(a) (1, 2, 3) list-to-tuple conversion is optimized for performance -- basically a memcopy() of the internal data. As with a similar peculiarity with file.write() and the print statement, the problem could be shunned if python would

Re: Addressing the last element of a list

2005-11-08 Thread Peter Otten
[EMAIL PROTECTED] wrote: > Just to satisfy my curiousity: Is there a way to do something like the > reference solution I suggest above? No. You cannot overload assignment. Of course, for mutable objects you can use the object as the "reference" to itself. Peter -- http:/

Re: Addressing the last element of a list

2005-11-08 Thread Peter Otten
Jerzy Karczmarczuk wrote: > Peter Otten wrote: >> [EMAIL PROTECTED] wrote: >> >> >>>Just to satisfy my curiousity: Is there a way to do something like the >>>reference solution I suggest above? >> >> >> No. You cannot overload assignm

Re: Addressing the last element of a list

2005-11-08 Thread Peter Otten
] shorthand[0] = 42 # if a[42]["pos"] is mutable But the last indirection must always be given explicitly. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: recursive function call

2005-11-08 Thread Peter Otten
e If it were my code I would omit the tolist() stuff and instead always pass lists (or iterables) as the function's first two arguments. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Addressing the last element of a list

2005-11-08 Thread Peter Otten
gt; aliasing, where you can make a pointer to point to anything, say, the > 176th byte of a function code? I've never heard the expression "aliasing" for that, sorry. > This is impossible in Python. Of course, but I don't think this is what the OP wanted. Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: SPE IDE for Python

2005-11-08 Thread Peter Milliken
I use Emacs - it has cvs support and the next version (available from the GNU CVS archives) will support svn as well. Plus you can extend Emacs (assumes it doesn't quite do all you wish already :-)) via a python extension module where you can write your new edit commands in Python - see pymacs for

Re: how to stop a loop with ESC key? [newbie]

2005-11-08 Thread Peter Hansen
> The same problem is when running in a win console. And do you see the "." printing in the console window? What do you get if you change the code so you print the getch() value? e.g. if msvcrt.kbhit(): c = msvcrt.getch() print 'key', ord(c) Does that ever print anything? -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: which feature of python do you like most?

2005-11-08 Thread Peter Hansen
[EMAIL PROTECTED] wrote: > I have no idea why people are so facinating with python. Hey, I'm fascinating even without python! -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread Peter Hansen
other post "I just try to use list/generator expression when possible" but you didn't explain your reason for doing so. I assume you have some reason other than arbitrary whim.) -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: iterate over class variables

2005-11-10 Thread Peter Hansen
port inspect >>> inspect.classify_class_attrs(testclass) [('__doc__', 'data', , None), ('__module __', 'data', , '__main__'), ('a', 'data' , , 'a')] There are other methods in "inspect" which could help you. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Addressing the last element of a list

2005-11-10 Thread Peter Otten
>>> class List(list): ... first = make_prp(0) ... last = make_prp(-1) ... >>> items = List([1,2,3]) >>> items.first 1 >>> items.last = 42 >>> items [1, 2, 42] However, that's customizing attribute access, not name binding. Peter -- http://mail.python.org/mailman/listinfo/python-list

<    16   17   18   19   20   21   22   23   24   25   >