a RegEx puzzle

2005-03-11 Thread Charles Hartman
the details (I'm even shakier on generators than I am on regexes!) and (2) that *seems* likely to be less efficient, maybe by a large enough factor that the obnoxiousness of getting the first search-return seven times is something I should just swallow. What magic am I missing? Charles Hartman Professor of English, Poet in Residence http://cherry.conncoll.edu/cohar http://villex.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

hotshot ??

2005-03-11 Thread Charles Hartman
--which I don't understand. (The program is a GUI one using wxPython 2.5, running from within the WingIDE on a Mac under OS 10.3.8, if any of that makes a difference. Nothing there prevents hotshot from loading a file that's been made without the lineevents=1 argument.) Charles H

Re: a RegEx puzzle

2005-03-11 Thread Charles Hartman
Charles Hartman <[EMAIL PROTECTED]> wrote: I'm still shaky on some of sre's syntax. Here's the task: I've got strings (never longer than about a dozen characters) that are guaranteed to be made only of characters 'x' and '/'. One possibility i

Re: a RegEx puzzle

2005-03-11 Thread Charles Hartman
it's any more efficient and/or elegant than what I've got now. Hm -- lots to think about here. Thank you. Charles Hartman Professor of English, Poet in Residence http://cherry.conncoll.edu/cohar http://villex.blogspot.com pat = sre.compile('(x[x/])+') (longest, startlongest) = ma

Re: a RegEx puzzle

2005-03-11 Thread Charles Hartman
ired changing > into >=, which even I can't screw up. Thanks to everyone who's helped on this. Makes me wish I were going to pycon. Charles Hartman Professor of English, Poet in Residence http://cherry.conncoll.edu/cohar http://villex.blogspot.com Kent Johnson wrote: It's

Re: a RegEx puzzle (end of thread)

2005-03-12 Thread Charles Hartman
Won't extend this except to say thanks to Michael Spencer for another version. If I were doing it only once I'd use that. Since I do it more than once I should package it as a function. Thanks. Charles Hartman Professor of English, Poet in Residence http://cherry.conncoll.edu/

Re: Python-list Digest, Vol 18, Issue 208

2005-03-13 Thread Charles Hartman
s how you tell Python you're entering an octal number. (Parallel to 0x for hexadecimals.) So beware of 010, which isn't the number of fingers you presumably have, unless you don't count the thumbs. Charles Hartman -- http://mail.python.org/mailman/listinfo/python-list

Re: Boo who? (was Re: newbie question)

2005-03-15 Thread Charles Hixson
Terry Reedy wrote: "Luis M. Gonzalez" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] ... It is as important and "python related" as other projects such as PyPy, Stackless, but I think this is silly. PyPy is an alternate implementation of Python, not a different language.

Re: Boo who? (was Re: newbie question)

2005-03-15 Thread Charles Hixson
Grant Edwards wrote: That seems to imply that you think market sucess == technical merits. Unless you mean that Prothon was a technical failure rather than a market-share failure... As Prothon never got as far as an alpha stage product, I don't think you could call it a technical success. It

Re: newbie: modifying a string in python

2005-03-16 Thread Charles Hartman
offer more efficient solutions. Charles Hartman Professor of English, Poet in Residence http://cherry.conncoll.edu/cohar http://villex.blogspot.com want to modify a string in the following way : for s in stks:   s = s.strip()   if ( s[-2:] == ‘GR’ ):   s[-2:]= ‘GF’   so, if the

Windows question from Mac guy

2005-03-18 Thread Charles Hartman
though yes I *can* navigate to the right place.) This is pretty much the same code I use when the user selects "Load text file," and the app goes straight to the right directory (its own directory), where it finds a sample text file I supply. Is os.getcwd() working differently in the

Re: Windows question from Mac guy

2005-03-18 Thread Charles Hartman
simple way for 'darwin'. Many thanks! Charles Hartman -- http://mail.python.org/mailman/listinfo/python-list

Text-to-speech

2005-03-19 Thread Charles Hartman
platforms, but I guess I'm asking too much -- it's too hardware dependent, I suppose. Any hints? Charles Hartman Professor of English, Poet in Residence http://cherry.conncoll.edu/cohar http://villex.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Text-to-speech

2005-03-20 Thread Charles Hartman
even directly talked about in the boolk) that there came a casual remark from a reader last year which led to the Scandroid. Charles Hartman "The time has come for someone to put his foot down; and that foot is me." --Animal House On Mar 20, 2005, at 2:10 AM, Tim Churches wrote:

Re: Software for Poets (Was: Re: Text-to-speech)

2005-03-20 Thread Charles Hartman
On Mar 20, 2005, at 4:10 PM, Francis Girard wrote: Hello M. Hartman, It's a very big opportunity for me to find someone that both is a poet and knows something about programming. First, please excuse my bad english ; I'm a french canadian. My French is a great deal worse than your English; fear n

Re: Text-to-speech

2005-03-21 Thread Charles Hartman
Maybe you can bind Festival (http://www.cstr.ed.ac.uk/projects/festival/download.html) with SWIG. Presumably somebody could; at this point it's well beyond me. But thank you for the suggestion. Charles Hartman http://cherry.conncoll.edu/cohar -- http://mail.python.org/mailman/listinfo/p

comparison puzzle? bug?

2005-03-22 Thread Charles Hixson
I hesitate to call this a bug, as at my level of expertise that seems ... unlikely. But I can't think of any other explanation: This is an extract from some longer code: print"item = ", item print"item[0] < lvl = %d < %d = " %(item[0], lvl), bool(item[0] < lvl) print"item[0] == lv

intrusive posts

2005-03-23 Thread Charles Hartman
On Mar 23, 2005, at 7:10 PM, [EMAIL PROTECTED] wrote: 7. (",) Do You Want To Know For Sure You Are Going To Heaven? Is there no way of filtering this recurring offensive material from the list? Charles Hartman -- http://mail.python.org/mailman/listinfo/python-list

Re: Python-list Digest, Vol 18, Issue 391

2005-03-24 Thread Charles Hartman
ython docs is funny, and the didactic pose of the whole post is . . . derisory. The motive for the post escapes me, or I hope it does. Charles Hartman -- http://mail.python.org/mailman/listinfo/python-list

Re: breaking up is hard to do

2005-03-25 Thread Charles Hartman
ecially six months later. I'm sure people who know a lot better what they're talking about will have more thorough answers for you. Charles Hartman -- http://mail.python.org/mailman/listinfo/python-list

character-filtering and Word (& company)

2005-03-25 Thread Charles Hartman
n marks and the like. Is there some well-known way to filter or translate this w.p. garbage? I don't know whether encodings are relevant; I don't know what encoding an MSW file uses. I don't see how to use s.translate() because I don't know how to predict what the incoming for

list-comprehension and map question (simple)

2005-03-27 Thread Charles Hartman
er/_sandbox.py", line 1, in addone # Used internally for debug sandbox under external interpreter TypeError: unsupported operand type(s) for +: 'function' and 'int' ) I hope the question is clear enough. I have a feeling I'm ignoring a simple technique . . . Charles Hartman -- http://mail.python.org/mailman/listinfo/python-list

Re: list-comprehension and map question (simple)

2005-03-27 Thread Charles Hartman
s is quite cool, and it looks as though it would work with more complicated function calls than the ones in my toy example. Thanks. Charles Hartman -- http://mail.python.org/mailman/listinfo/python-list

Re: list-comprehension and map question (simple)

2005-03-27 Thread Charles Hartman
onary whose keys are those two-item tuples and whose values are the integers returned by self._measureComplexity Charles Hartman -- http://mail.python.org/mailman/listinfo/python-list

Re: list-comprehension and map question (simple)

2005-03-27 Thread Charles Hartman
I very much take your point. And thanks: that answers my syntax question (I think!) -- *and* tells me that I don't care. Charles Hartman On Mar 27, 2005, at 2:16 PM, [EMAIL PROTECTED] wrote: ... >>> simpler == complexities True >>> I've not the glimmer of a clue whic

good design & method calls

2005-03-29 Thread Charles Hartman
sses local variables much more efficiently than global variables." These two pieces of advice imply opposite kinds of code revisions. Obviously they have different purposes, and both are right at different times. I wonder if anyone has some wisdom about how to think about when or how often to d

Re: good design & method calls

2005-03-29 Thread Charles Hartman
On Mar 29, 2005, at 10:36 AM, Peter Hansen wrote: Sorry for the rant... I didn't intend it to head that way when I started out, but I seem to be on a bit of an anti-optimization bent today. :-) No, that's very helpful; thanks. Charles Hartman -- http://mail.python.org/mailman/listinfo/python-list

Is there a package with convolution and related methods?

2005-04-21 Thread Charles Krug
Python" already. Thanks Charles -- http://mail.python.org/mailman/listinfo/python-list

How can I verify that a passed argument is an interible collection?

2005-04-21 Thread Charles Krug
I *coughs* simply *coughs* trap the exception created by: for v in x: when v is a scaler quantity? Thanks Charles -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a package with convolution and related methods?

2005-04-21 Thread Charles Krug
On Thu, 21 Apr 2005 13:13:17 -0400, David M. Cooke <[EMAIL PROTECTED]> wrote: > Charles Krug <[EMAIL PROTECTED]> writes: > >> List: >> >> Is there a Python package with Convolution and related methods? >> >> I'm working on modeling some DSP p

Pythonic way to do static local variables?

2005-04-25 Thread Charles Krug
I've a function that needs to maintain an ordered sequence between calls. In C or C++, I'd declare the pointer (or collection object) static at the function scope. What's the Pythonic way to do this? Is there a better solution than putting the sequence at module scope? Thanks. -- http://mai

Re: Pythonic way to do static local variables?

2005-04-25 Thread Charles Krug
On Mon, 25 Apr 2005 21:30:18 -0500, Jaime Wyant <[EMAIL PROTECTED]> wrote: > Well, if you're a c++ programmer, Well, my forte is embedded systems and device controls . . . > then you've probably ran into > `functors' at one time or another. You can emulate it by making a > python object that is

Is there a better interactive plotter then pylab?

2005-04-27 Thread Charles Krug
tive window to the plot window and back, the plot window gets trashed. Is there a better alternative for interactive use? Thanks Charles -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a better interactive plotter then pylab?

2005-04-27 Thread Charles Krug
On Wed, 27 Apr 2005 20:56:07 -0500, John Hunter <[EMAIL PROTECTED]> wrote: >>>>>> "Charles" == Charles Krug <[EMAIL PROTECTED]> writes: > >Charles> List: I'm trying to us pylab to see what I'm doing with >Charles> some DSP

Re: OOP

2005-04-28 Thread Charles Krug
On 28 Apr 2005 10:34:44 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hey yall, > I'm new to Python and I love it. Now I can get most of the topics > covered with the Python tutorials I've read but the one thats just > stumping me is Object Orientation. I can't get the grasp of it. Does > a

Re: Data smoothing algorithms?

2005-04-29 Thread Charles Krug
"Anthra Norell" <[EMAIL PROTECTED]> writes: > >> Hi, >> > The following are differences of solar declinations from one day to > the next, (never mind the unit). Considering the inertia of a > planet, any progress of (apparent) celestial motion over regular > time intervals has to be highly regula

Documentation of dict views change request

2014-01-19 Thread Charles Hixson
talking about changing their value through other means of access rather than directly through the returned values.) P.S.: Is it reasonable to return the items() of a dict in order to pass a read only copy of the values? -- Charles Hixson -- https://mail.python.org/mailman/listinfo/python-list

1st Sketch at at ReadOnly dict

2014-01-20 Thread Charles Hixson
nlen(self._ddict) -- Charles Hixson -- https://mail.python.org/mailman/listinfo/python-list

Re: 1st Sketch at at ReadOnly dict

2014-01-20 Thread Charles Hixson
On 01/20/2014 12:52 PM, Peter Otten wrote: Charles Hixson wrote: This is just a first sketch, and I haven't yet attempted to test it, so what I'm hoping for is criticisms on the general approach. class RODict: def __init__ (self, ddict = {}): Default values are evaluted just

Re: 1st Sketch at at ReadOnly dict

2014-01-20 Thread Charles Hixson
On 01/20/2014 04:08 PM, Chris Angelico wrote: On Tue, Jan 21, 2014 at 7:09 AM, Charles Hixson wrote: #@note Instances can be created only from existing dicts. ##Class initializer. #@paramddictThe data dictionary to which this is a read only

Re: 1st Sketch at at ReadOnly dict

2014-01-20 Thread Charles Hixson
On 01/20/2014 08:14 PM, Dan Stromberg wrote: On Mon, Jan 20, 2014 at 12:09 PM, Charles Hixson wrote: class RODict: #Instance Variable Doc ##@var_ddict #This variable holds the reference to the dict. ##Class initializer. #@paramddictThe

http://bugs.python.org/user?@template=rego_progress broken?

2014-01-21 Thread Charles Hixson
isn't too important, as I was just going to request a documentation change, but it happening may be more important than what I would have entered. -- Charles Hixson -- https://mail.python.org/mailman/listinfo/python-list

Machine Learning Startup Hiring

2014-11-05 Thread Charles Weitzer
My name is Charles Weitzer. I do recruiting with a focus on quantitative sciences. One of my clients is a machine learning startup located in Northern California. The founders include a successful veteran entrepreneur with a PhD in CS from Stanford, while the other founder is on the faculty at

Design and Build Software Engineer Opportunity

2014-11-10 Thread Charles Weitzer
My name is Charles Weitzer. I do recruiting for machine learning teams worldwide. One of my clients is a startup quantitative hedge fund located in Northern, California. The founders previous worked together at one of the most successful quantitative hedge funds in the world in New York City

Multiprocessing process termination

2014-12-31 Thread Charles Hixson
In order to allow multiple processes to access a database (currently SQLite) I want to run the process in a separate thread. Because it will be accessed from multiple processes I intent to use Queues for shifting messages back and forth. But none of the individuals processes will know when al

Re: Multiprocessing process termination

2014-12-31 Thread Charles Hixson
On 12/31/2014 01:18 PM, MRAB wrote: On 2014-12-31 19:33, Charles Hixson wrote: In order to allow multiple processes to access a database (currently SQLite) I want to run the process in a separate thread. Because it will be accessed from multiple processes I intent to use Queues for shifting

Machine Learning Startup Hiring

2015-01-12 Thread Charles Weitzer
Hello, My name is Charles Weitzer. I do recruiting with a focus on quantitative sciences. One of my clients is a machine learning startup located in Northern California. The founders include a successful veteran entrepreneur with a PhD in CS from Stanford, while the other founder is on the

Design and Build Software Engineer Opportunity

2015-01-12 Thread Charles Weitzer
My name is Charles Weitzer. I do recruiting for machine learning teams worldwide. One of my clients is a startup quantitative hedge fund located in Northern, California. The founders previous worked together at one of the most successful quantitative hedge funds in the world in New York City

__next__ and StopIteration

2015-02-09 Thread Charles Hixson
I'm trying to write a correct iteration over a doubly indexed container, and what I've got so far is:def __next__ (self): for rowinrange(self._rows): for col in range(self._cols): if self._grid[row][col]: yieldself._grid[row]

Re: __next__ and StopIteration

2015-02-09 Thread Charles Hixson
On 02/09/2015 03:56 PM, Ian Kelly wrote: On Mon, Feb 9, 2015 at 4:30 PM, Steven D'Aprano wrote: The way you write iterators is like this: Method 1 (the hard way): - Give your class an __iter__ method which simply returns self: def __iter__(self): return self - Give your clas

Re: __next__ and StopIteration

2015-02-09 Thread Charles Hixson
On 02/09/2015 08:46 PM, Chris Angelico wrote: On Tue, Feb 10, 2015 at 3:33 PM, Charles Hixson wrote: The proper version of the "hard way" is: 1) The __iter__ method of the iterable constructs a new iterator instance and returns it. 2) The __iter__ method of the *iterator* simp

Group by interval time

2015-02-12 Thread charles . sartori
Hello there! I`m trying to group by a list of Row() objects in 12days interval and sum(). values. Here is an example of the list [Row(time=datetime.datetime(2013, 1, 1, 0, 0), sum=4676557380615), Row(time=datetime.datetime(2013, 1, 2, 0, 0), sum=6549630855895), Row(time=datetime.datetime(2013,

Re: Group by interval time

2015-02-12 Thread charles . sartori
Thank you Peter, I was doing wrong at get_key function... Thnak you so much! -- https://mail.python.org/mailman/listinfo/python-list

Re: random.sample with large weighted sample-sets?

2014-02-16 Thread Charles Allen
How efficient does this thing need to be? You can always just turn it into a two-dimensional sampling problem by thinking of the data as a function f(x=item), generating a random x=xr in [0,x], then generating a random y in [0,max(f(x))]. The xr is accepted if 0 < y <= max(f(xr)), or rejected (an

Python 2.7 documentation with readthedocs theme

2014-03-04 Thread Charles Gunawan
Hi, I was just looking into some documentation on readthedocs and I saw that they have a cool new theme. I was wondering how the python documentation will look like with that theme. So after some tinkering I have build python 2.7 CHM documentation with the theme. If you are wondering too you c

Proper deletion of selected items during map iteration in for loop

2014-04-25 Thread Charles Hixson
during iteration In the past I've accumulated the keys to be deleted in a separate list, but this time there are likely to be a large number of them, so is there some better way? -- Charles Hixson -- https://mail.python.org/mailman/listinfo/python-list

Re: Proper deletion of selected items during map iteration in for loop: Thanks to all

2014-04-26 Thread Charles Hixson
On 04/25/2014 10:53 AM, Charles Hixson wrote: What is the proper way to delete selected items during iteration of a map? What I want to do is: for (k, v) in m.items(): if f(k): # do some processing of v and save result elsewhere del m[k] But this gives (as should be expected

Parallel python in the cloud

2014-05-23 Thread Charles Gagnon
We were happily using PiCloud for several long calculations and we very happy with with it. With their realtime cores, we could take really large calculations set and run through fairly quickly. Now that PiCloud is going away, we ran a few tests on Mutlyvac but so far, we are struggling to acco

Re: Can I trust downloading Python?

2013-09-08 Thread Charles Hottel
"Steven D'Aprano" wrote in message news:522c6e4e$0$29988$c3e8da3$54964...@news.astraweb.com... > On Sat, 07 Sep 2013 21:04:59 -0600, Michael Torrie wrote: > >> As for trusting python in general, I do trust the python developers, but >> recent NSA revelations call just about all aspects of comput

Re: class-private names and the Zen of Python

2013-10-09 Thread Charles Hixson
ally show up, as changes that they would catch happen quite rarely, but...) OTOH, neither one really fits in as, say, an included module...they're more like idle, which now that I look does have a "check module" run option. Perhaps that invokes one of them. I note that Idle

Re: Tail recursion to while iteration in 2 easy steps

2013-10-09 Thread Charles Hixson
machine, implemented by an underneath microcode layer.) You can reasonably say that an implementation of Python is done in terms of a virtual machine. (Usually I don't bother about this kind of nit-pick, but in this discussion it seems apropos.) -- Charles Hixson -- https://mail.python.org/mailman/listinfo/python-list

Re: converting letters to numbers

2013-10-16 Thread Charles Hixson
tion, but Scheme could be considered a part of the Lisp clade. -- Charles Hixson -- https://mail.python.org/mailman/listinfo/python-list

Sort list of dictionaries

2015-03-02 Thread Charles Heizer
Hello, I'm new to python and I'm trying to find the right way to solve this issue I have. I'm trying to sort this list by name and then by version numbers. The problem I'm having is that I can not get the version numbers sorted with the highest at the top or sorted properly. mylist = [{'name'

Re: Sort list of dictionaries

2015-03-02 Thread Charles Heizer
quot;40.0.2214.111" is higher than "40.0.2214.91" but in the end result it's not sorting it that way. Thanks, Charlie On Monday, March 2, 2015 at 10:32:40 AM UTC-8, Emile van Sebille wrote: > On 3/2/2015 10:17 AM, Charles Heizer wrote: > > Hello, > > I'm ne

Re: Sort list of dictionaries

2015-03-02 Thread Charles Heizer
Never mind, the light bulb finally went off. :-\ sortedlist = sorted(mylist , key=lambda elem: "%s %s" % ( elem['name'], (".".join([i.zfill(5) for i in elem['version'].split(".")])) ), reverse=True) On Monday, March 2, 2015 at 10:40:30 AM UTC

Re: Sort list of dictionaries

2015-03-03 Thread Charles Heizer
On Monday, March 2, 2015 at 11:23:37 AM UTC-8, Peter Otten wrote: > Charles Heizer wrote: > > > Never mind, the light bulb finally went off. :-\ > > > > sortedlist = sorted(mylist , key=lambda elem: "%s %s" % ( elem['name'], > > (&

404 Error when using local CGI Server

2015-06-25 Thread Charles Carr
I am running a local cgi server from python on a windows 7 computer. Whenever I try to serve the output of a cgi file by entering the following into my browser: http://localhost:8080/filename.py , I get a 404 error message that the file was not found. I'm positive that the files I am trying to serv

asyncio, coroutines, etc. and simultaneous execution

2015-08-23 Thread Charles Hixson
If I understand correctly asyncio, coroutines, etc. (and, of course, Threads) are not simultaneously executed, and that if one wants that one must still use multiprocessing. But I'm not sure. The note is still there at the start of threading, so I'm pretty sure about that one. The requiremen

multiprocessing problem: queue.get() not finding pushed values

2014-07-15 Thread Charles Hixson
I don't think I can reduce it much beyond this. I'm trying to run Sqlite in a separate process, but I'm running into problems. *The code:* from collectionsimportnamedtuple from multiprocessing import Process, Queue, current_process from queue import Empty, Full Msg=namedtuple (

multiprocessing vs. asyncio.SubprocessProtocol

2014-07-31 Thread Charles Hixson
What are the tradeoffs between using multiprocessing vs. using asyncio.SubprocessProtocol? This only one that I've noticed is that asyncio seems to require much more hands-on management of message queueing. OTOH, I'm no expert in either of them, and I might be missing something that will bite m

Possible bug in string handling (with kludgy work-around)

2011-12-26 Thread Charles Hixson
quot;\"", sep = "") tmp=self.wordList[i][1] ## !! Kludge -- remove tmp to see the error self.wordList[i]=tmp + self.wordList[i][1:-1] ## !! Kludge -- remove tmp + to see the error print ("1: wordList[", i, "] = \"", self.wordList[i], "\"", sep = "") print("len(wordList[", i, "]) = ", len(self.wordList[i]) ) -- Charles Hixson -- http://mail.python.org/mailman/listinfo/python-list

Re: Possible bug in string handling (with kludgy work-around)

2011-12-27 Thread Charles Hixson
That was it! Thanks. On 12/26/2011 02:44 PM, Chris Angelico wrote: On Tue, Dec 27, 2011 at 9:23 AM, Charles Hixson wrote: This doesn't cause a crash, but rather incorrect results. You may need to be a bit clearer. What line of code (or what expression)? What did you expect t

Sphinx highlighting

2013-03-13 Thread Charles Hixson
, but I can't stand having it appear for some of my functions, and not for others, and I haven't been able to figure out what turns it on or off. -- Charles Hixson -- http://mail.python.org/mailman/listinfo/python-list

Threadpool item mailboxes design problem

2013-04-14 Thread Charles Hixson
space would be wasted. Or if the queues could dynamically resize. Or if there was a threadsafe dict. Or... But I don't know that any of these are feasible. (I mean, yes, I could write all the mail to a database, but is that a better answer, or even a good one?) -- Charles Hixson

Re: Threadpool item mailboxes design problem

2013-04-15 Thread Charles Hixson
On 04/14/2013 07:32 PM, Chris Rebert wrote: On Apr 14, 2013 4:27 PM, "Charles Hixson" <mailto:charleshi...@earthlink.net>> wrote: > > What is the best approach to implementing actors that accept and post messages (and have no other external contacts). You migh

Re: Threadpool item mailboxes design problem

2013-04-15 Thread Charles Hixson
On 04/15/2013 10:14 AM, Charles Hixson wrote: On 04/14/2013 07:32 PM, Chris Rebert wrote: On Apr 14, 2013 4:27 PM, "Charles Hixson" <mailto:charleshi...@earthlink.net>> wrote: > > What is the best approach to implementing actors that accept and post messages (a

File Paramaterized Abstract Factory

2006-01-10 Thread Charles Krug
missing a step or seventeen. What's the best way to do this? Thanks Charles -- http://mail.python.org/mailman/listinfo/python-list

Re: File Paramaterized Abstract Factory

2006-01-11 Thread Charles Krug
On 2006-01-11, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Charles Krug wrote: > >> What I'd like is to do something like this: >> >> factoryFile = sys.argv[1] # we assume that argv[1] implements a >> # correct ThingMaker interface.

Trying to generate a list of the subclasses of C

2006-01-16 Thread Charles Krug
List: I have this: # classC.py class C(object): pass class D(C): pass class E(C): pass def CSubclasses(): for name in dir(): pass I'm trying to create a list of all of C's subclasses: import classC print C aList = [] for name in dir(classC): print name, try: if issubcla

Re: Trying to generate a list of the subclasses of C

2006-01-18 Thread Charles Krug
On 2006-01-16, Alex Martelli <[EMAIL PROTECTED]> wrote: > Charles Krug <[EMAIL PROTECTED]> wrote: >... >> I'm trying to create a list of all of C's subclasses: > > There's a class method for that very purpose: > >>>> class C(obje

TypeError: 'module' object is not callable (newby question)

2006-08-14 Thread Charles Russell
Why does this work from the python prompt, but fail from a script? How does one make it work from a script? #! /usr/bin/python import glob # following line works from python prompt; why not in script? files=glob.glob('*.py') print files Traceback (most recent call last): File "./glob.py", line

Re: TypeError: 'module' object is not callable (newby question)

2006-08-14 Thread Charles Russell
Marc 'BlackJack' Rintsch wrote: > > Don't call your file `glob.py` because then you import this module and not > the `glob` module from the standard library. > > Ciao, > Marc 'BlackJack' Rintsch Yes, thanks. Renaming to myglob.py solved the problem. But why does the conflict not occur w

Re: TypeError: 'module' object is not callable (newby question)

2006-08-14 Thread Charles Russell
John Machin wrote: > > Contemplate the following: > > C:\junk>type glob.py > if __name__ == "__main__": > print "*** Being run as a script ..." > import glob > print "glob was imported from", glob.__file__ > print "glob.glob is", type(glob.glob) > print "glob.glob was importe

Re: TypeError: 'module' object is not callable (newby question)

2006-08-14 Thread Charles Russell
Charles Russell wrote: But why does the > conflict not occur when the code is run interactively from the python > prompt? Because, I now realize, I had not yet created glob.py when I tried that. -- http://mail.python.org/mailman/listinfo/python-list

Re: TypeError: 'module' object is not callable (newby question)

2006-08-15 Thread Charles Russell
Charles Russell wrote: I haven't found the magic word to invoke a > .py script from the python prompt (like the command "source" in csh, > bash, tcl?) Seems to be execfile() -- http://mail.python.org/mailman/listinfo/python-list

Re: TypeError: 'module' object is not callable (newby question)

2006-08-15 Thread Charles Russell
Marc 'BlackJack' Rintsch wrote: > Here's the index of the reference manual: > > http://docs.python.org/ref/genindex.html > Thanks. When I go up a level from there, I find a pointer to the index right at the bottom of the table of contents, which I had overlooked. -- http://mail.python.org/m

psp 2 game list

2006-12-18 Thread Charles Bishop
could you send me a list of games you have __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list

How do I tell if I'm running in the PyWin interpreter?

2006-01-27 Thread Charles Krug
sample code that did something very much like this (define a small set of callbacks and execute them from a command-like interface) but I can't seem to lay my hands on the example. Thanx Charles -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I tell if I'm running in the PyWin interpreter?

2006-01-27 Thread Charles Krug
On 2006-01-28, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> >> As the comment says, when I run this under Python Win, I get an (pretty >> sure) Tkinter interface, not a command line, and I don't get my >> EOFError when I expect to. > > When do you expect to get an EOFError? The only way I get an

Re: How do I tell if I'm running in the PyWin interpreter?

2006-01-28 Thread Charles Krug
On 2006-01-28, Peter Otten <[EMAIL PROTECTED]> wrote: > Charles Krug wrote: > >> Is there a way to detect that I'm running the the PyWin interpreter so >> that I can bypass its raw_input behavior? > > You could test > > if pywin_specific_module in sys.mod

Re: How do I tell if I'm running in the PyWin interpreter?

2006-01-28 Thread Charles Krug
On 2006-01-28, Charles Krug <[EMAIL PROTECTED]> wrote: > On 2006-01-28, Peter Otten <[EMAIL PROTECTED]> wrote: >> Charles Krug wrote: >> >>> Is there a way to detect that I'm running the the PyWin interpreter so >>> that I can bypass its

Having Trouble with Scoping Rules

2006-01-30 Thread Charles Krug
File "Expensive.py", line 13, in ? print ExpensiveObject() File "Expensive.py", line 6, in ExpensiveObject if not(_expensiveObject): UnboundLocalError: local variable '_expensiveObject' referenced before assignment I obviously missed some part of the scoping rules

Re: Having Trouble with Scoping Rules

2006-01-30 Thread Charles Krug
On 2006-01-31, Farshid Lashkari <[EMAIL PROTECTED]> wrote: > You need to declare _expensiveObject as global inside your function. > Whenever you assign something to a variable that resides in the global > scope inside a function, you need to declare it as global at the > beginning of the functio

Re: Having Trouble with Scoping Rules

2006-01-31 Thread Charles Krug
On 2006-01-31, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > def ExpensiveObject(): > global _expensiveObject > if _expensiveObject is None: > _expensiveObject = "A VERY Expensive object" > print "CREATED VERY EXPENSIVE OBJECT" > return _expensiveO

Re: Costly object creation (was : Having Trouble with Scoping Rules)

2006-01-31 Thread Charles Krug
On 2006-01-31, bruno at modulix <[EMAIL PROTECTED]> wrote: > See other answers in this thread for how to solve the UnboundLocalError > problem. > > Now about your *real* problem - which is nothing new -, you may want to > read about some known solutions: > > http://en.wikipedia.org/wiki/Singleton_p

Re: Another try at Python's selfishness

2006-02-08 Thread Charles Krug
On 2006-02-08, Ben Wilson <[EMAIL PROTECTED]> wrote: > "But the point is, the current situation is not newbie-friendly (I can > tell, I am a newbie)" > > I will agree to that, as I consider myself still new. _But_, it's a > stumbling stone only briefly. Get enough nagging error messages, and > you

Re: breadth first search

2006-02-08 Thread Charles Krug
On 2006-02-08, News <[EMAIL PROTECTED]> wrote: > I am new in using Python > > Anyone know how to implement breadth first search using Python? Can Python > create list dynamically, I want to implement a program which will read data > from a file and store each line into a list, is this possible? >

Re: is there a better way?

2006-02-11 Thread Charles Krug
On 2006-02-11, Alex Martelli <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >> Problem: >> >> You have a list of unknown length, such as this: list = >> [X,X,X,O,O,O,O]. You want to extract all and only the X's. You know >> the X's are all up front and you know that

Re: Is there any books such as 'effective python' or else about the performance?

2006-02-11 Thread Charles Krug
On 2006-02-11, Kenneth Xie <[EMAIL PROTECTED]> wrote: > att, thx. A lot of the ideas discussed in Effective C++ et al are things that Python does for us already. C++ works at a much lower layer of abstraction and you need to deal explicitly with freestore for any nontrivial class. EC++ is mostly

Has anyone built a file reader for NIST IHEad?

2005-05-04 Thread Charles Krug
List: I'm playing with some image algorithms and one of the examples discusses fingerprint comparison. The NIST has fingerprint sample files for download, in NIST IHead format. Has anyone built a reader for that format? Thanks Charles -- http://mail.python.org/mailman/listinfo/p

<    1   2   3   4   >