Re: Minidom empty script element bug

2005-03-15 Thread Derek Basch
Martin v. Löwis wrote: > Derek Basch wrote: > > XHTML 1.0 specs, Appendix C > > [EMAIL PROTECTED] > > C.3 Element Minimization and Empty Element Content > > > > Given an empty instance of an element whose content model is not EMPTY (for > > example, an empty title or paragraph) do not use the mini

Dumping an instance

2005-03-15 Thread gf gf
If I want to dump (for debugging) an instance and all of it's member attributes, what's the simplest way? print myInstance just gives a pointer to its location in memory Thanks! __ Do you Yahoo!? Yahoo! Mail - 250MB free storage. Do more. Ma

Re: Dumping an instance

2005-03-15 Thread Roy Smith
In article <[EMAIL PROTECTED]>, gf gf <[EMAIL PROTECTED]> wrote: > If I want to dump (for debugging) an instance and all > of it's member attributes, what's the simplest way? > > print myInstance > > just gives a pointer to its location in memory You need to write a str() method for the class.

Re: How do I pass structures using a C extension?

2005-03-15 Thread Yevgen Muntyan
Jaime Wyant wrote: > You need to check out swig. It is the *only* way to setup a `c' > library for use with python. It's not. Regards, Yevgen -- http://mail.python.org/mailman/listinfo/python-list

Re: Dumping an instance

2005-03-15 Thread Peter Hansen
gf gf wrote: If I want to dump (for debugging) an instance and all of it's member attributes, what's the simplest way? print myInstance just gives a pointer to its location in memory Roughly speaking, as a starting point: from pprint import pformat def dump(obj): print repr(obj) for name in

Python Debug logging

2005-03-15 Thread gf gf
Is there a simple way to log to a debug console in Python? In .NET, you can Debug.Write(str), which does nothing if there is no debug console open, but, if there is, debugs the message. Is there something similar? Alternatively, is there a very simple log4j type setup? I emphasize very simple,

Re: Python Debug logging

2005-03-15 Thread news.sydney.pipenetworks.com
gf gf wrote: Is there a simple way to log to a debug console in Python? In .NET, you can Debug.Write(str), which does nothing if there is no debug console open, but, if there is, debugs the message. Is there something similar? Alternatively, is there a very simple log4j type setup? I emphasize ve

Re: Python becoming less Lisp-like

2005-03-15 Thread news.sydney.pipenetworks.com
Torsten Bronger wrote: HallÃchen! [EMAIL PROTECTED] (Paul Boddie) writes: Torsten Bronger <[EMAIL PROTECTED]> wrote: At first, I was very pleased by Python's syntax (and still I am). Then, after two weeks, I learned about descriptors and metaclasses and such and understood nothing (for the first

Re: unicode converting

2005-03-15 Thread Leif K-Brooks
Maxim Kasimov wrote: Diez B. Roggisch wrote: Maxim Kasimov wrote: there are a few questions i can find answer in manual: 1. how to define which is internal encoding of python unicode strings (UTF-8, UTF-16 ...) It shouldn't be your concern - but you can specify it using " ./configure --enable-uni

Re: RotatingFileHandler and logging config file

2005-03-15 Thread Rob Cranfill
Kent Johnson wrote: It is in the latest docs. Kent No, it isn't. (But thanks for replying anyway!) http://docs.python.org/lib/logging-config-fileformat.html has all the others (OK, maybe not all, I haven't thoroughly checked, but it's got nine of 'em) but nothing for RFH. Or is that not "the la

how to read a tab delimited file

2005-03-15 Thread jrlen balane
how would i read a tab delimited file? at the same time put what i read in an array, say for example that i know that the file is an array with column= 5 and row=unknown. -- http://mail.python.org/mailman/listinfo/python-list

SAX parsing problem

2005-03-15 Thread anon
So I've encountered a strange behavior that I'm hoping someone can fill me in on. i've written a simple handler that works with one small exception, when the parser encounters a line with '&' in it, it only returns the portion that follows the occurence. For example, parsing a file with the lin

Re: how to read a tab delimited file

2005-03-15 Thread Peter Hansen
jrlen balane wrote: how would i read a tab delimited file? at the same time put what i read in an array, say for example that i know that the file is an array with column= 5 and row=unknown. Use the "csv" module. Although that stands for "comma separated values", it readily supports alternative de

Re: RotatingFileHandler and logging config file

2005-03-15 Thread Peter Hansen
Rob Cranfill wrote: Kent Johnson wrote: It is in the latest docs. No, it isn't. (But thanks for replying anyway!) Can you prove it isn't? ;-) http://docs.python.org/lib/logging-config-fileformat.html has all the others (OK, maybe not all, I haven't thoroughly checked, but it's got nine of 'em)

code for Computer Language Shootout

2005-03-15 Thread Jacob Lee
There are a bunch of new tests up at shootout.alioth.debian.org for which Python does not yet have code. I've taken a crack at one of them, a task to print the reverse complement of a gene transcription. Since there are a lot of minds on this newsgroup that are much better at optimization than I, I

Re: Turning String into Numerical Equation

2005-03-15 Thread Michael Spencer
Giovanni Bajo wrote: Steven Bethard wrote: I use something along these lines: def safe_eval(expr, symbols={}): return eval(expr, dict(__builtins__=None, True=True, False=False), symbols) import math def calc(expr): return safe_eval(expr, vars(math)) That offers only notional security: >>> ca

Re: code for Computer Language Shootout

2005-03-15 Thread Robert Kern
Jacob Lee wrote: By the way - is there a good way to find out the maximum memory a program used (in the manner of the "time" command)? Other than downloading and running the shootout benchmark scripts, of course. Inserting appropriate pauses with raw_input() and recording the memory usage using to

Re: Turning String into Numerical Equation

2005-03-15 Thread Steven Bethard
Giovanni Bajo wrote: When __builtin__ is not the standard __builtin__, Python is in restricted execution mode. Do you know where this is documented? I looked around, but couldn't find anything. STeVe -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Debug logging

2005-03-15 Thread Steven Bethard
gf gf wrote: Is there a simple way to log to a debug console in Python? Don't know exactly what you want, but you should check out the logging module: http://docs.python.org/lib/minimal-example.html STeVe -- http://mail.python.org/mailman/listinfo/python-list

Re: Python becoming less Lisp-like

2005-03-15 Thread Mike C. Fletcher
Thomas Bellman wrote: Torsten Bronger <[EMAIL PROTECTED]> wrote: Just to amplify Thomas' statements... ... And inflexibility will always make some situations horribly daunting to get out of. Powerful constructs like these can, in some cases, enable a skilled package writer to design an API that

Re: code for Computer Language Shootout

2005-03-15 Thread Michael Spencer
Jacob Lee wrote: There are a bunch of new tests up at shootout.alioth.debian.org for which Python does not yet have code. I've taken a crack at one of them, a task to print the reverse complement of a gene transcription. Since there are a lot of minds on this newsgroup that are much better at optim

Re: code for Computer Language Shootout

2005-03-15 Thread Robert Kern
Here's my solution to the problem[1]: [1] http://shootout.alioth.debian.org/benchmark.php?test=revcomp import sys import string basetable = string.maketrans('ACBDGHKMNSRUTWVYacbdghkmnsrutwvy', 'TGVHCDMKNSYAAWBRTGVHCDMKNSYAAWBR') def revcomp(seqlines, linelength=60, base

Re: code for Computer Language Shootout

2005-03-15 Thread Steven Bethard
Jacob Lee wrote: There are a bunch of new tests up at shootout.alioth.debian.org for which Python does not yet have code. I've taken a crack at one of them, a task to print the reverse complement of a gene transcription. Since there are a lot of minds on this newsgroup that are much better at optim

Re: how to read a tab delimited file

2005-03-15 Thread jrlen balane
if i am going to do this, how should i continue: how would i know the end of file? table_data = open(filename, 'r') table_data.readlines() On Tue, 15 Mar 2005 23:37:50 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: > jrlen balane wrote: > > how would i read a tab delimited file? at the same tim

Re: how to read a tab delimited file

2005-03-15 Thread Steven Bethard
> Peter Hansen wrote: > >>jrlen balane wrote: >> >>>how would i read a tab delimited file? at the same time put what i >>>read in an array, say for example that i know that the file is an >>>array with column= 5 and row=unknown. >> >>Use the "csv" module. Although that stands for "comma >>separate

Re: code for Computer Language Shootout

2005-03-15 Thread Jacob Lee
On Tue, 15 Mar 2005 21:38:48 -0800, Michael Spencer wrote: > string.translate is a good idea. Note you can handle upper-casing and > translation in one operation by adding a mapping from lower case to the > complement i.e., > > table = string.maketrans('ACBDGHK\nMNSRUTWVYacbdghkmnsrutwvy', >

Re: is there a problem on this simple code

2005-03-15 Thread Tim Roberts
jrlen balane <[EMAIL PROTECTED]> wrote: >why is it that here: > >1)rx_data = ser.read(10) >(rx_command, rx_msg_no, rx_no_databyte, temp1, temp2, pyra1, >pyra2, voltage, current, rx_checksum) = unpack('10B', rx_data) >print rx_command, rx_msg_no, rx_no_databyte, temp1, temp2, pyra1, >pyra2,

Re: code for Computer Language Shootout

2005-03-15 Thread Jacob Lee
On Tue, 15 Mar 2005 22:45:48 -0700, Steven Bethard wrote: > # table as default argument value so you don't have to do > # a global lookup each time it's used > > def show(seq, table=string.maketrans('ACBDGHK\nMNSRUTWVY', > 'TGVHCDM\nKNSYAAWBR') > seq = s

Re: error sending path to Win OS

2005-03-15 Thread Tim Roberts
Earl Eiland <[EMAIL PROTECTED]> wrote: > >A couple of you commented that I should be using os.path.join. >Accordingly, I rewrote my code. Unfortunately, I still have the same >problem. the following code snippet > >Results.SetOriginal(os.path.getsize(os.path.join(InputDirectory , x))) >y = str(x

Re: code for Computer Language Shootout

2005-03-15 Thread Steven Bethard
Jacob Lee wrote: So here's a tentative contest version of the code: import sys import string def show(seq, table=string.maketrans('ACBDGHK\nMNSRUTWVYacbdghkmnsrutwvy', 'TGVHCDM\nKNSYAAWBRTGVHCDMKNSYAAWBR')): seq = seq.translate(table)[::-1] for i in ra

Re: __getitem__ method on (meta)classes

2005-03-15 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Steven Bethard <[EMAIL PROTECTED]> wrote: > > Yeah, except I actually left out one thing: I also want type(v)==e1. > > Why? In Python usually you rely on duck-typing and not explicit type > checks. What is it that you're trying to gain by asserting type(v) ==

Re: Jython Phone Interview Advice

2005-03-15 Thread Jeremy Bowers
On Tue, 15 Mar 2005 03:21:19 -0800, George Jempty wrote: > I'm noticing that Javascript's array/"hash" literal syntax is EXACTLY the > same as that for Python lists/dictionaries. No it isn't, quite. Two differences of note, one literally syntax and one technically not but you probably still want

Re: Python becoming less Lisp-like

2005-03-15 Thread Jeremy Bowers
On Tue, 15 Mar 2005 03:21:48 -0800, Paul Boddie wrote: > Well, I've been using Python for almost ten years, and I've managed to > deliberately ignore descriptors and metaclasses quite successfully. I get > the impression that descriptors in particular are a detail of the > low-level implementation

Re: code for Computer Language Shootout

2005-03-15 Thread Michael Spencer
Jacob Lee wrote: On Tue, 15 Mar 2005 21:38:48 -0800, Michael Spencer wrote: string.translate is a good idea. Note you can handle upper-casing and translation in one operation by adding a mapping from lower case to the complement i.e., table = string.maketrans('ACBDGHK\nMNSRUTWVYacbdghkmnsrutwvy',

Re: SAX parsing problem

2005-03-15 Thread David M. Cooke
anon <[EMAIL PROTECTED]> writes: > So I've encountered a strange behavior that I'm hoping someone can fill > me in on. i've written a simple handler that works with one small > exception, when the parser encounters a line with '&' in it, it > only returns the portion that follows the occurence.

Re: Why tuple with one item is no tuple

2005-03-15 Thread Max M
Gregor Horvath wrote: thanks are given to all "problem" solved... Personally I add a , after every list/tuple item. Also the last. It also makes copy/pasting code easier. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: will it cause any problems to open a read-only file & not close it?

2005-03-15 Thread Tim Roberts
Sara Khalatbari <[EMAIL PROTECTED]> wrote: >Dear friends >In a code, I'm opening a file to read. Like : >lines = open(filename).readlines() >& I'm never closing it. >I'm not writing in that file, I just read it. > >Will it cause any problems if you open a file to read >& never close it? A fil

Re: win32 shell extension (virtual drive)

2005-03-15 Thread Tim Roberts
Tiziano Bettio <[EMAIL PROTECTED]> wrote: > >I'm looking for a simple solution of a win32 shell extension (virtual >drive). > >It should make available a new drive with letter, which will be >read-only. Instead of a network drive or similar it then should query a >server application for directory/f

<    1   2   3