Re: Can I set timeout for the sys.stdin.readline() ?

2006-06-10 Thread Jay Parlar
On Jun 10, 2006, at 5:14 AM, ywzhan wrote: > Hi, I am new here. > When I use sys.stdin.readline() to get input string from user, > how can I set a timeout value for this operation? > thank you. > > You can do a select() on sys.stdin, and put a timeout on the select, ie: rfds, wfds, efds = selec

Re: unzip zip files

2006-05-13 Thread Jay Parlar
On May 12, 2006, at 5:45 PM, DataSmash wrote: > I need to unzip all zip file(s) in the current directory > into their own subdirectories. The zip file name(s) always > start with the string "usa" and end with ".zip". > The code below will make the subdirectory, move the zip > file into the subdi

Re: How to doctest if __name__ already used?

2006-05-07 Thread Jay Parlar
On May 5, 2006, at 10:33 PM, Leo Breebaart wrote: > I have a simple question (I hope), but one I'd love to get some > feedback on in case I am missing something obvious: > > If I have a Python script that is executable, and therefore > already uses '''if __name__ == "__main__"''' to call a functi

Re: unittest.main-workalike that runs doctests too?

2006-05-05 Thread Jay Parlar
On May 5, 2006, at 6:35 AM, John J. Lee wrote: > ...I wrote something to do this once, but didn't do as good a job as I > might have done and wondered if anybody else has done it properly. > > I know about nose, but it seems just a little too magical for my > tastes, and includes stuff I don't re

Re: pythonic way to sort

2006-05-03 Thread Jay Parlar
On May 4, 2006, at 12:12 AM, [EMAIL PROTECTED] wrote: > hi > I have a file with columns delimited by '~' like this: > > 1SOME STRING ~ABC~12311232432D~20060401~ > 2SOME STRING ~DEF~13534534543C~20060401~ > 3SOME STRING ~ACD~14353453554G~20060401~ > > . >

Re: Protocols for Python?

2006-04-27 Thread Jay Parlar
On Apr 27, 2006, at 3:26 PM, [EMAIL PROTECTED] wrote: > I think I have reached an important moment in my growth as a Python > Developer. I realize now why interfaces aren't really necessary in > Python. :] > > Still, I'm designing an application that I want to be extendable by > third-party devel

Re: Instruction at "0x00FC3D70" use memory address "0x00000000". Can't be "read".

2006-04-24 Thread Jay Parlar
On Apr 24, 2006, at 5:38 PM, Neil Adams wrote: > How do Ifix memory  message Ox033fc512 at Ox can't be read > You're going to have to provide a LOT more information if you expect anyone here to help you with that. What program caused that? For all we know, notepad.exe could have crashe

Re: Passing data attributes as method parameters

2006-04-23 Thread Jay Parlar
On Apr 23, 2006, at 4:59 PM, Panos Laganakos wrote: > Thanks Ben. > > What does it mean that they're statically bound? > > It seems weird that I'm not able to access variables in the class > namespace even though these attributes come into existance after class > instantiation. > The parameters

Re: tail a file (win)

2006-04-20 Thread Jay Parlar
On Apr 20, 2006, at 9:33 AM, david brochu jr wrote: > Hello, >   > I wrote a script to monitor ping activity and output it to a log file. > I am using windows and want to have another script constantly check > the latest entry to see if Request timed out is seen. Is there a way > to "tail" a f

Re: Mouse control in OS X

2006-04-20 Thread Jay Parlar
On Apr 20, 2006, at 1:22 PM, Mateo wrote: > I've played around with pygame, and it seems to have much of what I > need. Still, is there any way to initiate a mouse click from Python? > > Thanks. > In OS X, you'll probably need PyObjC. I've never had a chance to try it myself, but if any package

Re: 2.5 excitement

2006-04-19 Thread Jay Parlar
On Apr 18, 2006, at 9:06 PM, Alex Martelli wrote: > > Funny timing coincidence: your 1st draft of Python for Dummies going in > now, my 2nd edition of Python in a Nutshell just went to production, > AND > Wesley Chun's 2nd ed is also being finished this week. Three > Baypiggies > (or whatever w

Re: Plug-Ins In A Python Application

2006-04-18 Thread Jay Parlar
On Apr 18, 2006, at 9:58 AM, [EMAIL PROTECTED] wrote: > Its the Java developer again... > > I'm working on an application framework that I would like to implement > in Python. Part of the application framework is a plug-in model that is > similar to the one used in Eclipse. > > Is it possible to

Re: freakin out over C++ module in python

2006-04-18 Thread Jay Parlar
On Apr 18, 2006, at 4:43 AM, [EMAIL PROTECTED] wrote: > ok, well enough, looked at struct and it does seem to be what i am > after. for that anyway. > thanks, guess i will just have to take the time and pull it apart. > I recommend you also take a look at http://pyconstruct.sourceforge.net/ I

Re: Ironpython book?

2006-04-17 Thread Jay Parlar
On Apr 17, 2006, at 8:58 PM, Alex Martelli wrote: > > I don't know of any such books, but if M$ is willing to slip me a > suitable sweetener (to make it worth my while to install Windows again > after years of blissfully Windows-free existence: it must at least > cover > the expense of the extra

Re: Passing a packed C structure to a c module

2006-04-14 Thread Jay Parlar
On Apr 14, 2006, at 9:44 AM, Philippe Martin wrote: > Thanks, > > It's a pretty big structure: painfull to pass each item as a param. > > Regards, > > Philippe > Maybe this can do something for you? http://pyconstruct.sourceforge.net/ Jay P. -- http://mail.python.org/mailman/listinfo/python

Re: print without newline "halts" program execution

2006-04-13 Thread Jay Parlar
On Apr 13, 2006, at 5:57 PM, Karlo Lozovina wrote: > Consider this short script: > > --- > from time import time, sleep > > st = time() > print 'Start: %f, ' % st, > sleep(10) > sp = time() > print 'Stop: %f, Duration: %f' % (sp, (st - sp)) > --- > > On my environment (Linux, py24), when run, Pyt

Re: Remove Whitespace

2006-04-13 Thread Jay Parlar
On Apr 13, 2006, at 12:09 PM, Kelvie Wong wrote: > try this: > > string = 'D c a V e r " = d w o r d : 0 0 0 0 0 6 4 0' > import re > re.sub("\s", "", string) > > On 4/13/06, david brochu jr <[EMAIL PROTECTED]> wrote: > Even easier (if you only want to replace blank spaces, and not all whitespa

Re: Python2CPP ?

2006-04-12 Thread Jay Parlar
On Apr 12, 2006, at 5:13 AM, Michael Yanowitz wrote: >> > > Thanks. I want to translate from Python to C++ for a few reasons: > 1) Curiosity. I would like to see how well the translation goes. > 2) Efficiency. It is alot quicker to code something in Python. If I can >write it in Python and a

Re: Python-list Digest, Vol 31, Issue 119

2006-04-08 Thread Jay Parlar
On Apr 8, 2006, at 1:40 PM, [EMAIL PROTECTED] wrote: > > Hi there, > > I'm new to Python, but know other scripting and programming languages. > I > want to develop a script which will receive emails with attachments > from my POP3 account, perform certain actions on it and email it back > to some

Re: Missing C modules in 2.5 on OS X?

2006-04-06 Thread Jay Parlar
On Apr 6, 2006, at 3:25 PM, Jay Parlar wrote: > I just downloaded, built, and installed the new 2.5 alpha on OS X > 10.3, and it seems that the new 'functional' didn't get installed. > > I know that it got built (done from the 2.5 source directory): > > Ja

Missing C modules in 2.5 on OS X?

2006-04-06 Thread Jay Parlar
I just downloaded, built, and installed the new 2.5 alpha on OS X 10.3, and it seems that the new 'functional' didn't get installed. I know that it got built (done from the 2.5 source directory): Jay-Computer:~/Desktop/Python-2.5a1 jayparlar$ find . -iname functional* ./build/lib.darwin-7.9.0-Po

Re: doctest, unittest, or if __name__='__main__'

2006-03-21 Thread Jay Parlar
On Mar 21, 2006, at 1:12 PM, Fredrik wrote: > >> (I notice there's no mention in PEP 3000 of deprecating >> the doctest module). > > why is it that comp.lang.python is suddenly full of folks who > want to deprecate anything they don't understand ? don't > you have better things to do with your t

Re: TypeError: unsupported operand type(s) for -: 'tuple' and 'tuple'

2006-03-16 Thread Jay Parlar
On Mar 16, 2006, at 3:14 PM, Peter Bismuti wrote: > Can anyone explain this error message?  > > Traceback (most recent call last): >   File "/acct/pjb9508/RAT/Scripts/PyQt/RatDialog.py", line 30, in > NewClipButton_clicked >     > self.rat.planeClip(self.o,"SQUARE"+str(self.squareCounter),w

Re: Type Hinting vs Type Checking and Preconditions

2006-03-08 Thread Jay Parlar
On Mar 8, 2006, at 8:43 AM, Tom Bradford wrote: > > > This type of hinting would only break type ducking in-so-much as a > function that leveraged that hinting would be looking specifically for > an instance of a particular type, which would be absolutely no > different than a developer performing

Re: Type Hinting vs Type Checking and Preconditions

2006-03-08 Thread Jay Parlar
On Mar 8, 2006, at 7:20 AM, Tom Bradford wrote: > Really what we're talking about here is weak typing in the form of > optional type hinting performed on a function by function basis. As an > option, what it would do is allow an author to semantically 'hint' to > the interpreter that a function

Re: Type Hinting vs Type Checking and Preconditions

2006-03-07 Thread Jay Parlar
On Mar 7, 2006, at 1:32 PM, Tom Bradford wrote: > > Let me first say that I'm sure that this subject has come up before, > and so forgive me for beating a dead horse. Secondly, let me say that > Python's strength is its dynamic nature, and I don't believe that it > should ever require a precondit

Re: Checking function calls

2006-03-06 Thread Jay Parlar
On Mar 6, 2006, at 8:44 PM, James Stroud wrote: > Since python is "weakly typed", you will not be able to check what > "type" of arguments a function expects. TypeErrors relating to the > type of argemtns you pass will be raised inside the function only and > not when it is called. I.e. there

Re: Adding method at runtime - problem with self

2006-03-05 Thread Jay Parlar
On Mar 5, 2006, at 2:30 PM, Marek wrote: > Assume I want to add a method to an object at runtime. Yes, to an > object, not a class - because changing a class would have global > effects and I want to alter a particular object only. The following > approach fails: > > class kla: > x = 1 > > de

Re: Papers on Dynamic Languages

2006-03-05 Thread Jay Parlar
On Mar 4, 2006, at 3:00 PM, Paul Boddie wrote: > > I'd have a look at the following Python-related papers: > > Michael Salib's Starkiller paper (and presentation): > http://www.python.org/pycon/dc2004/papers/1/ > > Mark Dufour's ShedSkin paper: > http://kascade.org/optimizing_python.pdf > > John A

Papers on Dynamic Languages

2006-03-04 Thread Jay Parlar
For one of my grad school classes, I'm writing a paper on "Dynamic Languages". What a wonderfully vague topic (but at least it'll let me write about Python). Anyway, I want to talk about things like typing disciplines (weak, strong, etc.),"class vs. prototype, JIT technologies in dynamic langu

Re: AdaptionFailure: How to use Interfaces with PyProtocols ?

2006-02-10 Thread Jay Parlar
On Feb 10, 2006, at 4:21 AM, Nebur wrote: > Hi, > I tried to understand the docs of Peak's PyProtocols, and failed. > I use PyProtocols v0.93 final. I fetched the ...tar.gz file for Linux > and installed it using the setup.py. > Here's my Hello-World-like example, that defines a Duck, which > "imp

Twisted book opinions?

2006-02-08 Thread Jay Parlar
I was hoping to get some c.l.p. opinions on O'Reilly's new Twisted book. I'm coming at Twisted as someone who's been programming mainly in Python for almost 6 years now, but who's never done any Twisted development. I've used some of its prepackaged libraries before (and did some custom tweaks

Re: Python vs C for a mail server

2006-01-31 Thread Jay Parlar
Randall Parker wrote: > Alex Martelli wrote: > >> The "but without declaration it can't be self-documenting" issue is a >> red herring. Reading, e.g.: >> >> int zappolop(int frep) { ... >> >> gives me no _useful_ "self-documenting" information about the role and >> meaning of frep, or zappolop's

Re: Language Semantics: @ symbol??

2006-01-29 Thread Jay Parlar
Enigma Curry wrote: > > > Sorry, for the noob question, but I haven't been able to find > documentation on this matter. > > I've been looking for documentation that describes what the @function() > syntax is all about. > > I've seen this on a few pages, for instance: > > http://aspn.activestate.co

Re: Python vs C for a mail server

2006-01-29 Thread Jay Parlar
> Paul Boddie wrote: > >> I don't think I've ever seen anyone advocating calling a function like >> getattr(obj "foo" + "bar")(). > >> From Lib/compiler/visitor.py: > > meth = getattr(self.visitor, 'visit' + className, 0) > > Later on: > > meth(node, *args) > > Of course, you can drop the "visit" p

Re: Python vs C for a mail server

2006-01-29 Thread Jay Parlar
> Indeed, especially Eckels article shed some light about testing as an > alternative to static typing. I still can't quite understand why you > can't > do both. Clearly unit tests should be part of any software, not only > Python software. > You can do both, but why? *Especially* in a language li

Re: Guido at Google

2005-12-22 Thread Jay Parlar
On Dec 22, 2005, at 2:20 PM, Greg Stein wrote: > Guido would acknowledge a query, but never announce it. That's not his > style. > > This should have a positive impact on Python. His job description has a > *very* significant portion of his time dedicated specifically to > working on Python. (much

Re: subset permutations

2005-12-08 Thread Jay Parlar
On Dec 8, 2005, at 5:29 PM, [EMAIL PROTECTED] wrote: > > Hello all, >   > I'm a beginner with programming. Trying to teach myself with that > excellent rat book. Unfortunately I just can't seem to figure out a > simple problem that has come up at my work (biology lab): > let's say I have a lis

reddit.com rewritten in Python

2005-12-05 Thread Jay Parlar
reddit.com, which was formerly implemented in LISP (and somewhat famous for that fact) has just *relaunched* and is now written in Python! They haven't given their reasons yet, but I'll certainly be interested to see why. Paul Graham's reaction should also be interesting, he said reddit.com ha

Re: [ x for x in xrange(10) when p(x) ]

2005-11-09 Thread Jay Parlar
On Nov 9, 2005, at 7:30 PM, Alex Martelli wrote: > No way -- the itertools module is and remains a PRECIOUS resource. If > you want an iterator rather than a list, itertools.ifilter is quite > appropriate here. Or if you're on 2.4 and want an iterator: (x for x in xrange(10) if p(x)) Jay P.

Re: can i tar and untar using python

2005-11-07 Thread Jay Parlar
On Nov 7, 2005, at 3:00 AM, sumi wrote: > can i tar and untar using python The standard library does it again: http://docs.python.org/lib/module-tarfile.html Jay P. -- http://mail.python.org/mailman/listinfo/python-list

Re: python gc performance in large apps

2005-11-05 Thread Jay Parlar
You may also want to look at the following Summer of Code project: http://pysizer.8325.org/ Their SVN repo is at http://codespeak.net/svn/user/nick8325/sizer/ I haven't had a chance to try it yet, but it might be exactly what you need. The project is described as "PySizer is a library for mea

Re: Python-list Digest, Vol 25, Issue 522

2005-10-28 Thread Jay Parlar
On Oct 28, 2005, at 9:20 AM, pywrote: From what I have seen Python does not come with an snmp module built in, can anyone suggest some other SNMP module (preferably one you have used/experienced)..I have googled and seen yapsnmp and pysnmp (which seem to be the two most active SNMP modules). W

Re: How best to reference parameters.

2005-10-25 Thread Jay Parlar
On Oct 25, 2005, at 3:10 PM, David wrote: > > It looks like I am going to have to bite the bullet and use properties. > The following should do what I want. > > class test: > > def __init__(self): > self.__HB = 0 > self.__VPG = 0 > ... FYI, for property to work, your class ha

Re: setuptools, ez_setup over http proxy

2005-10-13 Thread Jay Parlar
> I've recently configured my network such that I use squid as a http > proxy. I'd now like to be able to use setuptools and ez_setup via this > proxy. Is this possible? If so, how do I do it? It should work if you sent the environment variable (in your shell) 'http_proxy' to the address of you

Re: Parametric Polymorphism

2005-09-27 Thread Jay Parlar
I haven't been following this whole thread, but it sounds like you want something like PJE's RuleDispatch package. There's a Developer Works article about it, put up very recently: http://www-128.ibm.com/developerworks/linux/library/l-cppeak2/?ca=dgr- lnxw02aScalingPEAK PJE (IIRC) based it of

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

2004-12-31 Thread Jay Parlar
Jumping in a bit late here, but I'd personally REALLY like to see something about PEP 246, and more specifically, what Phillip Eby has done about it with the PyProtocols package. Especially with all this static typing talk going on these days, a good set of documentation (with lots of useful ex