This is a test

2021-01-07 Thread Craig Hatch
I have added you to the EMAIL list, so when I have questions. Just learn for fun. Craig Hatch -- https://mail.python.org/mailman/listinfo/python-list

Re: Need assistance

2015-07-19 Thread craig . sirna
On Thursday, July 16, 2015 at 9:16:01 PM UTC-5, craig...@gmail.com wrote: > I need help writing a homework program. > > I'll write it, but I can't figure out how to incorporate what I have read in > the book to work in code. > > The assignment wants us to take a

Re: Need assistance

2015-07-16 Thread craig . sirna
I am in bed, on my phone, gotta be up in 4 hours for work. I will get back with you guys tomorrow after I take care of my Math class stuff. I need to step away from this for a day lol. Worst part...this is the C assignment and it's driving me crazy. I do recall the list fuction. But isn't it

Need assistance

2015-07-16 Thread craig . sirna
ust display the full name rearranged in Last, First Middle order. I tried to use the search function in Python to locate any spaces in the input. It spot back the index 5 (I used Craig Daniel Sirna) That is correct for the first space, but I can't figure out how to get it to continue to t

Re: inheriting a large python code base

2014-02-21 Thread craig
Look at the algorithms and see if there are faster ways. Great advice with the comments of writing test cases, getting into version control, taking passes through the code with tools, understanding what is slow and why it is considered slow. Then you should invest the time to understand the in

Re: How to install pip for python3 on OS X?

2013-11-20 Thread Craig Yoshioka
Mavericks? Homebrew all the way. Google Homebrew and install it brew install python3 pip3 install pyserial Craig reporting from the road 10550 N Torrey Pines Rd La Jolla CA 92037 work: 858 784 9208 cell: 619 623 2233 > On Nov 19, 2013, at 10:55 PM, Travis Griggs wrote: > > OSX (

Re: Beowulf clusters

2013-01-13 Thread Craig Yoshioka
When you write HPC code the GIL isn't an issue, but you'll have plenty of others. Craig reporting from the road 10550 N Torrey Pines Rd La Jolla CA 92037 work: 858 784 9208 cell: 619 623 2233 On Jan 13, 2013, at 6:22 PM, Mark Janssen wrote: > On Sun, Jan 13, 2013 at 8:19 PM, O

Re: RIse and fall of languages in 2012

2013-01-10 Thread Craig Yoshioka
At one point or another I'm pretty sure I've googled "_ sucks" for every language I've ever used- even the ones I like. ie: Python easily more than once. Craig reporting from the road 10550 N Torrey Pines Rd La Jolla CA 92037 work: 858 784 9208 cell: 619 623 2233

Re: alternative to with statement?

2012-02-28 Thread Craig Yoshioka
till coordinate their activity, by waiting for each other to finish, and reusing the cached results, etc. On Feb 28, 2012, at 1:04 PM, Craig Yoshioka wrote: > I see that there was previously a PEP to allow the with statement to skip the > enclosing block... this was shot down, and I

alternative to with statement?

2012-02-28 Thread Craig Yoshioka
I see that there was previously a PEP to allow the with statement to skip the enclosing block... this was shot down, and I'm trying to think of the most elegant alternative. The best I've found is to abuse the for notation: for _ in cachingcontext(x): # create cached resources here # return

AUTO: Craig Churchill is out of the office (returning 27/07/2011)

2011-07-18 Thread craig . churchill
I am out of the office until 27/07/2011. I will respond to your message when I return. If you require assitance in relation to the SPEAR Integration project please contact Terry Mandalios. Note: This is an automated response to your message "Re: Tabs -vs- Spaces: Tabs should have won." sent on

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

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

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

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: 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...

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

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

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: [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: [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: ANN: GMPY 1.11rc1 is available

2009-11-30 Thread Nick Craig-Wood
whatever will they think of next ;-) Thanks for maintaining gmpy - it is an excellent bit of software! -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for a pure Python chart drawing module

2009-09-22 Thread Nick Craig-Wood
till > works. I don't think anyone has mentioned reportlab... It can plot charts I think, though last time I used it I plotted stuff by hand as I wanted exact control over the layout. I'm not sure of the dependencies though so may not be suitable for your purposes. http://www.reportl

Re: VT100 in Python

2009-09-14 Thread Nick Craig-Wood
t in the order you might expect. I think twisted has VT100 emulator, but I couldn't find it in a brief search just now. You'll find various others (like this one) if you search some more http://svn.python.org/projects/python/branches/string_methods/Demo/cwilib/vt100.py -- Nick Cra

Re: including constants

2009-09-14 Thread Nick Craig-Wood
e hostname of the machine and import a secondary file of settings with that name. This has the advantage that you can check everything in. -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: CPU usage while reading a named pipe

2009-09-13 Thread Nick Craig-Wood
if buf: lines = buf.splitlines(True) for line in lines[:-1]: yield line buf = lines[-1] if buf.endswith("\n"): yield buf buf = "" else: time.sleep(SLEEP_INTERVAL) def main(path): for line in tail(path): print "%r:%r" % (len(line), line) if __name__ == "__main__": import sys main(sys.argv[1]) -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Application-global "switches"?

2009-09-07 Thread Nick Craig-Wood
se it you can then use from config import config if config.debug: # blah This has the advantage that you can define some methods on your config object (eg save). I don't know whether this is best practice but it works for me! -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http:/

Re: IDE for python similar to visual basic

2009-08-28 Thread Craig
Try wingware i have it and i like it. --- On Fri, 8/28/09, qwe rty wrote: > From: qwe rty > Subject: IDE for python similar to visual basic > To: python-list@python.org > Date: Friday, August 28, 2009, 5:19 PM > i have been searching for am IDE for > python that is similar to Visual > Basic but

Re: Python on Crays

2009-08-27 Thread Craig
Who the one from wisconsin and did you try the python group in madison maybe they can help. Well i from madison are and i just a newbie with python.What OS you useing? --- On Thu, 8/27/09, Mark Dickinson wrote: > From: Mark Dickinson > Subject: Re: Python on Crays > To: python-list@python.org

Re: How to create ones own lib

2009-08-19 Thread Nick Craig-Wood
ne your classes / functions in hotte.py then use them like import hotte hotte.MyClass() hotte.my_function() See here for the relevant bit of the tutorial http://docs.python.org/tutorial/modules.html -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: www.python.org website is down?

2009-08-08 Thread Craig
Yes the same prob. --- On Sat, 8/8/09, Mark Lawrence wrote: > From: Mark Lawrence > Subject: Re: www.python.org website is down? > To: python-list@python.org > Date: Saturday, August 8, 2009, 8:41 AM > Caezar wrote: > > I cannot connect to the official Python website. I get > the following > >

Re: Does python have the capability for driver development ?

2009-07-29 Thread Nick Craig-Wood
and > concurrency-requirements, it's not really feasible. You can write FUSE (file systems in userspace) drivers in python I believe. Not the same as running in ring0 but in most senses a kernel driver... -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Semaphore Techniques

2009-07-29 Thread Nick Craig-Wood
rocess() Which prints Trying 1 Trying 2 Trying 3 Trying 4 Traceback (most recent call last): File "", line 20, in File "", line 16, in lock_process Exception: Too many instances of me running You could do the same thing with lock files also very easily... -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: bad certificate error

2009-07-28 Thread Nick Craig-Wood
the certificate is invalid it may help your python code. Real certificates cost real money. Usually a correctly set up self-signed certificate is fine for dev stuff. I'm certainly too cheap to by real certificates for dev or internal stuff! -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: bad certificate error

2009-07-28 Thread Nick Craig-Wood
o the server having a invalid server > cert? I'd say judging from the traceback you messed up key_file or cert_file somehow. Try using the openssl binary on them (read the man page to see how!) to check them out. > If I go to this server in my browser, I get a "This server tried to > identify itself with invalid information". Is there a way to > ignore this issue with Python? Can I setup a trust store and add > this server to the trust store? Invalid how? Self signed certificate? Domain mismatch? Expired certificate? -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for os.listdir() generator

2009-07-24 Thread Nick Craig-Wood
Christian Heimes wrote: > Nick Craig-Wood wrote: > > Christian Heimes wrote: > >> I'm looking for a generator version of os.listdir() for Python 2.5 and > >> newer. I know somebody has worked on it because I've seen a generator > >> version in

Re: Looking for os.listdir() generator

2009-07-23 Thread Nick Craig-Wood
e d.close() del d if __name__ == "__main__": import sys paths = sys.argv[1:] if not paths: paths = ["."] for path in paths: print "*** %s ***" % path for name in listdir(path): print name -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Pep 342 (val = yield MyGenerator(foo)), synchronous os.system() that doesn't block gui event loops

2009-07-23 Thread Nick Craig-Wood
subprocess.Popen/os.system and a worker thread. > > Anyone done this already, or do I have to roll my own? You might want to look at twisted, in particular http://twistedmatrix.com/trac/wiki/DeferredGenerator -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: sqlite3 performance problems only in python

2009-07-23 Thread Nick Craig-Wood
e table scanning. So it is not the size of the data > returned, but the size of the data that needs to be scanned. In all the databases I've used, the like operator has been case insensitive, so if that is the problem you could use NAME like '%cis20r%' -- not quite the same, but close! and NAME_ like 'fatigue' instead which might be quicker. Or not ;-) -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: extract c/cpp include file with regular expression

2009-07-23 Thread Nick Craig-Wood
instead of producing an object file, it produces a machine readable xml file describing the source. It is used by h2xml.py / xml2py.py to make ctypes header file automatically. -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Shed Skin 0.2, an experimental (restricted) Python-to-C++ compiler

2009-07-23 Thread Nick Craig-Wood
Hour boards. There is another part which I haven't attempted to compile yet which finds the most difficult possible boards using a combination of back tracking and a genetic algorithm. -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Shed Skin 0.2, an experimental (restricted) Python-to-C++ compiler

2009-07-21 Thread Nick Craig-Wood
ng session if it takes me an hour each cycle ;-) The program is about 700 lines of python (excluding comments). Thanks Nick -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: ctype performance benchmark

2009-07-17 Thread Nick Craig-Wood
strerror(errno)) def readdir(self): """Read the next name in the directory""" cdef dirent *p p = readdir(self.handle) if p is NULL: return None return p.d_name def close(self): """Cl

Re: This is a mess...

2009-07-16 Thread Nick Craig-Wood
= Eigen_vect(3, range(10)) f = Eigen_vect(4, range(1,11)) print e print f print e[2] print e.dot(f) Which prints [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 2 330.0 -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: using timers to force an execution time

2009-07-16 Thread Nick Craig-Wood
gnal.alarm(t) try: rc = fn(*args, **kwargs) finally: # Restore the old handler signal.signal(signal.SIGALRM, old_handler) signal.alarm(0) def test(): for repeat in range(10): print time.time() time.sleep(0.66) if __name__ == "

Re: Catching control-C

2009-07-08 Thread Nick Craig-Wood
45) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. Loaded customisations from '/home/ncw/.pystartup' >>> isinstance(KeyboardInterrupt(), Exception) False >>> > for x in really_big_list: > try: > long_running_process(x) > except (KeyboardInterrupt, SystemExit): > print "User requested exit... shutting down now" > cleanup() > raise > except Exception: > continue That is the backwards compatible way -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-05 Thread Nick Craig-Wood
the time goes. > > ("It should be written in C" is not an acceptable answer.) You could compile it with Cython though. lxml took this route... -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: how to spawn a process under different user

2009-07-03 Thread Nick Craig-Wood
ink it is easier to use su (assuming you start off as root), so instead of passing ['mycommand', 'my_arg1', 'my_arg2'] to Popen, pass ['su', '-', 'username', '-c', 'mycommand my_arg1 my_arg2'] There is some opportunity for quoting problems there, but it is easy! -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: C-extension 2 times slower than exe

2009-06-25 Thread Nick Craig-Wood
Real time is wallclock time. That must mean a) your program is threading b) there is something up with timing on your computer Looks odd but exactly what it means I don't know! > 2) time ff > time used = 2.19 > real0m3.170s > user0m2.088s > sys 0m0.168s -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to enumerate classes in a module

2009-06-25 Thread Nick Craig-Wood
d in the module and a class imported > into it. > > Finally, despite the warning, I think you are ok to use dir() for that > purpose. It's not likely to change. Good advice... And as a double check >>> import sys >>> set(sys.__dict__.keys())

Re: A superclass using a child classes' methods

2009-06-25 Thread Nick Craig-Wood
ssages when tracking down problems. A lot of people (like me) will enjoy the puzzle of looking through your code and finding out where it went wrong. -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert hash to struct

2009-06-22 Thread Nick Craig-Wood
buteError("%r object has no attribute %r" % (self.__class__.__name__, name)) def copy(self): return MyDict(self) > print x.a > print x.z > print x.values > > Big question - what should the last line display? If you expect "3" > and not &q

Re: Allocating memory to pass back via ctypes callback function

2009-06-22 Thread Nick Craig-Wood
_p() print addressof(cstring) cstring.value = address memmove(address, answer, len(answer)) print cstring.value memmove(address, address+1, 1) print cstring.value Which prints 159611736 3084544552 foobar ooobar -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes list library

2009-06-22 Thread Nick Craig-Wood
on Windows too IIRC. -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Packing a ctypes struct containing bitfields.

2009-06-18 Thread Nick Craig-Wood
def get_bar(self): return (self.bar1 << 32) + self.bar0 bar = property(get_bar, set_bar) print "sizeof(foo) = %d" % sizeof(foo) f = foo() print f.bar f.bar = 123456789012345 print f.bar Which prints sizeof(foo) = 6 0 123456789012345 -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: UDP queue size

2009-06-18 Thread Nick Craig-Wood
quickly show you whether you are fragmenting your UDP messages. Another thing to bear in mind with UDP is that you can easily exceed the packets / second that switches / routers can bear if you send lots of small messages. Switches / routers will start dumping packets if you do that since. Some switch

Re: UDP queue size

2009-06-17 Thread Nick Craig-Wood
setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 1048576) >>> s.getsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF) 262142 >>> I ran the above on linux and I expect the limit 262144 is settable in /proc/sys/net somewhere. No idea whether the above works on windows! -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: waling a directory with very many files

2009-06-16 Thread Nick Craig-Wood
Nick Craig-Wood wrote: > Jean-Paul Calderone wrote: > > On Mon, 15 Jun 2009 09:29:33 -0500, Nick Craig-Wood > > wrote: > > >Hrvoje Niksic wrote: > > >> Nick Craig-Wood writes: > > >> > > >> > Here is a ctypes generator listdi

Re: waling a directory with very many files

2009-06-15 Thread Nick Craig-Wood
Jean-Paul Calderone wrote: > On Mon, 15 Jun 2009 09:29:33 -0500, Nick Craig-Wood > wrote: > >Hrvoje Niksic wrote: > >> Nick Craig-Wood writes: > >> > >> > Here is a ctypes generator listdir for unix-like OSes. > >> > >> ctypes c

Re: waling a directory with very many files

2009-06-15 Thread Nick Craig-Wood
Hrvoje Niksic wrote: > Nick Craig-Wood writes: > > > Here is a ctypes generator listdir for unix-like OSes. > > ctypes code scares me with its duplication of the contents of system > headers. I understand its use as a proof of concept, or for hacks one > needs r

Re: waling a directory with very many files

2009-06-15 Thread Nick Craig-Wood
A generator to return the names of files in the directory passed in """ dir_p = opendir(".") while True: p = readdir(dir_p) if not p: break name = p.contents.d_name if name not in (".", ".."): yield name closedir(dir_p) if __name__ == "__main__": for name in listdir("."): print name -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Perl's @foo[3,7,1,-1] ?

2009-06-13 Thread Nick Craig-Wood
foo[7], foo[1], foo[-1] (assuming you didn't mind having a tuple rather than a list) or maybe this wanted = [ foo[i] for i in 3, 7, 1, -1 ] However I can't think of the last time I wanted to do this - array elements having individual purposes are usually a sign that you should be using a different data structure. -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Lexical scope: converting Perl to Python

2009-06-13 Thread Nick Craig-Wood
nts. Note that private_hash starts with an underscore which means it won't be exported from a module by default and it is a convention that it is private and shouldn't be fiddled with. I'd probably go with the latter of the two examples. -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: unladen swallow: python and llvm

2009-06-11 Thread Nick Craig-Wood
Stefan Behnel wrote: > Nick Craig-Wood wrote: > > Luis M González wrote: > >> I am very excited by this project (as well as by pypy) and I read all > >> their plan, which looks quite practical and impressive. > >> But I must confess that I can&#

Re: setting program name, like $0= in perl?

2009-06-10 Thread Nick Craig-Wood
RSS %MEM COMMAND 9159 pts/7S+ 0:00 0 1000 5551 3404 0.1 /usr/bin/python ./procname.py After PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND 9159 pts/7S+ 0:00 0 1000 5551 3420 0.1 sausage -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: unladen swallow: python and llvm

2009-06-07 Thread Nick Craig-Wood
oes it mean? I don't know, I'm afraid. > I guess it has nothing to do with the v8 strategy, because unladen > swallow will be a virtual machine, while v8 compiles everything to > machine code on the first run. But I still wonder what this mean and > how this is different.

Re: can it be shorter?

2009-06-06 Thread Nick Craig-Wood
> re.sub('/?$', '/', 'aaabbb') 'aaabbb/' >>> That solution is very perl-ish I'd say, IMHO if not url.endswith("/"): url += "/" is much more pythonic and immediately readable. In fact even someone who doesn't know python could understand what it does, unlike the regexp solution which requires a little bit of thought. -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: openhook

2009-06-06 Thread Nick Craig-Wood
Gaudha wrote: > Can anybody tell me what is meant by 'openhook' ? http://docs.python.org/library/fileinput.html?highlight=openhook Maybe ;-) -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Error in linalg.inv ??

2009-06-06 Thread Nick Craig-Wood
b = reshape(a, [3,3]) >>> linalg.det(b) -9.5171266700777579e-16 >>> Which is zero but with a bit of rounding errors which I guess numpy doesn't notice. Double checking like this >>> a,b,c,d,e,f,g,h,i=range(1,10) >>> a*e*i - a*f*h - b*d*i + b*f*g + c*d*h -

Re: unladen swallow: python and llvm

2009-06-05 Thread Nick Craig-Wood
m concerned is that it is more of a port of CPython to a new architecture than a complete re-invention of python (like PyPy / IronPython / jython) so stands a chance of being merged back into CPython. -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: What text editor is everyone using for Python

2009-06-05 Thread Nick Craig-Wood
Ben Finney wrote: > Emile van Sebille writes: > > > On 6/4/2009 3:19 PM Lawrence D'Oliveiro said... > > > In message , Nick Craig- > > > Wood wrote: > > > > > >> You quit emacs with Ctrl-X Ctrl-C. > > > > > > That'

Re: What text editor is everyone using for Python

2009-06-04 Thread Nick Craig-Wood
, press Ctrl-C Ctrl-C and have the output shown in a different window. If you messed up, clicking on the error will put the cursor in the right place in the code). -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Get the hard disk hardware serial number

2009-06-04 Thread Nick Craig-Wood
Enabled According to the man page smartctl also runs under windows/mac/solaris etc -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: easiest way to plot x,y graphically during run-time?

2009-06-04 Thread Nick Craig-Wood
radius -= 1 screen.fill(background_colour) for dot in dots: pygame.draw.circle(screen, foreground_colour, dot, radius, 1) dots = [ (dot[0]+randrange(-1,2), dot[1]+randrange(-1,2)) for dot in dots ] pygame.display.flip() if __name__ == "__main__"

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-02 Thread Nick Craig-Wood
ointers etc. If you want to dig into virtual classes with multiple bases or the STL then you are probably into the territory you describe. That said I've used C++ with ctypes loads of times, but I always wrap the exported stuff in extern "C" { } blocks. -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Ah, ctypes

2009-06-01 Thread Nick Craig-Wood
David Bolen wrote: > Nick Craig-Wood writes: > > > ctypes could potentially note that function types don't have enough > > references to them when passed in as arguments to C functions? It > > might slow it down microscopically but it would fix this problem. &

Re: Ah, ctypes

2009-06-01 Thread Nick Craig-Wood
uld potentially note that function types don't have enough references to them when passed in as arguments to C functions? It might slow it down microscopically but it would fix this problem. -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: python question

2009-05-22 Thread Craig
I use python 2.6.2 and i useing ubuntu 9.04 not windows. --- On Thu, 5/21/09, Dave Angel wrote: > From: Dave Angel > Subject: Re: python question > To: "Craig" > Cc: python-list@python.org > Date: Thursday, May 21, 2009, 2:22 PM > Craig wrote: > > How do i

Re: How to Spawn a process with P_NOWAIT and pass it some data ?

2009-05-21 Thread Nick Craig-Wood
nder.py\n' (printed with a 1 second pause between each line) ---- If you want to interact with a subprocess (eg send, receive, send, receive) then use the pexpect module - buffering in subprocess will cause you nothing but pain otherwise! > (Or, is there a way to create a subprocess.Popen object from what I assume = > is the process handle integer ?) Errr, not as far as I know. -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding a Par construct to Python?

2009-05-21 Thread Nick Craig-Wood
=10**6 because I got bored of waiting ;-) map 9.85280895233 pmap 28.4256689548 So the pmap took nearly 3 times as long. I expect this is because the task was divided into 5 sections each competing madly for the GIL. I ran the same script under the latest jython beta which was very interesting! pmap showing a slight improvement, and faster than cPython! $ jython2.5rc2/jython pmap.py map 6.242000103 pmap 5.8881144 -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

[no subject]

2009-05-21 Thread Craig
http://downloads.emperorlinux.com/contrib/pyiw http://downloads.emperorlinux.com/contrib/pywpa Sorry fro the 2 post.How do i install a python moudles write en in C? -- http://mail.python.org/mailman/listinfo/python-list

python question

2009-05-21 Thread Craig
How do i install this.i never seen a python write in c before. -- http://mail.python.org/mailman/listinfo/python-list

Re: Options for creating a statistics screen on a Mac with Python?

2009-05-16 Thread Nick Craig-Wood
be even a bit > easier. I'd use pygame for a really clean full screen display. Probably a bit more work, but you'll get something really cool at the end of it! here is how to use matplotlib on a pygame surface http://www.pygame.org/wiki/MatplotlibPygame -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Need advice on distributing small module

2009-05-16 Thread Nick Craig-Wood
plejson as json Is more pythonic... You aren't relying on what came with particular python versions which may not be true in jython/ironpython/etc. -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: itertools question

2009-05-14 Thread Nick Craig-Wood
if not out: break yield out g = Grouper(5, xrange(20)) print list(g) g = Grouper(4, xrange(19)) print list(g) Which produces [(0, 1, 2, 3, 4), (5, 6, 7, 8, 9), (10, 11, 12, 13, 14), (15, 16, 17, 18, 19)] [(0, 1, 2, 3), (4, 5, 6, 7), (8, 9, 10, 11), (12, 13, 14, 15), (16, 17,

Re: issue with twisted and reactor. Can't stop reactor

2009-05-12 Thread Nick Craig-Wood
callbacks or deferred objects). To get your program to do something immediately after it is started, use reactor.callLater() before calling reactor.run(). You can't mix and match programming styles with twisted - it is all asynchronous callbacks or nothing in my experience! That takes a bit of

Re: OOP & Abstract Classes

2009-05-11 Thread Nick Craig-Wood
;", line 5, in getMeasurement NotImplementedError >>> base.setPressure(14) Traceback (most recent call last): File "", line 1, in File "", line 7, in setPressure NotImplementedError >>> >>> real = RealDevice("/dev/ttyS1") >>> real RealDevice('/dev/ttyS1') >>> real.getMeasurement() 0 >>> real.setPressure(14) >>> real.getMeasurement() 14 >>> -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Wrapping comments

2009-05-11 Thread Nick Craig-Wood
now what I mean), just to the left of the > RETURN key. Emacs is my editor of choice, and I've never once come > across anything like this. You probably haven't used MAC OS X then! I vnc to a mac and use emacs and I just can't type a #. "Ctrl-Q 43 Return" is my best effort! -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: how GNU stow is complementary rather than alternative to distutils

2009-05-11 Thread Nick Craig-Wood
it follows a very dumb, completely reversible > (uninstallable) process of symlinking those files into the system > directory structure. Once you've got that well formed directory structure it is very easy to make it into a package (eg deb or rpm) so that idea is useful in general for package managers, not just stow. -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Q's on my first python script

2009-05-11 Thread Nick Craig-Wood
def __init__(self): usage = '''Usage: %prog [options] YYMMDD %prog -h|--help ''' parser = OptionParser(usage=usage) parser.add_option("-n", "--no-newline", dest="nonl",

Re: Learning C++ for Python Development

2009-05-11 Thread Nick Craig-Wood
he C++ symbols into the python code at runtime with ctypes. A bit of C++ implements the shims for the callbacks from python -> C++ (which are exported by ctypes). > P.S. I want to develop on Linux not Windows. Should be just the same on both. Once you've made your setup.py (for

Re: unicode bit me

2009-05-10 Thread Nick Craig-Wood
code byte 0xc2 in position 1: ordinal not in range(128) >>> unicode('[\xc2\xa9au]') Traceback (most recent call last): File "", line 1, in UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 1: ordinal not in range(128) >>> L.__unicode__ Traceback (most recent call last): File "", line 1, in AttributeError: 'list' object has no attribute '__unicode__' >>> unicode(str(L),"utf-8") u'[\xa9au]' -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems with datetime.datetime.strptime

2009-05-10 Thread Nick Craig-Wood
ts and the documentation then submit the patch to the python bugtracker. If I couldn't fix it then I'd report it as a bug. -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Python process utility (psutil) 0.1.2 released

2009-05-09 Thread Nick Craig-Wood
uot; returned something useful also! You could do this by replacing your current __init__.py (which just contains "from _psutil import *") with _psutil.py -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: How should I use grep from python?

2009-05-07 Thread Nick Craig-Wood
gt;> p.wait() # returns the error code 0 >>> There was talk of removing the other methods from public use for 3.x. Not sure of the conclusion. -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: object query assigned variable name?

2009-05-01 Thread Nick Craig-Wood
; Any thoughts? Read up on introspection and learn how to look up through the stack frames. When you've mastered that look for an object matching self in all the locals in those stack frames. That will give some kind of answer. I have no idea whether this will work - the keyboard of my phone is too small to produce a proof ;-) -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython menu creation refactoring

2009-04-30 Thread Nick Craig-Wood
andler, item) menuBar.Append(submenu, menuLabel) self.SetMenuBar(menuBar) That is the way I normally do it anyway! You create the submenu as a seperate menu then attach it to the menuBar with the label. Note there is a wxpython list also which you may get more help in! -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: bug with os.rename in 2.4.1?

2009-04-30 Thread Nick Craig-Wood
Steven D'Aprano wrote: > On Tue, 28 Apr 2009 14:30:02 -0500, Nick Craig-Wood wrote: > > > t123 wrote: > >> It's running on solaris 9. Here is some of the code. It's actually > >> at the beginning of the job. The files are ftp'd over. Th

  1   2   3   4   5   6   7   8   9   >