ANN: Urwid 0.8.10 curses-based UI library

2005-11-28 Thread Ian Ward
Announcing Urwid 0.8.10 -- Urwid home page: http://excess.org/urwid/ Tarball: http://excess.org/urwid/urwid-0.8.10.tar.gz Updated Tutorial: http://excess.org/urwid/tutorial.html About this release: === This release includes three new tutorial

SCU3 and Python packaged for U3 (with SCU3) V 0.1 released

2005-11-28 Thread Philippe C. Martin
Dear all, I am very happy to announce the release of SCU3 V 0.1 and SCU3Python.u3p V. 0.1. SCU3 is a python wrapper for U3 compliante devices SCU3Python.u3p is a Python binary (2.4.2) packaged with SCU3 that allows to launch idle from the U3 device launchpad Both may be found on

Re: Death to tuples!

2005-11-28 Thread Sybren Stuvel
Mike Meyer enlightened us with: Is there any place in the language that still requires tuples instead of sequences, except for use as dictionary keys? Anything that's an immutable sequence of numbers. For instance, a pair of coordinates. Or a value and a weight for that value. If not, then

yahoo sender name

2005-11-28 Thread john boy
hey...I know this is off the "python" topicbut I have yahoo mail and would like to change my "sender name" I have gone to the "edit account" area and have changed all names that can be edited to a consistent name other than the current sender name...but for some reason it will not change the

Re: best cumulative sum

2005-11-28 Thread Peter Otten
[EMAIL PROTECTED] wrote: def ireduce(op, iterable, *init): iterable = chain(init, iterable) accu = iterable.next() yield accu for item in iterable: accu = op(accu, item) yield accu I believe there is only one initializer in reduce. Throw in a if

Re: return in loop for ?

2005-11-28 Thread Duncan Booth
Steven D'Aprano wrote: Since real source code verifiers make no such sweeping claims to perfection (or at least if they do they are wrong to do so), there is no such proof that they are impossible. By using more and more elaborate checking algorithms, your verifier gets better at correctly

Re: Writing big XML files where beginning depends on end.

2005-11-28 Thread Magnus Lycka
Gerard Flanagan wrote: what about multiple xml files? We have deployed code that relies of the XML files looking the way they do, and we'd prefer not to change that. -- http://mail.python.org/mailman/listinfo/python-list

Re: return in loop for ?

2005-11-28 Thread Sybren Stuvel
Duncan Booth enlightened us with: I would have thought that no matter how elaborate the checking it is guaranteed there exist programs which are correct but your verifier cannot prove that they are. Yep, that's correct. I thought the argument was similar to the proof that no program (read:

Re: exception KeyboardInterrupt and os.system command

2005-11-28 Thread malv
That's also kind of what I expected. However, I quickly tried: import os while 1: y = os.system(sleep 1) z = (y 8) 0xFF print z I never get anything in return but 0, hitting c-C or not. I have uset the above code to get exit code returns in the past though. Would there be

Re: General question about Python design goals

2005-11-28 Thread Antoon Pardon
Op 2005-11-28, Aahz schreef [EMAIL PROTECTED]: In article [EMAIL PROTECTED], Christoph Zwerschke [EMAIL PROTECTED] wrote: For instance, I just wanted to use the index() method on a tuple which does not work. It only works on lists and strings, for no obvious reason. Why not on all sequence

Re: How to make tkFileDialog GUI larger?

2005-11-28 Thread Martin Franklin
John Wheez wrote: Hi all, I'm using teh tkFileDialog to let teh user select a directory. We have long names which make it difficult to view the directories. For some reason the GUI windows doesn;t expand on Windows like it does on OS X or Linux. Is there a method to make the widths

Re: General question about Python design goals

2005-11-28 Thread Fredrik Lundh
Christoph Zwerschke wrote: What about design goals such as: - orthogonality - coherence, consistency - principle of least astonishment (Python fits my brain) - simplicity (kiss principle) - aesthetics, symmetry Actually, which priority have the above design goals for Python? Are other

Re: Making immutable instances

2005-11-28 Thread Antoon Pardon
Op 2005-11-26, Steven D'Aprano schreef [EMAIL PROTECTED]: On Thu, 24 Nov 2005 12:55:07 +, Antoon Pardon wrote: Suppose I have the following code. from module import __take_care__ __private_detail__ = ... I now have two variable that are flaged the same way, but they are not. No,

resume TCP comunication

2005-11-28 Thread zunbeltz
Hi, I'am writing a program to cotrol a machine. I use socket comunication (TCP) to do it. I do a measurement in my machine like this: def DoMeasurement(): setup1() setup2() while MeasurementNotFinished(): move() measure() finalizeMeasurement() Each funciton

Re: Python as Guido Intended

2005-11-28 Thread Antoon Pardon
Op 2005-11-25, Mike Meyer schreef [EMAIL PROTECTED]: Antoon Pardon [EMAIL PROTECTED] writes: Op 2005-11-24, Mike Meyer schreef [EMAIL PROTECTED]: Antoon Pardon [EMAIL PROTECTED] writes: The usual response is That's not the Python way. That's not calling someone dumb, just pointing out that

Re: Writing pins to the RS232

2005-11-28 Thread Richard Brodie
Roy Smith [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: While I realize this is more on a driver/hardware level it's interesting that it's so difficult to use a different protocol for an existing driver. For example, all serial does is

Re: Python as Guido Intended

2005-11-28 Thread Antoon Pardon
Op 2005-11-25, Mike Meyer schreef [EMAIL PROTECTED]: Antoon Pardon [EMAIL PROTECTED] writes: Well this is, is one thing I have a problem with. The python people seem to be more concerned with fighting things that could be used counter the python philosophy, than search for things that enable

Re: Newbie question: Tab key giving different output

2005-11-28 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: I'm a newbie to python. I run python under Manddrake Linux 10.2 from a terminal. While in the interactive mode, i need to use the tab key to indent my code. However, i get a message List all 174 possibilities? (Y/N) instead of an indent. So i use spaces. How do i

Re: Python as Guido Intended

2005-11-28 Thread Antoon Pardon
Op 2005-11-28, Serge Orlov schreef [EMAIL PROTECTED]: Antoon Pardon wrote: No it wasn't. From what I have picked up, the ternary operator was finaly introduced after one of the developers tripped over the commonly used idiom to simulate a ternary operator, which can fail in certain cases.

Re: Python as Guido Intended

2005-11-28 Thread Antoon Pardon
Op 2005-11-25, EP schreef [EMAIL PROTECTED]: What is the philosophy? I'm not the one to answer that, but I do use import this for reference, and it seems to answer some of the points in this thread: import this The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is

ANN: Dao Language v.0.9.6-beta is release!

2005-11-28 Thread [EMAIL PROTECTED]
Dear all, This is just to let you know that the lastest version Dao language is released. This Dao was previously called Tao, and now is changed to Dao to avoid confusion with another Tao langauge. There are a number of new features implemented in this version, of which the most important one is

Re: General question about Python design goals

2005-11-28 Thread Antoon Pardon
Op 2005-11-28, Fredrik Lundh schreef [EMAIL PROTECTED]: Christoph Zwerschke wrote: What about design goals such as: - orthogonality - coherence, consistency - principle of least astonishment (Python fits my brain) - simplicity (kiss principle) - aesthetics, symmetry Actually, which

type of form field

2005-11-28 Thread Ajar
Is there any way to retrieve the type(checkbox,radio...) of the form field from cgi.FieldStorage. I tried something like form['name'].type, but this field seems to be None for all the form fields -- http://mail.python.org/mailman/listinfo/python-list

Re: importing a method

2005-11-28 Thread Flavio
Because, by the time the user function is imported and attributed to the custom method, soandso has already been instantiated and contains the information tha needs to accessed by the user's function. -- http://mail.python.org/mailman/listinfo/python-list

Re: General question about Python design goals

2005-11-28 Thread Sebastien Douche
On 11/28/05, Christoph Zwerschke [EMAIL PROTECTED] wrote: Sometimes I find myself stumbling over Python issues which have to do with what I perceive as a lack of orthogonality. I use this thread to asking on python conception : why python have so many builtins ? I cannot understand why we use a

Re: importing a method

2005-11-28 Thread Flavio
If you read my original post, I had no intention of atributing the user's method to the class, but to the instance. Anyway I figure it out myself, and its quite a Pythonic solution: class Foo: name='John' a=Foo() def p(parent): self=parent print 'Hi,

Re: How to get started in GUI Programming?

2005-11-28 Thread paron
I think the best route is through the browser. Good cross-platform, has a reasonable toolkit, and it's familiar for users. You could look at TurboGears. -- http://mail.python.org/mailman/listinfo/python-list

Re: importing a method

2005-11-28 Thread Flavio
There only one puzzle left to solve: altough the solution I proposed works, this variant has problems: class Foo: name='John' a=Foo() def p(): print 'Hi, %s!'%self.name a.met=p a.met.self = a a.met() NameError: global name 'self' is not defined This error is

Re: type of form field

2005-11-28 Thread Mike Meyer
Ajar [EMAIL PROTECTED] writes: Is there any way to retrieve the type(checkbox,radio...) of the form field from cgi.FieldStorage. I tried something like form['name'].type, but this field seems to be None for all the form fields There isn't. cgi.FieldStorage parses data sent via an HTTP request.

Re: How to enable bash mode at the interative mode?

2005-11-28 Thread Baz Walter
Anthony Liu antonyliu2002 at yahoo.com writes: Look what I have: $ python Python 2.4.2 (#1, Nov 20 2005, 13:03:38) [GCC 3.3.1 (Mandrake Linux 9.2 3.3.1-2mdk)] on linux2 Yes, I realize that I don't have readline module available. The same Mandrake system has Python 2.3 as

Re: Writing big XML files where beginning depends on end.

2005-11-28 Thread Laurent Pointal
Magnus Lycka wrote: We're using DOM to create XML files that describes fairly complex calculations. The XML is structured as a big tree, where elements in the beginning have values that depend on other values further down in the tree. Imagine something like below, but much bigger and much

Re: How to get started in GUI Programming?

2005-11-28 Thread UrsusMaximus
I agree with Paron, using HTML forms and such as a minimal GUI front end meant to be run in a browser is often a good way to go. But I just want to mention, again, Stephen Ferg's Easygui at http://www.ferg.org/easygui/index.html which is a very easy way to go for desktop GUI's. You know, I just

Re: General question about Python design goals

2005-11-28 Thread Duncan Booth
Antoon Pardon wrote: So suppose I want a dictionary, where the keys are colours, represented as RGB triplets of integers from 0 to 255. A number of things can be checked by index-like methods. e.g. def iswhite(col): return col.count(255) == 3 def primary(col): return

Re: Comparison problem

2005-11-28 Thread Peter Hansen
Tim Henderson wrote: peter (Thanks for clarifying to whom you were responding... I saw the other post but wouldn't have responded since it didn't seem to be in response to one of mine. :-) ) would not the more correct way to do this be short circuit evaluation. somthing along lines of if

Re: Death to tuples!

2005-11-28 Thread Peter Hansen
Mike Meyer wrote: It seems that the distinction between tuples and lists has slowly been fading away. What we call tuple unpacking works fine with lists on either side of the assignment, and iterators on the values side. IIRC, apply used to require that the second argument be a tuple; it now

Re: Writing pins to the RS232

2005-11-28 Thread Peter Hansen
Richard Brodie wrote: If you just need one or two signals, then it might be practical to use one of the control lines, and PySerial supports this (UPS monitoring software often works this way). Setting 8 pins to 1 would be impossible, because there plain won't be that number of outputs wired,

Re: General question about Python design goals

2005-11-28 Thread Antoon Pardon
Op 2005-11-28, Duncan Booth schreef [EMAIL PROTECTED]: Antoon Pardon wrote: So suppose I want a dictionary, where the keys are colours, represented as RGB triplets of integers from 0 to 255. A number of things can be checked by index-like methods. e.g. def iswhite(col): return

Re: How to get started in GUI Programming?

2005-11-28 Thread forodejazz
Have you tried Gambas? http://gambas.sourceforge.net It's a VB-like tool. But the programming language is not Pyhton :-( -- http://mail.python.org/mailman/listinfo/python-list

Re: Death to tuples!

2005-11-28 Thread Antoon Pardon
Op 2005-11-28, Peter Hansen schreef [EMAIL PROTECTED]: Mike Meyer wrote: It seems that the distinction between tuples and lists has slowly been fading away. What we call tuple unpacking works fine with lists on either side of the assignment, and iterators on the values side. IIRC, apply used

Why I need to declare import as global in function

2005-11-28 Thread didier . doussaud
I have a stange side effect in my project : in my project I need to write gobal to use global symbol : ... import math ... def f() : global math # necessary ?? else next line generate an error message ? print math.pi (the problem is for all global module symbol) I have certainly

Re: importing a method

2005-11-28 Thread Antoon Pardon
Op 2005-11-27, Flavio schreef [EMAIL PROTECTED]: hi, I have an object defined with a number of hardcoded methods. Class soandso: def __init__(self): self.this = 0 self.that = 1 def meth1(self): ... def meth2(self): ... def custom(self):

speeding up Python when using wmi

2005-11-28 Thread rbt
Here's a quick and dirty version of winver.exe written in Python: http://filebox.vt.edu/users/rtilley/public/winver/winver.html It uses wmi to get OS information from Windows... it works well, but it's slow... too slow. Is there any way to speed up wmi? In the past, I used the platform and sys

Re: return in loop for ?

2005-11-28 Thread Steven D'Aprano
On Mon, 28 Nov 2005 08:44:04 +, Duncan Booth wrote: Steven D'Aprano wrote: Since real source code verifiers make no such sweeping claims to perfection (or at least if they do they are wrong to do so), there is no such proof that they are impossible. By using more and more elaborate

Re: How to get started in GUI Programming?

2005-11-28 Thread peter . mosley
A big thank you to all who responded. There are too many to reply individually, but to summarise ... Thomas Güttler gave a link to an example program, editMetadata.py which uses yes no dialogs and scaled images. I've not yet tried to learn from this, but looking at the code it seems to provide

Re: Why I need to declare import as global in function

2005-11-28 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: I have a stange side effect in my project : in my project I need to write gobal to use global symbol : ... import math ... def f() : global math # necessary ?? else next line generate an error message ? what error message? print math.pi you

Re: Writing pins to the RS232

2005-11-28 Thread Ian Vincent
Peter Hansen [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: All true, but then Jay might get into electrical compatibility issues, and may not realize that the output levels of RS-232 serial hardware are not simply 0 and 5V levels, but rather +9V (or so) and -9V (and with variations

Re: Why I need to declare import as global in function

2005-11-28 Thread Tim N. van der Leeuw
Sounds like something, either in your program, in another lib you imported, or perhaps some extension you recently installed (and which automatically starts), overrides 'import' (replaces it with it's own version) -- and forgets to add the imported modules properly to the globlals? Or something,

Re: should python have a sort list-map object in the std-lib?

2005-11-28 Thread Steven D'Aprano
On Sun, 27 Nov 2005 23:35:03 -0500, Tim Henderson wrote: Hi The question why are there no sorted dictionaries in python, seems to pop up with unseeming regularity. That question in itself in nonsensical sense dictionaries are hash-maps, however should python have a sorted map type object

Re: General question about Python design goals

2005-11-28 Thread Duncan Booth
Antoon Pardon wrote: I'm sure I could come up with an other example where I would like to have both some list method and use it as a dictionary key and again people could start about that implementation having some flaws and give better implementations. I'm just illustrating that some

Re: nesting for statements?

2005-11-28 Thread tpcolson
Hi. Thanks for the tip. However, implementing that example, the script will only generate the second output file, (or it's overwriting the first one), so all I get when run is fileb. # Import system modules import sys, string, os, win32com.client # Create the Geoprocessor object from

Re: return in loop for ?

2005-11-28 Thread Steven D'Aprano
On Mon, 28 Nov 2005 10:02:19 +0100, Sybren Stuvel wrote: Duncan Booth enlightened us with: I would have thought that no matter how elaborate the checking it is guaranteed there exist programs which are correct but your verifier cannot prove that they are. Yep, that's correct. I thought the

RE: speeding up Python when using wmi

2005-11-28 Thread Tim Golden
[rbt] Here's a quick and dirty version of winver.exe written in Python: [.. snip ..] It uses wmi to get OS information from Windows... it works well, but it's slow... too slow. Is there any way to speed up wmi? In the past, I used the platform and sys modules to do some of what

Re: General question about Python design goals

2005-11-28 Thread Antoon Pardon
Op 2005-11-28, Duncan Booth schreef [EMAIL PROTECTED]: Antoon Pardon wrote: I'm sure I could come up with an other example where I would like to have both some list method and use it as a dictionary key and again people could start about that implementation having some flaws and give better

RE: Multiple versions

2005-11-28 Thread Tim Golden
[Me] I need to install both 2.3 and 2.4 on my Win2000 system. Can someone please give me a pointer as to how to do this? Thanks! It depends on your other requirements. The simple answer is: just install them (in different directories, eg c:\python23, c:\python24), installing last the one

Re: Death to tuples!

2005-11-28 Thread Duncan Booth
Antoon Pardon wrote: def func(x): ... if x in [1,3,5,7,8]: ... print 'x is really odd' ... dis.dis(func) ... 3 20 LOAD_FAST0 (x) 23 LOAD_CONST 2 (1) 26 LOAD_CONST 3 (3) 29

Re: Unicode in MIMEText

2005-11-28 Thread Damjan
patch submitted... Thanks for taking the time to improve the quality of the Python library. Do you think it would be possible to do some kind of an automatic comprehensive test of compatibility of the standard library with unicode strings? -- damjan --

Multiple versions

2005-11-28 Thread Me
I need to install both 2.3 and 2.4 on my Win2000 system. Can someone please give me a pointer as to how to do this? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: General question about Python design goals

2005-11-28 Thread Fredrik Lundh
Duncan Booth wrote: I'm just illustrating that some list-like methods with tuples could be usefull. But you aren't illustrating that at all. But assume that I have some other use case /F -- http://mail.python.org/mailman/listinfo/python-list

Data Structure in Python like STL Stack?

2005-11-28 Thread Matt Keyes
Is there a data structure in Python that is akin to the STL stack object in C++? Thanks!-- http://mail.python.org/mailman/listinfo/python-list

Re: How to get started in GUI Programming?

2005-11-28 Thread Brian Elmegaard
[EMAIL PROTECTED] writes: Others recommended wxPython, PyQt and various derivatives. The trouble is there's too much choice! Agreed, I tried to find /the answer/ some time ago, and I got to the same conclusion. In addition it is even more difficult to find the advantages and disadvantages

Re: Data Structure in Python like STL Stack?

2005-11-28 Thread jepler
What property of the STL stack is important to you? You can use a Python list as a stack. It has methods append() and pop() which run in amortized-constant-time. It can be tested for empty/nonempty in constant time too (if st: # stack is not empty). Jeff pgpU1CCrfIPhk.pgp Description: PGP

Re: Data Structure in Python like STL Stack?

2005-11-28 Thread Matt Keyes
I didn't know the list has a pop function - that is what I was looking for. Thanks for the help![EMAIL PROTECTED] wrote: What property of the STL stack is important to you?You can use a Python list as a stack. It has methods append() andpop() which run in amortized-constant-time. It can be tested

Re: Data Structure in Python like STL Stack?

2005-11-28 Thread Fredrik Lundh
Matt Keyes wrote: Is there a data structure in Python that is akin to the STL stack object in C++? import collections help(collections.deque) ... class deque(__builtin__.object) | deque(iterable) -- deque object | | Build an ordered collection accessible from endpoints only. ... /F

Book: Cross-Platform GUI Programming with wxWidgets?

2005-11-28 Thread kdahlhaus
I was wondering if people using wxPython found this book useful? Is it worth the money? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Problem with exchange mail server

2005-11-28 Thread Vinayakc
I am new for python. I have written one code which generates RFC2822 file. I have header in string format. i am using following code. emailData[SMTP_HEADER_POS] = emailData[SMTP_HEADER_POS].encode(utf-8) hdr = email.message_from_string(emailData[SMTP_HEADER_POS]) tmpContentType =

Re: speeding up Python when using wmi

2005-11-28 Thread rbt
Tim Golden wrote: [rbt] Here's a quick and dirty version of winver.exe written in Python: [.. snip ..] It uses wmi to get OS information from Windows... it works well, but it's slow... too slow. Is there any way to speed up wmi? In the past, I used the platform and sys modules to do

Re: General question about Python design goals

2005-11-28 Thread Duncan Booth
Antoon Pardon wrote: No I gave an example, you would implement differently. But even if you think my example is bad, that would make it a bad argument for tuples having list methods. That is not the same as being a good argument against tuples having list methods. Tuples don't have list

RE: speeding up Python when using wmi

2005-11-28 Thread Tim Golden
[rbt] Here's a quick and dirty version of winver.exe written in Python: [Tim Golden] In short, I recommend replacing the wmi module by the underlying calls which it hides, and replacing Tkinter by a win32gui MessageBox. [rbt] Wow... thanks. I didn't expect someone to completely rewrite it

Re: importing a method

2005-11-28 Thread Flavio
This new module sounds pretty cool, too bad its deprecated... I would not want to add a dependancy to a deprecated module in my code. But maybe I'll check the code for instancemethod within it and see what it does. Flávio -- http://mail.python.org/mailman/listinfo/python-list

Precision for equality of two floats?

2005-11-28 Thread Anton81
Hi! When I do simple calculation with float values, they are rarely exactly equal even if they should be. What is the threshold and how can I change it? e.g. if f1==f2: will always mean if abs(f1-f2)1e-6: Anton -- http://mail.python.org/mailman/listinfo/python-list

Re: General question about Python design goals

2005-11-28 Thread Paul Boddie
Antoon Pardon wrote: Duncan Booth wrote: But you aren't illustrating that at all. You came up with an example which showed, at least to me, a good argument why tuples should *not* have list methods. For what it's worth, I don't agree with that analysis, but anyway... No I gave an

Re: should python have a sort list-map object in the std-lib?

2005-11-28 Thread Alex Martelli
Tim Henderson [EMAIL PROTECTED] wrote: ahh, i hadn't thought of using a proirity queue but that is the correct solution most of the time, except i suppose when you have input that causes you to excessively reheap which could be problematic. The worst case is still O(N logN) for heap as well

RE: Problem with exchange mail server

2005-11-28 Thread Tim Golden
[Vinayakc] I am new for python. Welcome to Python. I have written one code which generates RFC2822 file. I have header in string format. i am using following code. [... snip code fragment ...] I'm afraid you're going to have to be a little more precise and give a more useful fragment of

Re: Precision for equality of two floats?

2005-11-28 Thread Alex Martelli
Anton81 [EMAIL PROTECTED] wrote: Hi! When I do simple calculation with float values, they are rarely exactly equal even if they should be. What is the threshold and how can I change it? Python's builtin floats compare for exact bit-by-bit equality -- no threshold. You may want to look at

Re: importing a method

2005-11-28 Thread Alex Martelli
Flavio [EMAIL PROTECTED] wrote: This new module sounds pretty cool, too bad its deprecated... I would not want to add a dependancy to a deprecated module in my code. But maybe I'll check the code for instancemethod within it and see what it does. If you have a function f and want to make

Re: Precision for equality of two floats?

2005-11-28 Thread Fredrik Lundh
Anton81 wrote: When I do simple calculation with float values, they are rarely exactly equal even if they should be. What is the threshold http://www.lahey.com/float.htm http://docs.python.org/tut/node16.html and how can I change it? you cannot. e.g. if f1==f2: will always mean if

Re: General question about Python design goals

2005-11-28 Thread Aahz
In article [EMAIL PROTECTED], Paul Boddie [EMAIL PROTECTED] wrote: In this case, I rather agree with the pragmatic responses earlier in the thread: that it was probably an oversight that tuples lack the count, index and (arguably) sorted methods, and that patches would probably be welcome to

Extracting documentation for user relevant functions only?

2005-11-28 Thread Anton81
Hi, I've written a python script and added short docstrings. Now I'd like to create a short overview of commands the user can use. However I don't want the internal stuff that I also commented. Is there a way to create a fancy documentation (e.g. pydoc) of certain functions only? Anton --

Re: importing a method

2005-11-28 Thread Flavio
Addendum to my last reply: although the New Method is deprecated, new.instancemethod (from Antoon's message) can be replaced by from types import MethodType f.show = MethodType(show,f) and every thing still works. -- http://mail.python.org/mailman/listinfo/python-list

Re: General question about Python design goals

2005-11-28 Thread Fredrik Lundh
Christoph Zwerschke wrote: But the problem is that the tutorials and manuals give the impression that the difference between lists and tuples is only mutablity versus immutability. both the tutorial and the FAQ discusses the difference in terms of use cases and recommended usage. Maybe I am

Re: importing a method

2005-11-28 Thread Martin Miller
First of all,why do you think the new module is deprecated? (I can't find anything in the docs to indicate this.) As for using MethodType in the types module: There's nothing in the module documentation that suggests that you can call MethodType as a function as you suggest, only that it is the

Re: Extracting documentation for user relevant functions only?

2005-11-28 Thread Micah Elliott
On Nov 28, Anton81 wrote: I've written a python script and added short docstrings. Now I'd like to create a short overview of commands the user can use. However I don't want the internal stuff that I also commented. Is there a way to create a fancy documentation (e.g. pydoc) of certain

Re: importing a method

2005-11-28 Thread Martin Miller
I'd like to point out to the OP that using a function's __get__ method this way only works with new-style classes and their instances...not with the example in the shown in original post. -Martin Alex Martelli wrote: Flavio [EMAIL PROTECTED] wrote: This new module sounds pretty cool, too

Re: Death to tuples!

2005-11-28 Thread Steven Bethard
Dan Bishop wrote: Mike Meyer wrote: Is there any place in the language that still requires tuples instead of sequences, except for use as dictionary keys? The % operator for strings. And in argument lists. def __setitem__(self, (row, column), value): ... Interesting that both of

Re: General question about Python design goals

2005-11-28 Thread Paul Boddie
Aahz wrote: You're wrong. I don't have time/energy to look up the relevant posts, but Guido has been extremely clear in the past that tuples are *NOT* going to grow methods. Ah, I misread some of those other posts. Still, at least that is consistent with saying that it wasn't worth spending

Re: No apos in htmlentitydefs

2005-11-28 Thread Fredrik Lundh
Kent Johnson wrote: I see that htmlentitydefs.name2codepoint does not include 'apos' as one of the recognized names. Is this intentional or a bug? In fact apos; is not a recognized entity in HTML 4.01; see this list: http://www.w3.org/TR/html4/sgml/entities.html#misc But it is recognized

Re: return in loop for ?

2005-11-28 Thread Mike Meyer
Steven D'Aprano [EMAIL PROTECTED] writes: On Mon, 28 Nov 2005 10:02:19 +0100, Sybren Stuvel wrote: Duncan Booth enlightened us with: I would have thought that no matter how elaborate the checking it is guaranteed there exist programs which are correct but your verifier cannot prove that they

New Ordered Dictionery to Criticise

2005-11-28 Thread Fuzzyman
Sorry for this hurried message - I've done a new implementation of out ordered dict. This comes out of the discussion on this newsgroup (see blog entry for link to archive of discussion). See the latest blog entry to get at it : http://www.voidspace.org.uk/python/weblog/index.shtml Criticism

pcm format to wav...

2005-11-28 Thread [EMAIL PROTECTED]
Hi ! I have WinXP. I want to convert my PySonic recorded (raw) pcm format files to wav files. How can I do it ? Please help me ! dd -- http://mail.python.org/mailman/listinfo/python-list

Re: Precision for equality of two floats?

2005-11-28 Thread Mike Meyer
Anton81 [EMAIL PROTECTED] writes: When I do simple calculation with float values, they are rarely exactly equal even if they should be. What is the threshold and how can I change it? Implementation dependent, because floats use an underlying C type, and there's no portable way to do that.

build_opener()

2005-11-28 Thread Steve Young
Hello, I had a question about urllib2's build_opener() statement. I am trying to just get the html from any webpage as a string but I need everything on the page to be the same as what it'd be if I would browse to that page (and at the very least, all the href's). This is my code: url =

Re: best cumulative sum

2005-11-28 Thread David Isaac
Peter Otten [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] sufficiently similar I think I understand your points now. But I wanted to match these cases: import operator reduce(operator.add,[],42) 42 reduce(operator.add,[1],42) 43 The idea is that the i-th yield of i-reduce shd

Re: General question about Python design goals

2005-11-28 Thread Aahz
In article [EMAIL PROTECTED], Sebastien Douche [EMAIL PROTECTED] wrote: I use this thread to asking on python conception : why python have so many builtins ? I cannot understand why we use a builtins for open a file. Is it a old decision ? If anyone have a pointer of this or can explain me. One

Re: Writing pins to the RS232

2005-11-28 Thread Philippe C. Martin
Hi, Some of it should be doable on windows: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcecoreos5/html/wce50lrfescapecommfunction.asp Yet this might require a new wrapper module for I am not sure what the current interface lets you do. Not sure about Linux. Regards;

Re: exception KeyboardInterrupt and os.system command

2005-11-28 Thread Donn Cave
In article [EMAIL PROTECTED], malv [EMAIL PROTECTED] wrote: That's also kind of what I expected. However, I quickly tried: import os while 1: y = os.system(sleep 1) z = (y 8) 0xFF print z I never get anything in return but 0, hitting c-C or not. I have uset the above

Re: Death to tuples!

2005-11-28 Thread Aahz
In article [EMAIL PROTECTED], Mike Meyer [EMAIL PROTECTED] wrote: Is there any place in the language that still requires tuples instead of sequences, except for use as dictionary keys? If not, then it's not clear that tuples as a distinct data type still serves a purpose in the language. In

Re: Which License Should I Use?

2005-11-28 Thread Rocco Moretti
Steven D'Aprano wrote: On Fri, 25 Nov 2005 11:30:46 -0800, mojosam wrote: I guess I don't care too much about how other people use it. Then probably the best licence to use is just to follow the lead of Python. For that sort of small program of limited value, I put something like this in

[pyparsing] How to get arbitrary text surrounded by keywords?

2005-11-28 Thread Inyeol Lee
I'm trying to extract module contents from Verilog, which has the form of; module foo (port1, port2, ... ); // module contents to extract here. ... endmodule To extract the module contents, I'm planning to do something like; from pyparsing import * ident =

After migrating from debian to ubuntu, tkinter hello world doesn't work

2005-11-28 Thread mortuno
Hi My tkinter apps worked fine in debian linux (woody and sarge) I moved to ubuntu 5.10 I follow the 'hello world' test as seen in http://wiki.python.org/moin/TkInter import _tkinter # with underscore, and lowercase 't' import Tkinter # no underscore, uppercase 'T' Tkinter._test() # note

Re: Which License Should I Use?

2005-11-28 Thread Steve Holden
Steven D'Aprano wrote: On Fri, 25 Nov 2005 11:30:46 -0800, mojosam wrote: I guess I don't care too much about how other people use it. Then probably the best licence to use is just to follow the lead of Python. For that sort of small program of limited value, I put something like this

  1   2   >