wx.DC problem

2006-04-14 Thread python
I’m trying to create a way to pass the wx.dc object between multiple object, and its mostly working… I can get two different panels to draw to the same DC but when I scale the window out… it looks like the 2nd panel is getting blocked by something, im not sure if its a OnPaint problem or Maybe

Re: Remove Whitespace

2006-04-14 Thread John Machin
On 14/04/2006 12:51 PM, Felipe Almeida Lessa wrote: Em Sex, 2006-04-14 às 12:46 +1000, Steven D'Aprano escreveu: Why would you want to call in the heavy sledgehammer of regular expressions for cracking this peanut? And put heavy on that! $ python2.4 -mtimeit -s str = 'D c a V e r \ = d w

A problem with exec statement

2006-04-14 Thread TPJ
I have the following code: --- def f(): def g(): a = 'a' # marked line 1 exec 'a = b' in globals(), locals() print g: a =, a a = 'A' # marked line 2 exec 'a = B' in globals(), locals() print f: a =, a g() f()

Re: PEP 359: The make Statement

2006-04-14 Thread OKB (not okblacke)
Nicolas Fleury wrote: I have no idea of the implementation implications, but it would be nice to have the capability to override the namespace type to use something else than dict, so that it can be filled with symbols one statement at a time. I agree. I have sometimes wanted

[廣告]徵人~兼職工作全職收入(可在家工作)

2006-04-14 Thread
Part-time job Full-time income 美商高科技生化公司加州百大企業來台拓展亞太市場 誠徵兼職人員,每日2~3小時,月入1萬~3萬 http://www.moonnini.com/w/nica/ 上面為在家工作系統網站 若對在家工作有興趣者可去索取電子書 -- 夫兵者不祥之器物或惡之故有道者不處君子居則貴左用兵則貴右兵者不祥之器非君子 之器不得已而用之恬淡為上勝而不美而美之者是樂殺人夫樂殺人者則不可得志於天下

Re: A problem with exec statement

2006-04-14 Thread Peter Otten
TPJ wrote: I have the following code: --- def f():   def g(): a = 'a' # marked line 1 exec 'a = b' in globals(), locals() print g: a =, a   a = 'A'   # marked line 2   exec 'a = B' in globals(), locals()   print 

Re: A problem with exec statement

2006-04-14 Thread Steve Holden
TPJ wrote: I have the following code: --- def f(): def g(): a = 'a' # marked line 1 exec 'a = b' in globals(), locals() print g: a =, a a = 'A' # marked line 2 exec 'a = B' in globals(), locals() print f:

Re: PEP 359: The make Statement

2006-04-14 Thread Steven Bethard
Nicolas Fleury wrote: Steven Bethard wrote: Ok, I finally have a PEP number. Here's the most updated version of the make statement PEP. I'll be posting it shortly to python-dev. Thanks again for the previous discussion and suggestions! I find it very interesting. My only complaint is

whitespace again

2006-04-14 Thread david brochu jr
hello again, still having problemsi have the following in a txt file: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\software\compete\dca]UserId=92005851PanelId=mayflowerPanelName=Consumer Input ToolbarCaptureType=dword:0002 CapTypOvr=dword:0001ExePath=C:\\Program

Pattern_Recognition_School+Conf_2006:Deadline

2006-04-14 Thread heather
PATTERN RECOGNITION EVENTS THIS SUMMER, 2006 ___ 4TH INTERNATIONAL SUMMER SCHOOL ON PATTERN RECOGNITION (ISSPR, 2006), 23-28 JULY, UK WWW.PatternRecognitionSchool.com The 4th International Summer School on Pattern Recognition will be organised at the University of Plymouth,

Re: PEP 359: The make Statement

2006-04-14 Thread Duncan Booth
Steven Bethard wrote: Should users of the make statement be able to determine in which dict object the code is executed? The make statement could look for a ``__make_dict__`` attribute and call it to allow things like:: make Element html: make Element body:

Re: reading files in small chunks?

2006-04-14 Thread Rajesh Sathyamoorthy
Hi,Could I have some links? It would be very helpful.Thank You.On 4/14/06, Felipe Almeida Lessa wrote: Em Sex, 2006-04-14 às 13:45 +0800, Rajesh Sathyamoorthy escreveu: I wanted to know why it is more efficient to read a file in smaller chunks ( using file() or open() )?It's more efficient in some

Re: reading files in small chunks?

2006-04-14 Thread Amit Khemka
On 4/14/06, Rajesh Sathyamoorthy [EMAIL PROTECTED] wrote: Hi, I wanted to know why it is more efficient to read a file in smaller chunks ( using file() or open() )? If this is not done, will this lead to errors in the data read or just results in slower performance? Thank You. It has

Re: list.clear() missing?!?

2006-04-14 Thread Sergei Organov
Dennis Lee Bieber [EMAIL PROTECTED] writes: On Fri, 14 Apr 2006 09:17:05 +0400, Sergei Organov [EMAIL PROTECTED] declaimed the following in comp.lang.python: I, as a newcomer, don't have much trouble understanding the binding vs the assignment by themselves. What does somewhat confuse is

create pixmap from data

2006-04-14 Thread Thomas Girod
Hi there. I have a list containing integer values from 0 to 255. With this list I have informations width and height, as width * height = len(my_list) What I want to do is to convert this array into a pixmap of dimension width * height in order to draw it inside a pygtk GUI. Any suggestions

Re: Python editing with emacs/wordstar key bindings.

2006-04-14 Thread Sergei Organov
BartlebyScrivener [EMAIL PROTECTED] writes: Yes, but for some reason, I get more and better help here with Python than on xemacs. Or maybe I've just had bad luck. Something like the following just leaves me scratching my head. I'm on Windows XP and never compiled anything that I know of.

__getattribute__ and __slots__

2006-04-14 Thread pascal . parent
Hi, I try to define a (new-style) class who: - have a __slots__ defined to be strict attributes, - return None if the attribute is 'ok' but not set, or raise a 'normal' error if the attribute isn't in __slots__. This code runs, but is it the good way? Thanks. class test(object): __slots__

requestion regarding regular expression

2006-04-14 Thread Kelie
Hello, I'm trying to analyze some autolisp code with python. In the file to be analyzed there are many functions. Each function begins with a defun statement. And before that, there may or may not have comment line(s), which begins with ;. My goal is to export each function into separate

Upgrading and modules

2006-04-14 Thread Brian Elmegaard
Hi, Every time I upgrade python I also have to download all packages and reinstall them. http://www.voidspace.org.uk/python/articles/upgrading_python.html tells me that this is only a problem on windows for some reasons that have to do with binary distributions, compiling and more. This leads

Re: Remove Whitespace

2006-04-14 Thread Fredrik Lundh
John Machin wrote: $ python2.4 -mtimeit -s str = 'D c a V e r \ = d w o r d : 0 0 0 0 0 6 4 0' 'str.replace( , )' Oi! The OP mentioned whitespace ... yeah. but as is obvious from his examples, he really means UTF-16, not whitespace. /F --

Re: whitespace again

2006-04-14 Thread Fredrik Lundh
david brochu jr wrote: still having problemsi have the following in a txt file: Windows Registry Editor Version 5.00 if this is a regedit export, the data is encoded as UTF-16. treating that as plain ASCII doesn't really work. for line in new_line.readlines(): line = re.sub('',,line)

Re: namespace issue

2006-04-14 Thread Daniel Nogradi
def _gn(x): return x.upper() great_name = _gn class myclass: def mymethod(self, great_name=False): if great_name: return _gn('something') else: return 'something' def great_name(x): ... return x.upper() ... class

sending email with charset utf-8 but subject is not coded properly

2006-04-14 Thread Grzegorz Ślusarek
Hi all. I sending email using standard python modules smtplib, email, coding email in utf but subject of message is not coded properly. In subject i use my national characters (polish) and after send i get XX in place these characters. Here is the code Message =

Re: create pixmap from data

2006-04-14 Thread Eric Deveaud
Thomas Girod wrote: Hi there. I have a list containing integer values from 0 to 255. With this list I have informations width and height, as width * height = len(my_list) What I want to do is to convert this array into a pixmap of dimension width * height in order to draw it inside a

List of all syntactic sugar?

2006-04-14 Thread Bas
Hi group, just out of curiosity, is there a list of all the syntactic sugar that is used in python? If there isn't such a list, could it be put on a wiki somewhere? The bit of sugar that I do know have helped me a lot in understanding the inner workings of python. To give a few examples (might

Re: A problem with exec statement

2006-04-14 Thread TPJ
Use the exec statement without the in-clause to get the desired effect: def f(): ... a = a ... exec a = 'B' ... print a ... f() B snip Well... I *do* realize that. But this is *not* my problem. I have a function with another nested one. If I used exec ... instead of exec

Re: Remove Whitespace

2006-04-14 Thread Roel Schroeven
Fredrik Lundh schreef: John Machin wrote: $ python2.4 -mtimeit -s str = 'D c a V e r \ = d w o r d : 0 0 0 0 0 6 4 0' 'str.replace( , )' Oi! The OP mentioned whitespace ... yeah. but as is obvious from his examples, he really means UTF-16, not whitespace. Yes, that's what I was

Re: sending email with charset utf-8 but subject is not coded properly

2006-04-14 Thread Rene Pijlman
Grzegorz ¦lusarek: I sending email using standard python modules smtplib, email, coding email in utf but subject of message is not coded properly. In subject i use my national characters (polish) and after send i get XX in place these characters. Here is the code Message =

Re: List of all syntactic sugar?

2006-04-14 Thread Rene Pijlman
Bas: just out of curiosity, is there a list of all the syntactic sugar that is used in python? http://docs.python.org/ref/specialnames.html -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

Re: List of all syntactic sugar?

2006-04-14 Thread Steven D'Aprano
On Fri, 14 Apr 2006 02:54:11 -0700, Bas wrote: Hi group, just out of curiosity, is there a list of all the syntactic sugar that is used in python? If there isn't such a list, could it be put on a wiki somewhere? The bit of sugar that I do know have helped me a lot in understanding the

Re: A problem with exec statement

2006-04-14 Thread TPJ
snip So when you exec 'a = B' in globals(), locals() you might think you were changing the local namespace. In fact you are changing a copy of the local namespace: snip Well, that explains much, but not all that I want to be explained. Why? Because now I understand, that by invoking exec a

Future Warning with Negative Int

2006-04-14 Thread brianlum
Hi, If I try to print a negative integer as a hexadecimal, I get the following error: FutureWarning: %u/%o/%x/%X of negative int will return a signed string in Python 2.4 and up For example: print %X % -1 __main__:1: FutureWarning: %u/%o/%x/%X of negative int will return a signed string in

Re: List of all syntactic sugar?

2006-04-14 Thread Bas
That kind of depends on what you mean by syntactic sugar. Mightbe I was misusing the name of syntactic sugar, but I what I intended to say was all the possible 'transformations' that can be made to reduce all the 'advanced' syntax to some sort of minimal core of the language. Bas --

nested functions

2006-04-14 Thread micklee74
hi just curious , if i have a code like this? def a(): def b(): print b def c(): print c how can i call c() ?? -- http://mail.python.org/mailman/listinfo/python-list

GdkColor : the phantom class ?

2006-04-14 Thread Thomas Girod
Hi. No matter how I try, I just can't find this GdkColor class. I'm trying to convert some data into a pixmap in order to display it. Here is my code : import pygtk pygtk.require('2.0') import gtk xbm = #define dump_width 4 #define dump_height 4 static unsigned char dump_bits[] = { 0xaa, 0x6c,

Re: telnet read_sb_data

2006-04-14 Thread Arne
Thank you for your reply. Yes I have read the documentation. But I am not sure what is the SB/SE suboption. Is this a suboption on the remote machine or for Python. Maybe you could be so kind and explain it to me with a little code example. Thany you very much! Arne Dennis Lee Bieber [EMAIL

%g not the same as %e or %f

2006-04-14 Thread Kent Johnson
According to the docs, %g formatting is Same as e if exponent is greater than -4 or less than precision, f otherwise. So I would expect that for any num, '%g'%num == '%e'%num or '%g'%num == '%f'%num. But this is not the case in fact: Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit

Re: Kross - Start of a Unified Scripting Approach

2006-04-14 Thread has
Jerry wrote: Kind of like AppleScript then? Same fundamental goal, i.e. language-independent application scripting. They seem to have a similar sort of approach to decoupling a scripting language from its host application (Kross::API::ScriptManager vs. the Open Scripting Architecture API) but a

Re: nested functions

2006-04-14 Thread Kent Johnson
[EMAIL PROTECTED] wrote: hi just curious , if i have a code like this? def a(): def b(): print b def c(): print c how can i call c() ?? c is a name in the local scope of a(). You can call c from within a, where the name is in scope, or you can return c or in some other

Re: nested functions

2006-04-14 Thread Szabolcs Berecz
On 14 Apr 2006 04:37:54 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: def a(): def b(): print b def c(): print c how can i call c() ?? Function c() is not meant to be called from outside function a(). That's what a nested function is for: localizing it's usage and prevent

Re: GdkColor : the phantom class ?

2006-04-14 Thread Thomas Girod
I found an answer : color = gtk.gdk.Color() and then use color for fg et bg -- http://mail.python.org/mailman/listinfo/python-list

Re: list.clear() missing?!?

2006-04-14 Thread Ben C
On 2006-04-14, Sergei Organov [EMAIL PROTECTED] wrote: Dennis Lee Bieber [EMAIL PROTECTED] writes: It always means bind... But if the LHS is a mutable object, AND you have specified a component of that object, it is the component that is being rebound... lst[:] = [] [...] Me

Re: requestion regarding regular expression

2006-04-14 Thread Kent Johnson
Kelie wrote: Hello, I'm trying to analyze some autolisp code with python. In the file to be analyzed there are many functions. Each function begins with a defun statement. And before that, there may or may not have comment line(s), which begins with ;. My goal is to export each function

Re: List of all syntactic sugar?

2006-04-14 Thread Diez B. Roggisch
That kind of depends on what you mean by syntactic sugar. For instance, I wouldn't call any of your examples syntactic sugar. AFAIK that is exactly what syntactic sugar means. Apart from non-strictness, all syntax can be expressed by function application. Even foo.bar() is nothing but

Searching and MySQL module stuff

2006-04-14 Thread broz
Thx for the help in finding the search page for this mailing list!! BartlebyScrivener pointed me to the right place. From there http://groups.google.com/group/comp.lang.python , I found what I needed I also discovered I can load mysql-python on my mac fairly easily, if I use Darwin Ports.

Loop with float increments (frange)?

2006-04-14 Thread forum
Hi! what's the standard way for a for loop with float increments? Anton -- http://mail.python.org/mailman/listinfo/python-list

IMPORTANT 2.5 API changes for C Extension Modules and Embedders

2006-04-14 Thread Neal Norwitz
If you don't write or otherwise maintain Python Extension Modules written in C (or C++) or embed Python in your application, you can stop reading. Python 2.5 alpha 1 was released April 5, 2006. The second alpha should be released in a few weeks. There are several changes which can cause C

Re: Kross - Start of a Unified Scripting Approach

2006-04-14 Thread Jerry
Awesome, thanks for the explaination. It was very informative. -- http://mail.python.org/mailman/listinfo/python-list

Re: best way to install python modules on linux

2006-04-14 Thread Fabian Braennstroem
Hi Harry, * Harry George [EMAIL PROTECTED] wrote: Fabian Braennstroem [EMAIL PROTECTED] writes: Hi, I am pretty new to python and will use it mainly in combination with scientific packages. I am running ubuntu breezy right now and see that some packages are out of date. Do you have any

Re: Why new Python 2.5 feature class C() return old-style class ?

2006-04-14 Thread Christophe
Aahz a écrit : In article [EMAIL PROTECTED], Felipe Almeida Lessa [EMAIL PROTECTED] wrote: Em Ter, 2006-04-11 Ã s 07:17 -0700, Aahz escreveu: Can, yes. But should it? The whole point of adding the () option to classes was to ease the learning process for newbies who don't understand why

Discover Medieval Romania /Vlad the Impaler/Dracula/ /www.medievaltours.ro

2006-04-14 Thread Medieval Tours
br div align=centera href=http://www.medievaltours.ro/en/about.php;span style=/span/aa href=http://www.medievaltours.ro/en/about.php;span style=img moz-do-not-send=true alt= src=http://www.medievalart.ro/img/img-cavaler.gif; border=0 height=155 width=92/span/abigbigbigfont color=#00bspan

Re: %g not the same as %e or %f

2006-04-14 Thread Fredrik Lundh
Kent Johnson wrote: According to the docs, %g formatting is Same as e if exponent is greater than -4 or less than precision, f otherwise. So I would expect that for any num, '%g'%num == '%e'%num or '%g'%num == '%f'%num. But this is not the case in fact: Python 2.4.3 (#69, Mar 29 2006,

Re: Upgrading and modules

2006-04-14 Thread BartlebyScrivener
Are you saying you're on Windows? If so, try: http://www.activestate.com/Products/ActivePython/ It's a one-click, msi install with everything you need for win32, including IDE etc. Only thing to watch for is that sometimes the msi file won't install from a logical drive other than c:\. So if

Re: telnet read_sb_data

2006-04-14 Thread Grant Edwards
On 2006-04-14, Arne [EMAIL PROTECTED] wrote: Yes I have read the documentation. But I am not sure what is the SB/SE suboption. Is this a suboption on the remote machine or for Python. Maybe you could be so kind and explain it to me with a little code example. SB/SE are used for telnet

Re: nested functions

2006-04-14 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: just curious , if i have a code like this? def a(): def b(): print b def c(): print c how can i call c() ?? in the same way as you'd access the variable c in this example: def a(): c = 10 (that is, by calling the function and accessing

zlib and zip files

2006-04-14 Thread Jan Prochazka
Hi, I need to decompress zip archive. I wrote a parser of zip file, i obtain the compressed data, but when i call zlib.decompress(data) on them, it throws this error: decbuf = decompressor.decompress(compressed_data) error: Error -3 while decompressing: unknown compression method I try to

zlib zip files

2006-04-14 Thread Jan Prochazka
Hi, I need to decompress zip archive. I wrote a parser of zip file, i obtain the compressed data, but when i call zlib.decompress(data) on them, it throws this error: decbuf = decompressor.decompress(compressed_data) error: Error -3 while decompressing: unknown compression method I try to

Re: nested functions

2006-04-14 Thread Thomas Bartkus
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] hi just curious , if i have a code like this? def a(): def b(): print b def c(): print c how can i call c() ?? Your function 'a' is it's own little world where functions 'b' and 'c' exist. Your code inside 'a' can

Re: Loop with float increments (frange)?

2006-04-14 Thread Dan Sommers
On 14 Apr 2006 06:11:38 -0700, [EMAIL PROTECTED] wrote: what's the standard way for a for loop with float increments? Use a while loop instead: f = initial_value while f = final_value: process(f) f = f + increment Note that there is no general guarantee that f will

Re: nested functions

2006-04-14 Thread Fredrik Lundh
Thomas Bartkus wrote: I, for one, am so glad to have nested functions again ;-) again ? Python has always supported nested functions. it's the scoping rules that have changed; before the change from LGB to LEGB, you had to explictly import objects from outer scopes. /F --

Re: Loop with float increments (frange)?

2006-04-14 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: Hi! what's the standard way for a for loop with float increments? AFAIK there is no, but you should be easily able to write an frange yourself: def frange(from, to, step): while from to: yield from from += step for x in frange(10.5, 23.4, 0.3):

Re: PEP 359: The make Statement

2006-04-14 Thread Steven Bethard
Duncan Booth wrote: Steven Bethard wrote: Should users of the make statement be able to determine in which dict object the code is executed? The make statement could look for a ``__make_dict__`` attribute and call it to allow things like:: make Element html: make Element

Embedding python and multiple separate scripts

2006-04-14 Thread Stefan D
Hi, I'm trying to embed python into an chat bot I've made in c++. After googling around and reading docs for almost a day I have a few questions. First of all it seems like the best way to be able to run separate scripts in different, isolated environments is to create a sub-interpreter (by

Re: zlib and zip files

2006-04-14 Thread Michael Ekstrand
Jan Prochazka wrote: Hi, I need to decompress zip archive. I wrote a parser of zip file, i obtain the compressed data, but when i call zlib.decompress(data) on them, it throws this error: decbuf = decompressor.decompress(compressed_data) error: Error -3 while decompressing: unknown

Re: requestion regarding regular expression

2006-04-14 Thread BartlebyScrivener
Kent, Running path = d:/emacs files/emacsinit.txt lines = open(path).readlines() # my defun lines are lowercase, # next two lines are all on one starts = [i for i, line in enumerate(lines) if line.startswith('(defun')] for i, start in starts: while start 0 and

Re: requestion regarding regular expression

2006-04-14 Thread Felipe Almeida Lessa
Em Sex, 2006-04-14 às 07:47 -0700, BartlebyScrivener escreveu: starts = [i for i, line in enumerate(lines) if line.startswith('(defun')] This line makes a list of integers. enumerate gives you a generator that yields tuples consisting of (integer, object), and by i for i, line you unpack the

Re: zlib and zip files

2006-04-14 Thread Jan Prochazka
Michael Ekstrand napsal(a): Jan Prochazka wrote: Hi, I need to decompress zip archive. I wrote a parser of zip file, i obtain the compressed data, but when i call zlib.decompress(data) on them, it throws this error: decbuf = decompressor.decompress(compressed_data) error: Error -3 while

Re: zlib and zip files

2006-04-14 Thread Felipe Almeida Lessa
Em Sex, 2006-04-14 às 17:14 +0200, Jan Prochazka escreveu: Here is my module for parsing zip files: 1) Have you checked the source of Python's zipfile module? import struct, zlib class ZipHeaderEntry: name = '' offset = 0 uncomlen = 0 comlen = 0 2) You know that those

Re: Iterating command switches from a data file - have a working solution but it seems inefficient

2006-04-14 Thread Larry Bates
News wrote: Hi everyone, My goal is to pull command switches/options from a file and then assign the values to select variables which would eventually be included in a class object. The data file looks something like this but the switches could be in any order and not all may be used.

Re: Loop with float increments (frange)?

2006-04-14 Thread Tim Peters
[EMAIL PROTECTED] what's the standard way for a for loop with float increments? [Dan Sommers] Use a while loop instead: f = initial_value while f = final_value: process(f) f = f + increment Note that there is no general guarantee that f will actually be

Re: PEP 359: The make Statement

2006-04-14 Thread Steven Bethard
Steven Bethard wrote: Duncan Booth wrote: Steven Bethard wrote: Should users of the make statement be able to determine in which dict object the code is executed? The make statement could look for a ``__make_dict__`` attribute and call it to allow things like:: make Element html:

Re: jpype and zxJDBC

2006-04-14 Thread benchline
I haven't compared them, and you may be exacly right. Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Python editing with emacs/wordstar key bindings.

2006-04-14 Thread BartlebyScrivener
Yes, thanks. I was just going to reinstall anyway. That usually fixes it. Rick -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 359: The make Statement

2006-04-14 Thread Felipe Almeida Lessa
Em Sex, 2006-04-14 às 09:31 -0600, Steven Bethard escreveu: [1] Here's the code I used to test it. def make(callable, name, args, block_string): ... try: ... make_dict = callable.__make_dict__ ... except AttributeError: ... make_dict = dict ... block_dict =

Re: zlib and zip files

2006-04-14 Thread Jan Prochazka
Felipe Almeida Lessa napsal(a): Em Sex, 2006-04-14 às 17:14 +0200, Jan Prochazka escreveu: Here is my module for parsing zip files: 1) Have you checked the source of Python's zipfile module? Nice, i thought, that zipfile is written in C, it should be possible to solve my problem

Re: requestion regarding regular expression

2006-04-14 Thread Kent Johnson
BartlebyScrivener wrote: Kent, Running path = d:/emacs files/emacsinit.txt lines = open(path).readlines() # my defun lines are lowercase, # next two lines are all on one starts = [i for i, line in enumerate(lines) if line.startswith('(defun')] for i, start in starts: while start

Including standalone=no in XML declaration

2006-04-14 Thread Stephen Briley
I'm trying to learn about Python and XML. I would like to be able to add standalone=no to my xml declaration when writing an xml file, but I am unable to figure out how. So far, I have the following code: import xml.dom.minidom doc2 = xml.dom.minidom.Document() print doc2.toxml('iso-8859-1')

and ... (WAS PEP 359: The make Statement)

2006-04-14 Thread Steven Bethard
Felipe Almeida Lessa wrote: Em Sex, 2006-04-14 às 09:31 -0600, Steven Bethard escreveu: [1] Here's the code I used to test it. def make(callable, name, args, block_string): ... try: ... make_dict = callable.__make_dict__ ... except AttributeError: ...

Re: list.clear() missing?!?

2006-04-14 Thread Steven D'Aprano
Raymond, I suspect we're not seeing eye to eye on this issue, but I do appreciate you taking the time and effort. Thank you. My comments follow. On Thu, 13 Apr 2006 09:34:46 -0700, Raymond Hettinger wrote: Both the pros and cons were quipped with abrupt perjoratives so the bullet points could

Passing a packed C structure to a c module

2006-04-14 Thread Philippe Martin
Hi, Is it possible to define a packed C structure in python and pass it to the c module, or should the wrapper do that ? Regards, Philippe -- http://mail.python.org/mailman/listinfo/python-list

instance variable weirdness

2006-04-14 Thread wietse
Hello, I have written the following script to illustrate a problem in my code: class BaseClass(object): def __init__(self): self.collection = [] class MyClass(BaseClass): def __init__(self, name, collection=[]): BaseClass.__init__(self) self.name = name

Re: Passing a packed C structure to a c module

2006-04-14 Thread Martin v. Löwis
Philippe Martin wrote: Is it possible to define a packed C structure in python and pass it to the c module, or should the wrapper do that ? You can create a packed structure using string concatenation, and with the help of the struct module. However, this gives you a string object in the end,

Re: requestion regarding regular expression

2006-04-14 Thread BartlebyScrivener
That's it. Thank you! Very instructive. Final: path = d:/emacs files/emacsinit.txt lines = open(path).readlines() # next two lines all on one starts = [i for i, line in enumerate(lines) if line.startswith('(defun')] for i, start in enumerate(starts): while start 0 and

Fixing Python instalation in win2000 by hand

2006-04-14 Thread Sambo
Some time ago I bought a newer computer with W2000 already on it so I moved my old drive to it as secondary( python was installed on non primary partition ). Not sure if the .msi installers were broken before, but they are now (on this installation) and the reason I can't move to brand new

Re: instance variable weirdness

2006-04-14 Thread Felipe Almeida Lessa
Em Sex, 2006-04-14 às 09:18 -0700, wietse escreveu: def __init__(self, name, collection=[]): Never, ever, use the default as a list. self.collection = collection This will just make a reference of self.collection to the collection argument. inst.collection.append(i) As

Re: instance variable weirdness

2006-04-14 Thread Felipe Almeida Lessa
Em Sex, 2006-04-14 às 13:30 -0300, Felipe Almeida Lessa escreveu: To solve your problem, change def __init__(self, name, collection=[]): BaseClass.__init__(self) self.name = name self.collection = collection # Will reuse the list to def __init__(self, name,

Re: Passing a packed C structure to a c module

2006-04-14 Thread Philippe Martin
Thanks, It's a pretty big structure: painfull to pass each item as a param. Regards, Philippe Martin v. Löwis wrote: Philippe Martin wrote: Is it possible to define a packed C structure in python and pass it to the c module, or should the wrapper do that ? You can create a packed

Re: PEP 359: The make Statement

2006-04-14 Thread Rob Williscroft
Steven Bethard wrote in news:[EMAIL PROTECTED] in comp.lang.python: Open Issues === Does the ``make`` keyword break too much code? Originally, the make statement used the keyword ``create`` (a suggestion due to Nick Coghlan). However, investigations into the standard library

Re: Forms with multiple submit buttons vs 'form' objects with single 'submit' methods

2006-04-14 Thread neil . fitzgerald
Paul Rubin wrote: [EMAIL PROTECTED] writes: Here's my question: Suppose a form has more than one submit button. Now the COM 'form' object has a 'submit' method that doesn't take any arguments, so how do I tell it which button I want to press? What difference does it make? Don't they

Re: PEP 359: The make Statement

2006-04-14 Thread Nicolas Fleury
Felipe Almeida Lessa wrote: Em Sex, 2006-04-14 às 09:31 -0600, Steven Bethard escreveu: [1] Here's the code I used to test it. def make(callable, name, args, block_string): ... try: ... make_dict = callable.__make_dict__ ... except AttributeError: ... make_dict =

Re: Passing a packed C structure to a c module

2006-04-14 Thread Martin v. Löwis
Philippe Martin wrote: It's a pretty big structure: painfull to pass each item as a param. So how else would you like to pass them? Define the API you want, and then just implement it. It still shouldn't require to define the layout in Python. Regards, Martin --

Re: Fixing Python instalation in win2000 by hand

2006-04-14 Thread BartlebyScrivener
Not sure if the .msi installers were broken before, but they are now (on this installation) Are you installing from c:\ ? With administrator rights? Check other requirements. It chokes if you are installing from another logical drive, e.g., d:\

Re: nested functions

2006-04-14 Thread bruno at modulix
Szabolcs Berecz wrote: On 14 Apr 2006 04:37:54 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: def a(): def b(): print b def c(): print c how can i call c() ?? Function c() is not meant to be called from outside function a(). That's what a nested function is for:

Re: Passing a packed C structure to a c module

2006-04-14 Thread Philippe Martin
Well, The call actually is an IOCtl: depending on the control code, the structure has a different format. Although the number of control codes/structures is finite, it would make the wrapper function fairly large. You seem to think that building the structure from python would be a mistake: why

Re: Future Warning with Negative Int

2006-04-14 Thread Peter Otten
[EMAIL PROTECTED] wrote: If I try to print a negative integer as a hexadecimal, I get the following error: print %X % -1 __main__:1: FutureWarning: %u/%o/%x/%X of negative int will return a signed string in Python 2.4 and up Does that mean that in the future it will say -1 or

Re: Python editing with emacs/wordstar key bindings.

2006-04-14 Thread [EMAIL PROTECTED]
This is new to me. I did not know that emacs HAD a word star mode. I may have to look at emacs again (last time was 1995). I am still looking for a python editor I like. Yes I used to write asm code in wordstar in nondocument mode. And yes all of the old dos editors used the wordstar keys.

Re: instance variable weirdness

2006-04-14 Thread Steven D'Aprano
On Fri, 14 Apr 2006 13:30:49 -0300, Felipe Almeida Lessa wrote: Em Sex, 2006-04-14 às 09:18 -0700, wietse escreveu: def __init__(self, name, collection=[]): Never, ever, use the default as a list. Unless you want to use the default as a list. Sometimes you want the default to mutate

Writing backwards compatible code

2006-04-14 Thread Steven D'Aprano
I came across an interesting (as in the Chinese curse) problem today. I had to modify a piece of code using generator expressions written with Python 2.4 in mind to run under version 2.3, but I wanted the code to continue to use the generator expression if possible. My first approach was to use a

skip item in list for loop

2006-04-14 Thread Jacob Rael
I am new to python and I love it. I am hacking a file. I want to not print a line if it contains the word 'pmos4_highv'. I also don't want to print the next line. The following code works but it smells bad and just doesn't look right. I was reading about generators. If I was using one, I could do

Re: Fixing Python instalation in win2000 by hand

2006-04-14 Thread Sambo
BartlebyScrivener wrote: Not sure if the .msi installers were broken before, but they are now (on this installation) Are you installing from c:\ ? almost never With administrator rights? pretty sure YES Check other requirements. It chokes if you are installing from another logical

  1   2   >