Re: What do you call a class not intended to be instantiated

2008-09-23 Thread Craig Allen
> > > Usegrammers? > usegrammers are just those that use grammars, but misspell it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why are "broken iterators" broken?

2008-09-23 Thread Craig Allen
I'm interested what others think of this because at first I couldn't get it... I have an object which can iterate over its parts... and at first I thought, what? I'm supposed to create a new object every time the user needs to iterate the contents? In the end I interpreted that statement as if "un

Re: Python style: exceptions vs. sys.exit()

2008-09-23 Thread Craig Allen
> The > question is: should the library function be able to just dump to > sys.exit() with a message about the error (like "couldn't open this > file"), or should the exception propagate to the calling program which > handles the issue? > my view is that the exceptions are there precisely to tell

Re: Python style: exceptions vs. sys.exit()

2008-09-24 Thread Craig Allen
> Why, yes, I am wearing my BOFH hat. How could you tell? > > -- > Tim Rowe evil, but I think you may be a BSEFH, not a BOFH. -- http://mail.python.org/mailman/listinfo/python-list

Re: [PyOpenGL-Users] Mouse wheel events?

2010-02-07 Thread Craig Berry
I'll look into it. Thanks for the pointer! -- Craig Berry - http://www.cine.net/~cberry/ "Lots of things in the universe don’t solve any problems, and nevertheless exist." -- Sean Carroll -- http://mail.python.org/mailman/listinfo/python-list

Re: [PyOpenGL-Users] Mouse wheel events?

2010-02-10 Thread Craig Berry
e now reported, and everything else seems to be working as expected. Thanks for your help! -- Craig Berry - http://www.cine.net/~cberry/ "Lots of things in the universe don’t solve any problems, and nevertheless exist." -- Sean Carroll -- http://mail.python.org/mailman/listinfo/python-list

Re: documentation / reference help

2011-01-25 Thread Craig Leffel
Where does it return the value to? What do I need to put in the calling function so that I can use that value? I need a variable name to refer to. Shouldn't I have to define that variable someplace? "Littlefield, Tyler" wrote in message news:mailman.1103.1295811520.6505.python-l...@python.org...

help with multiprocessing pool

2011-01-25 Thread Craig Yoshioka
Hi all, I could really use some help with a problem I'm having. I wrote a function that can take a pattern of actions and it apply it to the filesystem. It takes a list of starting paths, and a pattern like this: pattern = { InGlob('Test/**'):{ MatchRemove('DS_Store'

Re: help with multiprocessing pool

2011-01-27 Thread Craig Yoshioka
g out here. This means that some examples, such as themultiprocessing.Pool examples will not work in the interactive interpreter. Thanks. On Jan 27, 2011, at 6:39 AM, Philip Semanchuk wrote: > > On Jan 25, 2011, at 8:19 PM, Craig Yoshioka wrote: > >> Hi all, >> >>

Re: help with multiprocessing pool

2011-01-27 Thread Craig Yoshioka
011, at 10:38 AM, Philip Semanchuk wrote: > > On Jan 27, 2011, at 1:12 PM, Craig Yoshioka wrote: > >> The code will be multi-platform. The OSXisms are there as an example, >> though I am developing on OS X machine. >> >> I've distilled my problem down to a sim

Python 32-bit on Windows 64-bit

2011-02-11 Thread Craig Yoshida
S and have 4GB of RAM. Thanks, -Craig -- http://mail.python.org/mailman/listinfo/python-list

lambdas

2010-06-14 Thread Craig Yoshioka
as to: 1) why 2) what I should do 3) a better way in which to implement this pattern Cheers!, -Craig -- http://mail.python.org/mailman/listinfo/python-list

Re: lambdas

2010-06-14 Thread Craig Yoshioka
Sorry, the first example should be: class Status(object): def __init__(self,definitions): for key,function in definitions: setattr(self,key,property(function)) On Jun 14, 2010, at 3:06 PM, Craig Yoshioka wrote: > I'm trying to write

Python changes

2010-10-28 Thread Craig McRoberts
again. How much has it changed in my ten years' absence? I've already resigned myself to starting over from the beginning, but are my books from that time period even worth using now? Thanks so much. Craig McRoberts -- http://mail.python.org/mailman/listinfo/python-list

Re: Python changes

2010-10-28 Thread Craig McRoberts
Thanks for the prompt replies. Sounds like it's time to hit a bookstore. Craig McRoberts -- http://mail.python.org/mailman/listinfo/python-list

Re: Python changes

2010-10-28 Thread Craig McRoberts
Oh, I like to browse brick-and-mortar enough. But it's been forever since I've bought something there. Craig McRoberts On Oct 28, 2010, at 15:16, Teenan wrote: > On Thu, 2010-10-28 at 15:03 -0400, Craig McRoberts wrote: >> Thanks for the prompt replies. Sounds like

Re: How to use a timer in Python?

2005-09-23 Thread Nick Craig-Wood
time.sleep(1) and try again. This kind of locking works cross platform too. You can use it in shell too, eg "mkdir /tmp/lock || exit 1" in your cronjob. You could wrap the locking up into a module of course, and I bet someone already did. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: How to use a timer in Python?

2005-09-23 Thread Nick Craig-Wood
) f.close() os.rmdir(lock_file) print "Done!" You need to do the same thing to the program which currently creates transfer.lock - so it waits if the transfer.lock is in existence too. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: subprocess and non-blocking IO (again)

2005-10-11 Thread Nick Craig-Wood
tence in speech: print sentence.rstrip('\n') sys.stdout.flush() # sanity check else: # EOF speakers.remove( speaker ) gives b o x 1 b o x 3 b o x 2 pause... g o o d b y e etc... I'm not sure why readline only returns 1 cha

xml.minidom and user defined entities

2005-11-09 Thread Nick Craig-Wood
g xml.minidom? I've spend some time searching the docs/code/google but I haven't found the answer to this question! Thanks -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: xml.minidom and user defined entities

2005-11-09 Thread Nick Craig-Wood
Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood wrote: > > > I'm using xml.minidom to parse some of our XML files. Some of these > > have entities like "°" in which aren't understood by xml.minidom. > > ° is not a standard entity

Re: gmpy 1.01 rc near... anybody wanna test>

2005-11-10 Thread Nick Craig-Wood
system). Thanks and look forward to the release Nick -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: gmpy/decimal interoperation

2005-11-14 Thread Nick Craig-Wood
en > implicitly None I'd say! Perhaps make a less laborious manual conversion function, but I don't think implicit conversion is that useful since decimal and gmpy are solving quite different problems. Implicit conversions also opens the can of worms - what is the preferred promotion type?

Re: How to avoid "f.close" (no parens) bug?

2005-11-14 Thread Nick Craig-Wood
hecker catches, so install pychecker and run it on all your programs is the answer! -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

simulating #include in python

2005-11-15 Thread Nick Craig-Wood
he symbols from the import back in for name in dir(module): if not (name.startswith("__") and name.endswith("__")): setattr(parent, name, getattr(module, name)) # Restore sys.path sys.path = old_sys_path -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: simulating #include in python

2005-11-15 Thread Nick Craig-Wood
Peter Otten <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood wrote: > > > I'd really like to be able to run an __import__ in the context of the file > > thats running the include() but I haven't figured that out. > > execfile()? Yes thats exactly what

Re: sort the list

2005-11-22 Thread Nick Craig-Wood
ll the cmp function N log N times. Its expensive in terms of memory though. With python 2.4 you can wrap it up into one line if you want [ x[-1] for x in sorted([ (x[1],x) for x in lst ]) ] or even [ x[-1] for x in sorted((x[1],x) for x in lst) ] -- Nick Craig-Wood <[EMAIL PROTECTED

Re: sort the list

2005-11-23 Thread Nick Craig-Wood
Neil Hodgson <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood: > > > Since no-one mentioned it and its a favourite of mine, you can use the > > decorate-sort-undecorate method, or "Schwartzian Transform" > > That is what the aforementioned key argument

Re: Writing pins to the RS232

2005-11-29 Thread Nick Craig-Wood
al port. You need to set the serial port up not to do automatic handshaking first (eg setDsrDtr() & setRtsCts()) RS232 levels are +/- 12V, though a lot of computers only generate +/- 5V. The threshold is +/- 3V IIRC. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.

Re: efficient 'tail' implementation

2005-12-08 Thread Nick Craig-Wood
bit OS though. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: efficient 'tail' implementation

2005-12-08 Thread Nick Craig-Wood
search *= 2 lines = lines[-nlines-1:] print "\n".join(lines) if __name__ == "__main__": if len(sys.argv) != 3: print "Syntax: %s n file" % sys.argv[0] else: main(int(sys.argv[1]), sys.argv[2]) -- Nick Craig-Wood &

Re: windows mem leak

2005-01-10 Thread Nick Craig-Wood
etc. [sorry not Python related but may solve your problem!] -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Refactoring; arbitrary expression in lists

2005-01-13 Thread Nick Craig-Wood
# raise NoMimeError return t[0] for f in ("index.php", "index.php3", "prog.cc", "prog.cpp", "flodge.xsl", "Makefile", "myMakefile", "potato.123"): print f, detectMimeType(f) ... prints index.php applicatio

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

2005-01-13 Thread Nick Craig-Wood
2.2.3-10 An interactive high-level object-oriented la ii python2.3 2.3.4-18 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
unstable -> testing (and eventually) -> stable. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: rotor replacement

2005-01-19 Thread Nick Craig-Wood
Cast5+6, DES, Serpent, Twofish, TEA, etc. The linux kernel+source surely goes everywhere python does so I don't think adding strong crypto modules to python is a problem now-a-days. AES in the core python library would be very useful and it would discourage people from writing the

Re: Overloading ctor doesn't work?

2005-01-21 Thread Nick Craig-Wood
Why is that? Its a bug! http://sourceforge.net/tracker/index.php?func=detail&aid=720908&group_id=5470&atid=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 Cr

Re: rotor replacement

2005-01-22 Thread Nick Craig-Wood
Note that some of these are being worked on at sourceforge just like python. Surely 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: default value in a list

2005-01-22 Thread Nick Craig-Wood
use this old trick... a, b, c = (line+"::").split(':')[: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]>

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] > >

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

2005-01-23 Thread Nick Craig-Wood
7;, line)): do_add(m.value.group(1), m.value.group(2)) elif m.set(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]> --

Re: Classical FP problem in python : Hamming problem

2005-01-25 Thread Nick Craig-Wood
ming(), 4) return result PS interesting thread - never 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
, hamming5) ): yield n hamming2, hamming3, hamming5, result = tee(_hamming(), 4) return result (Note the iter(...) seemed not to be doing 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): > >

Re: Classical FP problem in python : Hamming problem

2005-01-27 Thread Nick Craig-Wood
code] Thanks for some more examples of fp-style code. I find it hard to get my head round so its 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
order()] * 7 > py> ', '.join(orders) > 'Spam, Spam, Spam, Spam, Spam, Spam, Spam' Thats still one Viking making 7 orders surely? Eg >>> vikings = [Viking()] * 7 >>> vikings[0] is vikings[1] True whereas >>> vikings = [Viking() for _ in rang

Re: Inherting from object. Or not.

2005-01-27 Thread Nick Craig-Wood
;>> raise MyOldException Traceback (most recent call last): File "", line 1, in ? __main__.MyOldException: <__main__.MyOldException instance at 0xb7df4cac> >>> After that I recalled a thread on python-dev about it http://mail.python.org/pipermail/python-dev

Re: XOR on string

2005-01-27 Thread Nick Craig-Wood
it -s'import operator; string = "abcdefghij13123kj12l3k1j23lk12j3l12kj3"' \ 'reduce(operator.xor, 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: 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! --

Re: debugging os.spawn*() calls

2005-01-28 Thread Nick Craig-Wood
ng wrong. > > While not a 'real' answer - I use pexpect to automate my ssh scripts > these days as I had a few problems using ssh with the os.* family > perhaps you may find pexpect a wee bit easier... If using 2.4 the subprocess module is a good solution

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

2005-01-29 Thread Nick Craig-Wood
ome up with, via Google's Cache. http://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: What's so funny? WAS Re: rotor replacement

2005-01-30 Thread Nick Craig-Wood
depend on any other library or application. -- 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-30 Thread Nick Craig-Wood
API. The cryptkit way is better than ECB > example I gave, but the ECB 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 PROTEC

Re: limited python virtual machine

2005-01-30 Thread Nick Craig-Wood
. ...it also uses python 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-31 Thread Nick Craig-Wood
sions of DES for instance). -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Where are list methods documented?

2005-02-01 Thread Nick Craig-Wood
tation which is only available in HTML format - I'd much rather type "pydoc whatever" to see it all, rather than have to load my browser, and click through several layers of web pages. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Which kid's beginners programming - Python or Forth?

2005-06-30 Thread Nick Craig-Wood
n Python would make a much better first language than FORTH. The batteries included approach make a young programmers life much, much more fun, rather than starting from almost nothing (in modern terms) with FORTH. And like FORTH, Python has the interactive console which is essential when starting out. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: sending binary files to a 16 micro controller.

2005-08-22 Thread Nick Craig-Wood
iment TCP yourself. Actually I'd recommend the OP uses UDP, not TCP. I've implemented a few systems which speak UDP directly and its very easy. I wouldn't like to implement TCP though! -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Revised PEP 349: Allow str() to return unicode strings

2005-08-23 Thread Nick Craig-Wood
analogous to this... >>> int(100L) 100L > Wouldn't also a new function make the intent clearer? > > So I think I'm +1 on the text() built-in, and -0 on changing str. Couldn't basestring() perform this function? Its kind of what bases

Re: dual processor

2005-09-05 Thread Nick Craig-Wood
elected at compile time using C Macro magic. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: dual processor

2005-09-05 Thread Nick Craig-Wood
Scott David Daniels <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood wrote: > > Splitting the GIL introduces performance and memory penalties > > However its crystal clear now the future is SMP. Modern chips seem to > > have hit the GHz barrier, and now the

Re: dual processor

2005-09-08 Thread Nick Craig-Wood
hip. It's the most radical multicore design to date from a mainstream server processor manufacturer and arrives more or less on time. It goes on later to say "The physical processor has 8 cores and 32 virtual processors" and runs at 1080 MHz. So fewer GHz but more CPUs is the fu

Re: Premature wakeup of time.sleep()

2005-09-12 Thread Nick Craig-Wood
er /proc/interrupts | awk '{print $2}'`; echo $(($end-$start)) Which prints a number about 1000 on my 2.6 machine. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Efficient checksum calculating on lagre files

2005-02-08 Thread Nick Craig-Wood
5sum(files): for filename in files: try: print "%s %s" % (md5file(filename), filename) except IOError, e: print >> sys.stderr, "Error on %s: %s" % (filename, e) if __name__ == "__main__": md5sum(sys.argv[1:]) -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Java Integer.ParseInt translation to python

2005-02-09 Thread Nick Craig-Wood
0 176 ° > de 222 Þ > 8a 138 > e3 227 ã > b5 181 µ > b7 183 · > 51 81 Q > a7 167 § > c4 196 Ä > d8 216 Ø > e9 233 é > ed 237 í > eb 235 ë > > which is not even close, and yes, I know that it's not the same > code. Actually the hex digi

Re: Is Python as capable as Perl for sysadmin work?

2005-02-09 Thread Nick Craig-Wood
27;... or die "You [EMAIL PROTECTED]"' works even better ;-) Thanks for a very amusing post! -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Efficient checksum calculating on lagre files

2005-02-09 Thread Nick Craig-Wood
ile = open(fn, "rb") >>> size = os.path.getsize(fn) >>> size 8590983168L >>> hash = md5.md5(mmap.mmap(file.fileno(), size)).hexdigest() Traceback (most recent call last): File "", line 1, in ? OverflowError: memory mapped size is too large (limited by C int) >>> -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Efficient checksum calculating on lagre files

2005-02-09 Thread Nick Craig-Wood
Thomas Heller <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood <[EMAIL PROTECTED]> writes: > > Here is an implementation of md5sum in python. Its the same speed > > give or take as md5sum itself. This isn't suprising since md5sum is > > dominated by CPU usage

Re: probably weird or stupid newbie dictionary question

2005-02-10 Thread Nick Craig-Wood
ble objecst is the comparability. In java, this is done using the > equals method. > > So in the end, the actual mapping of key, value looks like this: > > hash(key) -> [(key, value), ] Thats called hashing with chaining. See Knuth: Sorting and Searching if you want to kno

Re: convert list of tuples into several lists

2005-02-10 Thread Nick Craig-Wood
) [(1, 4), (2, 5), (3, 6)] -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and version control

2005-02-10 Thread Nick Craig-Wood
gt; > Emacs + CVS (or CVSNT) should work just fine in Windows either. When I have to edit stuff on windows I use emacs. Cvs works fine on windows too. I haven't tried cvs in emacs on windows, but I suspect it will work fine as all emacs does is shell out to the cvs binaries. -- Nick

Re: Efficient checksum calculating on lagre files

2005-02-11 Thread Nick Craig-Wood
Christos TZOTZIOY Georgiou <[EMAIL PROTECTED]> wrote: > On 09 Feb 2005 10:31:22 GMT, rumours say that Nick Craig-Wood > <[EMAIL PROTECTED]> might have written: > > >But you won't be able to md5sum a file bigger than about 4 Gb if using > >a 32bit processor (

Re: goto, cls, wait commands

2005-02-11 Thread Nick Craig-Wood
else: # do stuff when not found The last language I saw with this very useful feature was FORTH in about 1984! -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: pyMinGW support for Python 2.3.5 (final) is available

2005-02-12 Thread Nick Craig-Wood
indows) on a linux build host. The windows builds are done with a mingw cross compiler. It would be interesting if we could do this with python + extensions also. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: pyMinGW support for Python 2.3.5 (final) is available

2005-02-13 Thread Nick Craig-Wood
lds are done with plain gcc of course. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: For American numbers

2005-02-13 Thread Nick Craig-Wood
Yes. Unless you work in the telcoms industry, where, for example if you order a 2 Mbit/s line you'll get 2 * 1024 * 1000 bits / s ;-) -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: [PATCH] allow partial replace in string.Template

2005-02-14 Thread Nick Craig-Wood
ners with one-liners. c) add a documentation patch d) add a test suite patch -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: low-end persistence strategies?

2005-02-16 Thread Nick Craig-Wood
ish (being lazy) that there was a seperate debian package for just it and not the whole of Zope. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread Nick Craig-Wood
er method to do this? I propose joinany which will join any type of object together, not just strings That way it becomes less of a poke in the eye to backwards compatibility too. > Nick "Explicit is better than Implicit" Aye! -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http:

Re: low-end persistence strategies?

2005-02-18 Thread Nick Craig-Wood
f and fcntl is unspecified.)" see man lockf and man flock -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Comm. between Python and PHP

2005-02-22 Thread Nick Craig-Wood
he data you want to pass is structured then you might consider XML-RPC which is a cross platform way of passing structured data around. XML-RPC is part of the python standard library (SimpleXMLRPCServer and xmlrpclib) and there seem to be several implementations for PHP http://www.google.co.uk/sea

Re: accessor/mutator functions

2005-02-28 Thread Nick Craig-Wood
y the get method) which is often the encapsulation you really want - and that is something you can't do in C++. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Flushing print()

2005-02-28 Thread Nick Craig-Wood
Cameron Laird <[EMAIL PROTECTED]> wrote: > gf, remember to write > >sys.stdout.flush() > > rather than > >sys.stdout.flush > > That's a mistake that catches many. Many old perl programmers anyway (me included)! Its also a mistake pychecker

Re: Explicit or general importing of namespaces?

2005-02-28 Thread Nick Craig-Wood
pe (like the warnings subsystem). This is surely a job for pychecker / pylint? -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Decimal, __radd__, and custom numeric types...

2005-02-28 Thread Nick Craig-Wood
ept the right operand: when an instance of a given class is expected, an instance of a subclass of that class is always acceptable. You could try this with a local copy of decimal.py since it is written in Python. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: accessor/mutator functions

2005-03-01 Thread Nick Craig-Wood
Dan Sommers <[EMAIL PROTECTED]> wrote: > On 28 Feb 2005 10:30:03 GMT, > Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > > > Actually I would say just access the attribute directly for both get > > and set, until it needs to do something special in which case use

Re: accessor/mutator functions

2005-03-01 Thread Nick Craig-Wood
complicated code into a method with a useful name, or add well named intermediate variables, or add an assertion. Its a point of view... Not 100% sure I agree with it but I see where he is coming from. I like a doc-string per public method so pydoc looks nice myself... -- Nick Craig-Wood <[

Re: Regular Expressions: large amount of or's

2005-03-01 Thread Nick Craig-Wood
t|in|t|ts)|ret(?:ch|ry)|re(?:use|v)|rev's|rev(?:el|s|ue) As you can see its not perfect. Find it in http://www.craig-wood.com/nick/pub/words-to-regexp.pl Yes its perl and rather cludgy but may give you ideas! -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: os.system()

2005-03-07 Thread Nick Craig-Wood
7 S+ 0:00 \_ sh -c sleep 60 > z 5150 pts/77 S+ 0:00 \_ sleep 60 Things to check 1) quoting, python vs shell 2) PATH - check PATH is set the same in shell / python 3) check the whole of the environment Also if you are using 2.4 check the subprocess module

Re: shuffle the lines of a large file

2005-03-08 Thread Nick Craig-Wood
was forever blowing up the server with scripts which used too much memory. sort was always the solution! -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: An Odd Little Script

2005-03-10 Thread Nick Craig-Wood
e, and selecting that output file as the default for print() statements. The solution posted previously using mmap actually does it in-place though which will work very well for files < 4GB. (And not at all for files > 4GB unless you are on a 64 bit machine). -- Nick Cra

Re: Python becoming less Lisp-like

2005-03-15 Thread Nick Craig-Wood
s will complain about removals, but we'll knuckle down and take our medicine eventually ;-) -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: pre-PEP generic objects

2004-11-30 Thread Nick Craig-Wood
st ram it in a hash, and write lots of functions acting on it) rather than creating a specific class for the job which is dead easy in python anyway and to which you can attach methods etc. YMMV ;-) -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: pre-PEP generic objects

2004-12-01 Thread Nick Craig-Wood
Steven Bethard <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood wrote: > > Steven Bethard <[EMAIL PROTECTED]> wrote: > > > >> I promised I'd put together a PEP for a 'generic object' data type for > >> Python 2.5 that allows one to replac

Re: pre-PEP generic objects

2004-12-02 Thread Nick Craig-Wood
Scott David Daniels <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood wrote: > > class Hash: > > def __init__(self, **kwargs): > > for key,value in kwargs.items(): > > setattr(self, key, value) > > def __getitem__(self, x): > >

Re: pre-PEP generic objects

2004-12-03 Thread Nick Craig-Wood
eading to the critical > difference in this case: I think I finally understand now - thank you to you both! -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Galois field

2004-12-03 Thread Nick Craig-Wood
orlds If someone did wrap PARI in python it would certainly be easier to use than GP which I found very unintuitive! In fact I just found this which looks like just the job! http://www.fermigier.com/fermigier/PariPython/readme.html -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://

Re: long number multiplication

2004-12-06 Thread Nick Craig-Wood
area of computer science! Its also rather big and expensive so you'll probably want to look at in the library... -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: long number multiplication

2004-12-06 Thread Christopher A. Craig
bit digits. > i needed to implement this myself and was thinking of storing the digits > of an integer in a list. That's sort of what Python does except the "digits" are 15 bits, not base 10. Doing it in base 10 would be a huge pain because of the problems with base 10->b

Re: Recursive list comprehension

2004-12-08 Thread Nick Craig-Wood
e l l o ...and this works because str supports __getitem__ according to the docs. So there is some magic going on here! Is str defined to never have an __iter__ method? I see no reason why that it couldn't one day have an __iter__ method though. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   6   7   8   9   >