Re: What's so funny? WAS Re: rotor replacement

2005-01-31 Thread Nick Craig-Wood
Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: What's so funny? WAS Re: rotor replacement

2005-01-30 Thread Nick Craig-Wood
in the installer. Basically a whole heap of extra work. I think one of the special things about Python is its batteries included approach, and a crypto library would seem to be an obvious battery to install since it doesn't (or needn't) depend on any other library or application. -- Nick Craig-Wood

Re: What's so funny? WAS Re: rotor replacement

2005-01-30 Thread Nick Craig-Wood
example shows it's possible to do it in one call. There is a PEP about this... API for Block Encryption Algorithms v1.0 http://www.python.org/peps/pep-0272.html -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: limited python virtual machine

2005-01-30 Thread Nick Craig-Wood
for its control programs. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: What's so funny? WAS Re: rotor replacement

2005-01-29 Thread Nick Craig-Wood
://www.google.com/search?q=cache:U5-RsbkSs0MJ:www.cs.chalmers.se/Cs/Grundutb/Kurser/krypto/lect04_4.pdf -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: example needed: sip + Qt

2005-01-28 Thread Craig Ringer
archives first). -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic class methods misunderstanding

2005-01-28 Thread Craig Ringer
is essentially a class (in the OOP sense, not the python- specific classobj sense). You can call a type or class to create an instance of that class or type. Here, you call the 'instancemethod' type to create an instance of type 'instancemethod'. Makes sense ... in hindsight. -- Craig Ringer -- http

Re: Elliptic Code

2005-01-28 Thread Nick Craig-Wood
Philip Smith [EMAIL PROTECTED] wrote: I understand the algorithm quite well but how to code the multiplication stage most efficiently in python eludes me. You might want to look at http://gmpy.sourceforge.net/ It has very fast multiplication up to any size you like! -- Nick Craig-Wood

Re: debugging os.spawn*() calls

2005-01-28 Thread Nick Craig-Wood
with the os.* family perhaps you may find pexpect a wee bit easier... If using 2.4 the subprocess module is a good solution too. It lets you catch stdout/stderr easily. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Classical FP problem in python : Hamming problem

2005-01-27 Thread Nick Craig-Wood
been good exercise! -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Help With Python

2005-01-27 Thread Nick Craig-Wood
vikings = [Viking()] * 7 vikings[0] is vikings[1] True whereas vikings = [Viking() for _ in range(7)] vikings[0] is vikings[1] False So you want this... orders = [ Viking().order() for _ in range(7) ] -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http

Re: Inherting from object. Or not.

2005-01-27 Thread Nick Craig-Wood
.MyOldException: __main__.MyOldException instance at 0xb7df4cac After that I recalled a thread on python-dev about it http://mail.python.org/pipermail/python-dev/2004-August/046812.html -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman

Re: XOR on string

2005-01-27 Thread Nick Craig-Wood
, map(ord, string))' 10 loops, best of 3: 15.6 usec per loop -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Hello

2005-01-27 Thread Craig Ringer
to your ISP's news server, *then* you can subscribe to comp.lang.python. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: how to write a tutorial

2005-01-26 Thread Craig Ringer
-- or if they are, they can find it in comp.lang.python. Going by the general reaction on c.l.py, I think it'd be more accurate if you left that at Please stop posting. Sorry for the cross-post, and for this perl-python moron who appears to have nothing to do with either, or any knowledge of them. -- Craig Ringer

Re: python without OO

2005-01-26 Thread Craig Ringer
of objects into a functionally styled processing pipeline, say a series of functions that each just return the result of a listcomp/genexp. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: exclude binary files from os.walk

2005-01-26 Thread Craig Ringer
of 'binary files'. :) non-ascii That's not really safe when dealing with utf-8 files though, and IIRC with UCS2 or UCS4 as well. The Unicode BOM its self might (I'm not sure) qualify as ASCII. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Classical FP problem in python : Hamming problem

2005-01-25 Thread Nick Craig-Wood
heard of Hamming sequences before! -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Classical FP problem in python : Hamming problem

2005-01-25 Thread Nick Craig-Wood
anything useful so I removed them) -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Classical FP problem in python : Hamming problem

2005-01-25 Thread Nick Craig-Wood
Steven Bethard [EMAIL PROTECTED] wrote: Nick Craig-Wood wrote: Thinking about this some more leads me to believe a general purpose imerge taking any number of arguments will look neater, eg def imerge(*generators): values = [ g.next() for g in generators ] while True

Re: best way to do a series of regexp checks with groups

2005-01-23 Thread Nick Craig-Wood
(re.search(r'mult (\d+) (\d+)', line)): do_mult(m.value.group(1), m.value.group(2)) elif m.set(re.search(r'help (\w+)', line)): show_help(m.value.group(1)) -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: rotor replacement

2005-01-22 Thread Nick Craig-Wood
it must be possible to add a few simple crypto modules to python? That said a) IANAL b) 'apt-get install python-crypto' works for me ;-) -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: need help on need help on generator...

2005-01-22 Thread Craig Ringer
(':',1))) . data = ''.join(x for x in initer) because that seems like a pretty ugly hack (and please ignore the variable names). Perhaps a way to get the file to seek back to the point last read from the iterator when the iterator is destroyed? -- Craig Ringer -- http://mail.python.org/mailman

Re: need help on need help on generator...

2005-01-22 Thread Craig Ringer
of the iterator when read() etc are called? If not, I favour the suggestion in the referenced post - file should probably fail noisily, or at least emit a warning. What are others thoughts on this? -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: default value in a list

2005-01-22 Thread Nick Craig-Wood
(':')[:3] Or this version if you want something other than as the default a, b, b = (line.split(':') + 3*[None])[:3] BTW This is a feature I miss from perl... -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: need help on need help on generator...

2005-01-22 Thread Craig Ringer
On Sat, 2005-01-22 at 12:20 +0100, Alex Martelli wrote: Craig Ringer [EMAIL PROTECTED] wrote: . data = ''.join(x for x in infile) Maybe ''.join(infile) is a better way to express this functionality? Avoids 2.4 dependency and should be faster as well as more concise. Thanks - for some

Re: default value in a list

2005-01-22 Thread Nick Craig-Wood
Alex Martelli [EMAIL PROTECTED] wrote: Nick Craig-Wood [EMAIL PROTECTED] wrote: ... Or this version if you want something other than as the default a, b, b = (line.split(':') + 3*[None])[:3] Either you mean a, b, c -- or you're being subtler than I'm grasping. Just a typo

Re: Overloading ctor doesn't work?

2005-01-21 Thread Nick Craig-Wood
! http://sourceforge.net/tracker/index.php?func=detailaid=720908group_id=5470atid=105470 However its been fixed in a recent Python 2.3. (I was bitten by the same thing which used to fail but now works after an upgrade of python 2.3!) -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com

Re: need help on generator...

2005-01-21 Thread Craig Ringer
On Fri, 2005-01-21 at 22:38 +0800, Craig Ringer wrote: consecutive_sets = ( x[offset:offset+subset_size] for subset_size in xrange(2, len(x)) for offset in xrange(0, len(x) + 1 - subset_size) ) Where 'x' is list to operate on, as I should've initially

Re: need help on need help on generator...

2005-01-21 Thread Craig Ringer
and library modules return generators for things. I know this is now the case for reading lines in a file or with the new iterator package. But what else ? Does Craig Ringer answer mean that list comprehensions are lazy ? Nope, but generator expressions are, and they're pretty similar. Where can I

Re: need help on generator...

2005-01-21 Thread Craig Ringer
http://docs.python.org/whatsnew/node4.html http://www.python.org/dev/doc/newstyle/ref/genexpr.html for details. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Configuring Python for Tk on Mac

2005-01-21 Thread Craig Ringer
in the error message to that effect. I've just checked the OSX 10.3 machine here, and it fails to import tkinter there too. I'd say Apple just don't build Python with Tk support. What do I do to set it up so I can use Tkinter? Try Google - this seems to be a moderately FAQ for MacOS/X. -- Craig

Re: Tuple size and memory allocation for embedded Python

2005-01-21 Thread Craig Ringer
://docs.python.org/api/tupleObjects.html -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Tuple size and memory allocation for embedded Python

2005-01-21 Thread Craig Ringer
and/or failing to detect and handle or propagate an exception. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: finding name of instances created

2005-01-21 Thread Craig Ringer
this - as that can often be very helpful both in understanding what you're thinking and in suggesting a suitable approach or alternative. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: rotor replacement

2005-01-19 Thread Nick Craig-Wood
is a problem now-a-days. AES in the core python library would be very useful and it would discourage people from writing their own crypto routines (looks easy but isn't!) -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT] Good C++ book for a Python programmer

2005-01-19 Thread Craig Ringer
of referencing deleted memory by accident. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: lambda

2005-01-17 Thread Craig Ringer
. That said, I do think the rules deserve consideration and respect - they're usually there because of many others' experience over time. It's interesting to learn those lessons first hand, but it's nice to be able to avoid repeating every single one of them. -- Craig Ringer -- http://mail.python.org

Re: Refactoring; arbitrary expression in lists

2005-01-13 Thread Nick Craig-Wood
, potato.123): print f, detectMimeType(f) ... prints index.php application/x-php index.php3 None prog.cc text/x-c++-src prog.cpp text/x-c++-src flodge.xsl xsl Makefile text/x-makefile myMakefile text/x-makefile potato.123 None -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick

Re: Debian says Warning! you are running an untested version of Python. on 2.3

2005-01-13 Thread Nick Craig-Wood
An interactive high-level object-oriented la ii python2.4 2.4-2 An interactive high-level object-oriented la -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Debian says Warning! you are running an untested version of Python. on 2.3

2005-01-13 Thread Nick Craig-Wood
(and eventually) - stable. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: python and macros (again) [Was: python3: 'where' keyword]

2005-01-13 Thread Craig Ringer
(generator expressions, list comprehensions, for loops, ...?) over (sequences, iterators, generators) I happen to be extremely fond of the flexibility this provides, but one obvious way to do it there is not. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: counting items

2005-01-13 Thread Craig Ringer
] ;-) If it means I _never_ have to see that list comprehension again, then seeing 'flatten' go into itertools would make me very, very happy :-P -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Python.org, Website of Satan

2005-01-12 Thread Craig Ringer
: That'll work fine in Python 2.3. I think you meant: print sum(ord(x) for x in PyPy) which is a different matter entirely (well, regarding compatibility anyway). -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: here document

2005-01-11 Thread Craig Ringer
. I'd use: os.popen(/bin/exe.x, w).write(\ CategorY = GRIB etc. ) myself, but that's just taste (well, and performance I suspect). -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: C structure in the Python extension

2005-01-10 Thread Craig Ringer
specific to the Python/C API). -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: windows mem leak

2005-01-10 Thread Nick Craig-Wood
Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: missing sys.setappdefaultencoding

2005-01-07 Thread Craig Ringer
str.encode(), str.decode() and unicode() calls where appropriate. On a side note, PEP 263 handles the text encoding interpretation of Python program source, and is well worth reading and following. http://python.org/peps/pep-0263.html -- Craig Ringer -- http://mail.python.org/mailman/listinfo

Re: sorting on keys in a list of dicts

2005-01-07 Thread Craig Ringer
, but I hope I made sense. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: how to extract columns like awk $1 $5

2005-01-07 Thread Craig Ringer
. print %s %s % tuple(x.split()[4:6]) -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Help uninstalling/installing Python 2.4

2005-01-07 Thread Craig Ringer
didn't have the GNU readline development headers installed, so Python disabled readline support when it was compiled. That's just a guess, but seems pretty likely. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: _tkinter problem

2005-01-07 Thread Craig Ringer
with it? I think your question is the same problem as another recent poster - that is, you didn't have the Tcl and Tk headers installed when you installed Python. Please see my answer to Help uninstalling/installing Python 2.4 (Yes, I know yours isn't Python 2.4 - it doesn't matter). -- Craig Ringer

Re: Embedding a restricted python interpreter

2005-01-06 Thread Craig Ringer
On Thu, 2005-01-06 at 23:05, Peter Maas wrote: Craig Ringer schrieb: It would certainly be difficult to track all harmful code constructs. But AFAIK the idea of a sandbox is not to look at the offending code but to protect the offended objects: files, databases, URLs, sockets etc

Re: Python C Object Comparison

2005-01-06 Thread Craig Ringer
about the best way to solve your problem, you'll probably need to explain a bit more of your problem - like what your extension module is doing that makes it have to pass PyCObjects around and get Python code to work with them. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: File Handling Problems Python I/O

2005-01-06 Thread Craig Ringer
lots of other handy tools, so I strongly recommend checking it out. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Embedding a restricted python interpreter

2005-01-06 Thread Craig Ringer
providers would like to have to do all the time for many hosted sites. I wonder if SCGI or a similar persistent CGI solution might be more practical for running CGI scripts under specific user accounts. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: curses is not imported under Linux (and Python 2.4)

2005-01-06 Thread Craig Ringer
) installed. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Embedding a restricted python interpreter

2005-01-04 Thread Craig Ringer
a global and local environment for your script to run in. I do not know if it is possible to disable or override 'import'.. You can do a fair bit to it by wrapping/replacing __builtin__.__import__ . Preventing people from getting around what you've done, though... not sure. -- Craig Ringer

Re: emulating an and operator in regular expressions

2005-01-03 Thread Craig Ringer
it. My first thought would be to express your 'A and B' regex as: (A.*B)|(B.*A) with whatever padding, etc, is necessary. You can even substitute in the sub-regex for A and B to avoid writing them out twice. -- Craig Ringer -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Developing Commercial Applications in Python

2005-01-03 Thread Craig Ringer
to keep an eye on the licenses of any extensions you used, like ReportLab, PIL, mx, database interfaces, twisted, etc. Many are licensed under the same license as Python or an MIT-like license, but of course some Python extensions are not and you would need to consider that. -- Craig Ringer -- http

Re: Bad Interpreter

2005-01-03 Thread Craig Ringer
sock.py but ./sock.py results in a :bad interpreter error how do i troubleshoot something like this? You probably have Windows-style line endings in the file. The kernel sees the ^M at the end of the line and gets all confused. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python

Re: exposing C array to python namespace: NumPy and array module.

2005-01-01 Thread Craig Ringer
module that uses your C module internally (see PIL for a good example of this). -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: exposing C array to python namespace: NumPy and array module.

2005-01-01 Thread Craig Ringer
you to do so, and it's hardly worth repeating the work if you don't have to. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: screen clear question

2005-01-01 Thread Craig Ringer
' on many UNIX systems; no idea about Windows. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Speed ain't bad

2004-12-31 Thread Craig Ringer
; however, it's my understanding that compressing individual files also means that in the case of damage to the archive it is possible to recover the files after the damaged file. This cannot be guaranteed when the archive is compressed as a single stream. -- Craig Ringer -- http://mail.python.org

Re: justifying text...and also...correct use of classes...

2004-12-30 Thread Craig Ringer
, rightstring) or %20s: %-40s % (leftstring, rightstring) That's Python's 'printf' style string formatting. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Updating file objects automatically

2004-12-30 Thread Craig Ringer
): cls.class_level_variable = newval setvaluecls = classmethod(setvaluecls) sevaluecls and setvalue look the same to callers calling them on an instance of the class. I have no idea if that's actually appropriate for your needs, it's just a stab in the dark, but perhaps it might be. -- Craig

Re: Probleme mit der Installation der openSource Bittorrent.... python vs JAVA

2004-12-30 Thread Craig Ringer
. This is probably not the right place. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: what would you like to see in a 2nd edition Nutshell?

2004-12-29 Thread Craig Ringer
it. It wouldn't hurt to point C extension authors at things like the 'es' encoded string format for PyArg_ParseTuple to help them make their code better behaved with non-ascii text. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

DB-API format string conventions

2004-12-28 Thread Craig Ringer
. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Reference behavior through C (was: Lambda going out of fashion)

2004-12-28 Thread Craig Ringer
On Wed, 2004-12-29 at 02:08, Cameron Laird wrote: In article [EMAIL PROTECTED], Craig Ringer [EMAIL PROTECTED] wrote: . . . IMO the reference behaviour of functions in the C API could be clearer. [snip

Re: Multiple Inheritance __slots__ problem

2004-12-25 Thread Craig Ringer
in this situation is don't use __slots__. If you think you need __slots__, still don't use __slots__. I've made use of __slots__ once myself for an optimisation when subclassing `str', but if you're not using it for a serious optimisation need it's probably best to steer clear. -- Craig Ringer -- http

Re: Clearing the screen

2004-12-25 Thread Craig Ringer
often :-P -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: regular expression: perl == python

2004-12-23 Thread Nick Craig-Wood
+); # 2. entities |([^'\=\s]+) # 3. text strings (no special characters) |(\s+) # 4. whitespace |(.) # 5. special characters , re.VERBOSE) Its probably faster though, so I give in gracelessly ;-) -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig

Re: Lambda going out of fashion

2004-12-23 Thread Craig Ringer
Fredrik Lundh wrote: Craig Ringer wrote: It's hard to consistently support Unicode in extension modules without doing a lot of jumping through hoops. Unicode in docstrings is particularly painful. This may not be a big deal for normal extension modules, but when embedding Python it's a source

Re: regular expression: perl == python

2004-12-23 Thread Nick Craig-Wood
that you are looking in the wrong place! ...however that page doesn't exist ;-) -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: regular expression: perl == python

2004-12-22 Thread Nick Craig-Wood
(re.search(r'^(\d+)$', line)) or m[-1]: print int,int(m[-1].group(1)) elif m.append(re.search(r'^(\d*\.\d*)$', line)) or m[-1]: print float,float(m[-1].group(1)) else: print unknown thing, line -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org

Re: Killing a python thread with a signal

2004-12-22 Thread Craig Ringer
- it might be a good idea to search the archives. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: PHP vs. Python

2004-12-22 Thread Craig Ringer
think it'd certainly be well worth a try, especially if you're writing any more complex applications. That said, for 90% of users development time matters more than execution speed, and that's another matter entirely. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Lambda going out of fashion

2004-12-22 Thread Craig Ringer
of these issues would make it a fair bit nicer again, especially for people embedding Python in apps (a place were it can seriously excel as a scripting/extension/glue language). -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Lambda going out of fashion

2004-12-22 Thread Craig Ringer
the issue. After all, these two are the same: def callfunc(function,args): return apply(function,args) and def callfunc(function,args): return function(*args) its just an (IMO trivial) difference in syntax. I'd be interested in knowing if there is in fact more to it than this. -- Craig

Re: Printing

2004-12-21 Thread Craig Ringer
comp.lang.python (this list/newsgroup). -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: A rational proposal

2004-12-20 Thread Christopher A. Craig
very real performance reasons to do it in C rather than Python (i.e. I'm manipulating the internals of the numerator and denominator by hand for performance in the GCD function) -- Christopher A. Craig [EMAIL PROTECTED] I affirm brethren by the boasting in you which I have in Christ Jesus our Lord

Re: Easy here documents ??

2004-12-20 Thread Nick Craig-Wood
Jim Hill [EMAIL PROTECTED] wrote: Nick Craig-Wood wrote: I prefer this ... I'll have %(amount)s %(what)s ... for $%(cost)s please % locals() Looks pretty slick. This might just be what I need. Its almost as neat as perl / shell here documents and emacs parses strings

Re: Printing

2004-12-20 Thread Craig Ringer
it directly to a file to be accessed as needed? I'm afraid I just don't understand that. Do a DOS directory? If you want to list the contents of a directory, see help(os.listdir) . -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy here documents ??

2004-12-19 Thread Nick Craig-Wood
print \ ... I'll have %(amount)s %(what)s ... for $%(cost)s please % a.__dict__ I'll have 10 rutabaga for $17.5 please -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: expression form of one-to-many dict?

2004-12-18 Thread Nick Craig-Wood
) else: map[key] = [ value ]' 1000 loops, best of 3: 1.11e+03 usec per loop Not that timing is everything of course ;-) -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: subprocess vs. proctools

2004-12-15 Thread Nick Craig-Wood
Keith Dart [EMAIL PROTECTED] wrote: Nick Craig-Wood wrote: This sounds rather like the new subprocess module... import subprocess rc = subprocess.call([ls, -l]) total 381896 -rw-r--r--1 ncw ncw 1542 Oct 12 17:55 1 [snip] -rw-r--r--1 ncw ncw 713 Nov 16 08:18 z

Re: Import trouble

2004-12-15 Thread Craig Ringer
scope(instead of file scope as I want). Is there any solution to my problem? Or should I solve it in another way? def import_xml: try: import libxml except ImportError,err: # handle the error return libxml libxml = import_xml() -- Craig Ringer -- http

Re: Import trouble

2004-12-15 Thread Craig Ringer
On Wed, 2004-12-15 at 21:44, Craig Ringer wrote: def import_xml: try: import libxml except ImportError,err: # handle the error return libxml libxml = import_xml() Though my personal approach would actually be: try: import libxml except ImportError,err

Re: Suggestion for syntax error: ++i, --i

2004-12-15 Thread Nick Craig-Wood
(): i = 1 return ++i $ pychecker plusplus Processing plusplus... Warnings... plusplus.py:4: Operator (++) doesn't exist, statement has no effect -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Read a gzip file from inside a tar file

2004-12-13 Thread Craig Ringer
(or anything that means you have to seek around the file), I'd say you're SOL. -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: How can i send 8-bit data or binary data with pyserial?

2004-12-13 Thread Craig Ringer
' byte_chr = chr(int(byte,2)) byte_chr '@' -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs. Perl

2004-12-13 Thread Nick Craig-Wood
ncw 713 Nov 16 08:18 z~ print rc 0 IMHO the new subprocess module is a very well thought out interface... -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: collaborative editing

2004-12-11 Thread Nick Craig-Wood
Nick Craig-Wood [EMAIL PROTECTED] wrote: Robert Kern [EMAIL PROTECTED] wrote: Personally, I loathe writing at any length inside a Web browser and prefer to use a real editor at all times. Me too! You need mozex... http://mozex.mozdev.org/ Here is a good page about Wikis (from

Re: converting html escape sequences to unicode characters

2004-12-10 Thread Craig Ringer
%x % int(escapeseq[2:-1])).decode(unicode_escape) ... print ' '.join([ unescape(x) for x in entities ]) 비 행 기 로 보 낼 거 에 요 내 면 금 이 얼 마 지 잠 -- Craig Ringer -- http://mail.python.org/mailman/listinfo/python-list

Re: converting html escape sequences to unicode characters

2004-12-10 Thread Craig Ringer
On Fri, 2004-12-10 at 16:09, Craig Ringer wrote: On Fri, 2004-12-10 at 08:36, harrelson wrote: I have a list of about 2500 html escape sequences (decimal) that I need to convert to utf-8. Stuff like: I'm pretty sure this somewhat horrifying code does it, but is probably an example

Re: collaborative editing

2004-12-10 Thread Nick Craig-Wood
Robert Kern [EMAIL PROTECTED] wrote: Personally, I loathe writing at any length inside a Web browser and prefer to use a real editor at all times. Me too! You need mozex... http://mozex.mozdev.org/ Not sure about Mac support though /OT -- Nick Craig-Wood [EMAIL PROTECTED] -- http

Re: Unicode docstrings in PyMethodDef?

2004-12-10 Thread Craig Ringer
On Wed, 2004-12-08 at 13:43, Craig Ringer wrote: Hi folks I'm currently working on a fairly well internationalised app that embeds a Python intepreter. I'd like to make the docstrings translatable, but am running into the issue that the translation function returns unicode data

Re: results of division

2004-12-09 Thread Christopher A. Craig
.5 truncates divides by 10**n. Don't confuse this trick with giving us the correct result though, it's still floating point: round(1.77499, 2) 1.78 -- Christopher A. Craig [EMAIL PROTECTED] [Windows NT is] not about 'Where do you want to go today?'; it's more like 'Where am I allowed

<    5   6   7   8   9   10   11   >