Tk and raw_input segfault

2005-05-24 Thread dale
Python newbie disclaimer on I am running an app with Tkinter screen in one thread and command-line input in another thread using raw_input(). First question - is this legal, should it run without issue? If not can you point me to a description of why. While updating objects on the screen I get

Re: ANN: Cleveland Area Python Interest Group

2005-06-03 Thread dale
Is the first meeting on June 6th, I only ask due to short notice. If so I'll be there. -- http://mail.python.org/mailman/listinfo/python-list

improving performance of python webserver running python scripts in cgi-bin

2008-01-10 Thread Dale
e of operation where the program mostly performs my python I/O functions until an HTTP request comes in, and then it breaks out of the I/O operations to handle the HTTP request. thanks Dale -- http://mail.python.org/mailman/listinfo/python-list

two brief question about abstractproperty

2011-03-12 Thread Darren Dale
I've been reading PEP 3119 and the documentation for ABCs in the python documentation. According to the PEP, the following should yield an error, because the abstract property has not been overridden: import abc class C: __metaclass__ = abc.ABCMeta @abc.abstractproperty def x(self):

Re: two brief question about abstractproperty

2011-03-12 Thread Darren Dale
On Mar 12, 11:16 pm, Darren Dale wrote: > I've been reading PEP 3119 and the documentation for ABCs in the > python documentation. According to the PEP, the following should yield > an error, because the abstract property has not been overridden: > > import abc > class

multiprocessing in subpackage on windows

2011-04-20 Thread Darren Dale
I have two really simple scripts: C:\Python27\Scripts\foo --- if __name__ == '__main__': import bar bar.main() C:\Python27\Lib\site-packages\bar.py --- from multiprocessing import Pool def task(arg): return arg def main(): pool = Pool() res = pool.apply_async(task, (3.14,))

Re: Grab metadata from images and save to file, batch mode

2016-04-01 Thread Dale Marvin
ok at exiftool <http://www.sno.phy.queensu.ca/~phil/exiftool/> There are python bindings as well <http://smarnach.github.io/pyexiftool/>. Dale -- https://mail.python.org/mailman/listinfo/python-list

Introduction

2016-04-01 Thread Dale Marvin
I just sent my first post, been using python for about 12 years to automate media production tasks. Lately I've been adding testing (Thanks Ned Batchelder: <http://nedbatchelder.com/text/test0.html>), and documentation with Sphinx/rst. Thanks Dale Marvin digital OutPos

Binding a variable?

2005-10-21 Thread Paul Dale
Hi everyone, Is it possible to bind a list member or variable to a variable such that temp = 5 list = [ temp ] temp == 6 list would show list = [ 6 ] Thanks in advance? Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Binding a variable?

2005-10-24 Thread Paul Dale
Thanks everyone for your comments and suggestions! I haven't quite decided which approach I'll take, but it's nice to have some options. Paul Tom Anderson wrote: >On Fri, 21 Oct 2005, Paul Dale wrote: > > > >>Is it possible to bind a list member or

Re: Redirect os.system output

2005-10-25 Thread Paul Dale
You might want to try python expect which gives you a very simple and scriptable interface to a process. http://pexpect.sourceforge.net/ I've been using it on windows to automate a few things. Cheers, Paul jas wrote: >Kent, > Yes, your example does work. So did os.popen...however, the pro

Re: Redirect os.system output

2005-10-25 Thread Paul Dale
in a DOS cmd shell. After that everything has worked without problem. Good luck, Paul jas wrote: >Paul, > I did ceck out the PExpect, however, I thought it was not ported for >Windows. Did you find a ported version? If not, what did you have to >do to be able to use it? > &

Re: xml.dom.minidom - parseString - How to avoid ExpatError?

2005-10-28 Thread Paul Dale
Hi Greg, Not really an answer to your question but I've found 4Suite ( http://4suite.org/index.xhtml ) quite useful for my XML work and the articles linked to from there authored by Uche Ogbuji to be quite informative. Best, Paul Gregory Piñero wrote: > Thanks, John. That was all very hel

Tkinter problem

2005-10-31 Thread dale cooper
Hi everybody! I've recently installed python2.4.2 on Fedora 4 (from downloaded sources), but it appeared, that I can't use Tkinter module: >>> import Tkinter Traceback (most recent call last): File "", line 1, in ? File "/usr/local/lib/python2.4/lib-tk/Tkinter.py", line 38, in ? import _tk

Re: Tkinter problem

2005-10-31 Thread dale cooper
Thanks, but I've got another question: can't find Tcl configuration script "tclConfig.sh" This is what I received trying to install TkBLT. What is tclConfig.sh? I did installed tcl/tk 8.4.9-3 as I mentioned before, I tried to find this file, but I don't have it in my filesystem. How to get it? -

Re: Tkinter problem

2005-11-01 Thread dale cooper
Thanks! At this moment I can see the first python generated Tk window on my screen. It's great ;-))) -- http://mail.python.org/mailman/listinfo/python-list

command line reports

2005-08-11 Thread Darren Dale
Is there a module somewhere that intelligently deals with reports to the command line? I would like to report the progress of some pretty lengthy simulations, and currently I have the new reports written on a new line rather rather than overwriting the previous report. Thanks, Darren -- http://ma

Re: command line reports

2005-08-11 Thread Darren Dale
Peter Hansen wrote: > Darren Dale wrote: >> Is there a module somewhere that intelligently deals with reports to the >> command line? I would like to report the progress of some pretty lengthy >> simulations, and currently I have the new reports written on a new line

Re: command line reports

2005-08-11 Thread Darren Dale
Bengt Richter wrote: > On Thu, 11 Aug 2005 15:43:23 -0400, Darren Dale <[EMAIL PROTECTED]> wrote: > >>Peter Hansen wrote: >> >>> Darren Dale wrote: >>>> Is there a module somewhere that intelligently deals with reports to >>>> the command

Re: up to date books?

2005-08-18 Thread Paul Dale
I highly recommend the "Safari" library service from Oreilly ( http://safari.oreilly.com ) you can check out all of the books listed below and about 10,000 more. The library contains much more than just Oreilly's books, but they are, of course, all in there. The first 2 weeks is free after tha

Nested Regex Conditionals

2005-08-23 Thread Paul Dale
Hi All, I know that several of you will probably want to reply "you should write a parser", and I may. For that matter any tips on theory in that direction would be appreciated. However, if you would indulge me in my regex question I would also be most grateful. I'm writing an edi parser and

Re: Should I move to Amsterdam?

2005-08-25 Thread Paul Dale
>But yes, the Netherlands is a highly civilised country - up there with >Denmark and Canada, and above the UK, France or Germany, IMNERHO. I'm not >going to bother comparing it to the US! > > How strange that you put Canada so high on your list. -- http://mail.python.org/mailman/listinfo/pyth

How to tell if an exception has been caught ( from inside the exception )?

2005-09-22 Thread Paul Dale
Hi everyone, I'm writing an exception that will open a trouble ticket for certain events. Things like network failure. I thought I would like to have it only open a ticket if the exception is not caught. Is there a way to do this inside the Exception? As far as I can see there are only two eve

function namespaces

2005-03-08 Thread Darren Dale
Hi, I have a variable saved in a file like this #contents of myfile.py: testvar = [1,2,3,4] and I am trying to write a function that does something like this: def myfunction(filename): execfile(filename) print testvar The problem I am running into is that the global name testva

Re: function namespaces

2005-03-08 Thread Darren Dale
> Generally, I avoid execfile within a function. What's your use case? > There may be a better way to approach this problem... I am writing a simulation that loads some predefined constants, depending on the options called by the user. I originally had it set up to parse the file, and load the c

question on regular expressions

2004-12-03 Thread Darren Dale
I'm stuck. I'm trying to make this: file://C:%5Cfolder1%5Cfolder2%5Cmydoc1.pdf,file://C %5Cfolderx%5Cfoldery%5Cmydoc2.pdf (no linebreaks) look like this: ./mydoc1.pdf,./mydoc2.pdf my regular expression abilities are dismal. I won't list all the unsuccessful things I've tried, in a nutshell, the

Re: question on regular expressions

2004-12-03 Thread Darren Dale
Michael Fuhr wrote: > Darren Dale <[EMAIL PROTECTED]> writes: > >> I'm stuck. I'm trying to make this: >> >> file://C:%5Cfolder1%5Cfolder2%5Cmydoc1.pdf,file://C >> %5Cfolderx%5Cfoldery%5Cmydoc2.pdf >> >> (no linebreaks) look like this: &

WeakValueDict and threadsafety

2011-12-10 Thread Darren Dale
I am using a WeakValueDict in a way that is nearly identical to the example at the end of http://docs.python.org/library/weakref.html?highlight=weakref#example , where "an application can use objects IDs to retrieve objects that it has seen before. The IDs of the objects can then be used in other

Re: WeakValueDict and threadsafety

2011-12-10 Thread Darren Dale
On Dec 10, 11:19 am, Duncan Booth wrote: > Darren Dale wrote: > > I'm concerned that this is not actually thread-safe. When I no longer > > hold strong references to an instance of data, at some point the > > garbage collector will kick in and remove that entry from

Re: WeakValueDict and threadsafety

2011-12-10 Thread Darren Dale
On Dec 10, 2:09 pm, Duncan Booth wrote: > Darren Dale wrote: > > On Dec 10, 11:19 am, Duncan Booth > > wrote: > >> Darren Dale wrote: > > def get_data(oid): > >     with reglock: > >         data = registry.get(oid, None) > >         if da

how to test for a dependency

2006-01-09 Thread Darren Dale
Hello, I would like to test that latex is installed on a windows, mac or linux machine. What is the best way to do this? This should work: if os.system('latex -v'): print 'please install latex' but I dont actually want the latex version information to print to screen. I tried redirecting sys

Re: how to test for a dependency

2006-01-09 Thread Darren Dale
Dennis Benzinger wrote: > Darren Dale schrieb: >> Hello, >> >> I would like to test that latex is installed on a windows, mac or linux >> machine. What is the best way to do this? This should work: >> >> if os.system('latex -v'): >>

Re: how to test for a dependency

2006-01-09 Thread Darren Dale
Sybren Stuvel wrote: > Darren Dale enlightened us with: >> I would like to test that latex is installed on a windows, mac or linux >> machine. What is the best way to do this? This should work: >> >> if os.system('latex -v'): >> print 'please

More on Tk event_generate and threads

2006-07-11 Thread Dale Huffman
There have been a number of posts about calling gui methods from other threads. Eric Brunel. has reccommended calling the gui's .event_generate method with data passed thru a queue. This worked great for me until trying to write to the gui from multiple threads. There I had problems: random types

Re: what are you using python language for?

2006-06-07 Thread Dale Huffman
hacker1017 wrote: > im just asking out of curiosity. Embedded control system -- http://mail.python.org/mailman/listinfo/python-list

Re: languages with full unicode support

2006-07-05 Thread Dale King
racters outside of ASCII. I don't think it is implementation defined. I believe it is actually required by the spec. The trouble is that so few compilers actually comply with the spec. A few years ago I asked for someone to actually point to a fully compliant compiler and no one could. -- Dale King -- http://mail.python.org/mailman/listinfo/python-list

Re: prime number

2005-05-30 Thread Dale Hagglund
e of Eratosthenes, named for its ancient Greek discoverer. You can find a description of the Sieve in many places on the web. Trying to implement it might be a good next step. Dale. -- http://mail.python.org/mailman/listinfo/python-list

Re: prime number

2005-05-30 Thread Dale Hagglund
Sigh ... one of my intermediate versions of is_prime() returns True if the n is *not* prime, and false otherwise. The final version is correct, though. Dale. -- http://mail.python.org/mailman/listinfo/python-list

Re: What are OOP's Jargons and Complexities?

2005-05-31 Thread Dale King
code to compile without error. Usually those errors were the programmers fault for trying to play fast and loose with data. But once you got it to compile it nearly always worked. -- Dale King -- http://mail.python.org/mailman/listinfo/python-list

Re: What are OOP's Jargons and Complexities?

2005-06-04 Thread Dale King
Anno Siegel wrote: > Tassilo v. Parseval <[EMAIL PROTECTED]> wrote in comp.lang.perl.misc: > >>Also sprach Dale King: >> >> >>>David Formosa (aka ? the Platypus) wrote: >>> >>>>On Tue, 24 May 2005 09:16:02 +0200, Tassilo v. Parseval &g

python style guide inconsistencies

2007-04-22 Thread Darren Dale
I was just searching for some guidance on how to name packages and modules, and discovered some inconsistencies on the www.python.org. http://www.python.org/doc/essays/styleguide.html says "Module names can be either MixedCase or lowercase." That page also refers to PEP 8 at http://www.python.org/d

Re: python style guide inconsistencies

2007-04-23 Thread Darren Dale
Bjoern Schliessmann wrote: > Darren Dale wrote: > >> I was just searching for some guidance on how to name packages and >> modules, and discovered some inconsistencies on the >> www.python.org. http://www.python.org/doc/essays/styleguide.html >> says "Modu

string formatting: engineering notation

2007-03-14 Thread Darren Dale
Does anyone know if it is possible to represent a number as a string with engineering notation (like scientific notation, but with 10 raised to multiples of 3: 120e3, 12e-6, etc.). I know this is possible with the decimal.Decimal class, but repeatedly instantiating Decimals is inefficient for my ap

question about class methods

2007-03-14 Thread Darren Dale
I've run across some code in a class method that I don't understand: def example(self, val=0) if val and not self: if self._exp < 0 and self._exp >= -6: I am unfamiliar with some concepts here: 1) Under what circumstances would "if not self" be True? 2) If "not self" is

Re: string formatting: engineering notation

2007-03-14 Thread Darren Dale
Steve Holden wrote: > Darren Dale wrote: >> Does anyone know if it is possible to represent a number as a string with >> engineering notation (like scientific notation, but with 10 raised to >> multiples of 3: 120e3, 12e-6, etc.). I know this is possible with the >>

Re: string formatting: engineering notation

2007-03-14 Thread Darren Dale
[EMAIL PROTECTED] wrote: > On Mar 14, 1:14 pm, Darren Dale <[EMAIL PROTECTED]> wrote: >> Does anyone know if it is possible to represent a number as a string with >> engineering notation (like scientific notation, but with 10 raised to >> multiples of 3: 120e3, 1

python webserver question

2007-12-17 Thread dale bryan
uld point me in the right direction? thx Dale-- http://mail.python.org/mailman/listinfo/python-list

Re: Tabs versus Spaces in Source Code

2006-05-16 Thread Dale King
however is Sun's mixture of the two. -- Dale King -- http://mail.python.org/mailman/listinfo/python-list

Re: John Bokma harassment

2006-05-25 Thread Dale King
Therefore you do not have the "right" to do what you want with Usenet. You have a responsibility to use Usenet in a way that benefits the group as a whole (e.g. asking interesting questions that educate others). -- Dale King -- http://mail.python.org/mailman/listinfo/python-list

what gives with "'import *' not allowed with 'from .'"?

2009-01-22 Thread Darren Dale
I know the use of "from foo import *" is discouraged, but I'm writing a package that I hope others may want to integrate as a subpackage of their own projects, I know what I'm doing, and I want to use the "from .bar import *" syntax internally. It works fine with python-2.6, but with python-2.5 I g

Re: what gives with

2009-01-23 Thread Darren Dale
On Jan 22, 10:07 pm, Benjamin Peterson wrote: > Darren Dale gmail.com> writes: > > > Judging fromhttp://bugs.python.org/issue2400, this issue > > was fixed back in May 2008, but it is still present with python-2.5.4, > > which was released in December. Why wont py

how to assert that method accepts specific types

2009-02-20 Thread Darren Dale
I would like to assert that a method accepts certain types. I have a short example that works: from functools import wraps def accepts(*types): def check_accepts(f): @wraps(f) def new_f(self, other): assert isinstance(other, types), \ "arg %r does n

Re: how to assert that method accepts specific types

2009-02-20 Thread Darren Dale
On Feb 20, 8:20 pm, Chris Rebert wrote: > On Fri, Feb 20, 2009 at 5:12 PM, Darren Dale wrote: > > I would like to assert that a method accepts certain types. I have a > > short example that works: > > > from functools import wraps > > > def accepts(*t

Re: Finding the instance reference of an object

2008-10-27 Thread Dale Roberts
f a reference/pointer to some other memory/object/array. In C, we would say that the VALUE of that variable is the memory address of another object. But you can, if you need to, get the address of the pointer variable, which points to the *address* of the other object. In Python, a variable is ONLY EVER a reference to an object. You cannot get the address of a Python variable, only of a Python object. Hope this clears things up. dale -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the instance reference of an object

2008-10-27 Thread Dale Roberts
asses. An assignment in Python binds a variable name to an object. The internal "value" of the variable is the memory address of an object, and can be seen with id(var), but is rarely needed in practice. The "value" that gets passed in a Python function call is

Re: Finding the instance reference of an object

2008-10-28 Thread Dale Roberts
On Oct 28, 2:33 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 28 Oct 2008 01:16:04 -0200, Dale Roberts <[EMAIL PROTECTED]>   > escribió: > > > > > So, then, what to tell a C++ programmer about how Python passes   > > arguments?

Re: Finding the instance reference of an object

2008-10-28 Thread Dale Roberts
t... And when they tell their friend that Joe The Programmer said it's Pass By Value, your additional context may not be present any longer, and the friend will be very confused. In my opinion, best just to head it off and call it something different so as not to confuse. dale -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the instance reference of an object

2008-10-29 Thread Dale Roberts
plain and simple. Pass By Reference? So "postmodern". Who needs it. Show me a so-called "reference". I've looked at the assembler output and have never seen one. There is no such thing. "The continued attempts to obfuscate this is pointless and wrong." --- I hate to have to add this, but for those not paying close attention: ;-) dale (tongue back out of cheek now) -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the instance reference of an object

2008-10-30 Thread Dale Roberts
ust for fun I did look at the assembler output, and, indeed, the output for examples 1 and 3 is absolutely identical. They are the same thing, as far as the CPU is concerned. Would you give them different names? dale -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the instance reference of an object

2008-10-30 Thread Dale Roberts
d within Python variables). But Python, unlike Java or most other commonly used languages, can ONLY EVER pass an object reference, and never an actual value I care about, and I think that idiom deserves a different name which distinguishes it from the commonly accepted notion of Pass By Value. Thanks for

Re: Finding the instance reference of an object

2008-10-30 Thread Dale Roberts
On Oct 30, 3:06 pm, Dale Roberts <[EMAIL PROTECTED]> wrote: > ... that idiom deserves a different name which > distinguishes it from the commonly accepted notion of Pass By Value. Bah, what I meant to end with was: Just as the Pass By Reference idiom deserves a unique name to disting

Re: Finding the instance reference of an object

2008-10-31 Thread Dale Roberts
On Oct 31, 3:15 am, greg <[EMAIL PROTECTED]> wrote: > Dale Roberts wrote: > > Just as the Pass By Reference idiom deserves a unique name to > > distinguish it from Pass By Value (even though it is often Pass By > > (address) Value internally), so Pass By Object Reference

Re: Finding the instance reference of an object

2008-10-31 Thread Dale Roberts
On Oct 31, 2:27 am, greg <[EMAIL PROTECTED]> wrote: > Dale Roberts wrote: > > Are you > > saying that C++ is capable of using the Call By Reference idiom, but C > > is not, because C does not have a reference designation for formal > > function parameters? >

question about ctrl-d and atexit with threads

2009-03-05 Thread Darren Dale
I have a function that stops execution of a thread, and this function is registered with atexit.register. A simple example module is included at the end of this post, say its called test.py. If I do the following in the interactive interpreter, the thread stops executing as I hoped: >>> from test

Re: question about ctrl-d and atexit with threads

2009-03-05 Thread Darren Dale
Actually, this problem can also be seen by running this code as a script, it hangs up if the sys.exit lines are commented, and exits normally if uncommented. import atexit import threading import time class MyThread(threading.Thread): def __init__(self): threading.Thread.__init__(se

Re: question about ctrl-d and atexit with threads

2009-03-05 Thread Darren Dale
On Mar 5, 12:02 pm, s...@pobox.com wrote: > What happens if you simply call > >     my_thread.setDaemon(True) > > (or in Python 2.6): > >     my_thread.daemon = True > > ?  That is the documented way to exit worker threads when you want the > application to exit.  From the threading module docs: >

Re: question about ctrl-d and atexit with threads

2009-03-06 Thread Darren Dale
On Mar 5, 6:27 pm, "Gabriel Genellina" wrote: > En Thu, 05 Mar 2009 15:26:18 -0200, Darren Dale   > escribió: > > > > > On Mar 5, 12:02 pm, s...@pobox.com wrote: > >> What happens if you simply call > > >>     my_thread.setDaemon(True) &g

Re: question about ctrl-d and atexit with threads

2009-03-06 Thread Darren Dale
On Mar 5, 6:27 pm, "Gabriel Genellina" wrote: > En Thu, 05 Mar 2009 15:26:18 -0200, Darren Dale   > escribió: > > > > > On Mar 5, 12:02 pm, s...@pobox.com wrote: > >> What happens if you simply call > > >>     my_thread.setDaemon(True) &g

Re: question about ctrl-d and atexit with threads

2009-03-06 Thread Darren Dale
On Mar 6, 1:32 pm, rdmur...@bitdance.com wrote: > Darren Dale wrote: > >On Mar 5, 6:27 pm, "Gabriel Genellina" wrote: > >> En Thu, 05 Mar 2009 15:26:18 -0200, Darren Dale > >> escribi : > > >> > On Mar 5, 12:02 pm, s...@pobo

Unix programmers and Idle

2009-03-30 Thread Dale Amon
I wonder if someone could point me at documentation on how to debug some of the standard Unix type things in Idle. I cannot seem to figure out how to set my argument line for the program I am debugging in an Idle window. for example: vlmdeckcheck.py --strict --debug file.dat There must b

Re: Unix programmers and Idle

2009-03-30 Thread Dale Amon
On Mon, Mar 30, 2009 at 08:11:10PM -0500, Dave Angel wrote: > I don't know what Idle has to do with it. sys.args contains the command > line arguments used to start a script. > > Dale Amon wrote: >> I wonder if someone could point me at documentation on how to debug

Re: Unix programmers and Idle

2009-03-30 Thread Dale Amon
On Mon, Mar 30, 2009 at 09:47:24PM -0500, Dave Angel wrote: > See http://docs.python.org/library/idle.html and search for command line > > According to that page (for Python 2.6.1), you can set those parameters > on the command line that starts IDLE itself. > > I haven't tried it yet, as I'm u

Re: Unix programmers and Idle

2009-04-03 Thread Dale Amon
On Mon, Mar 30, 2009 at 10:54:56PM -0700, Niklas Norrthon wrote: > I make sure my scripts are on the form: > > # imports > # global initialization (not depending on sys.argv) > def main(): > # initialization (might depend on sys.argv) > # script logic > # other functions > if __name__ == '

Re: Unix programmers and Idle

2009-04-03 Thread Dale Amon
Just in case anyone else finds it useful, to be precise I use: if opts.man: p1 = Popen(["echo", __doc__], stdout=PIPE) p2 = Popen(["pod2man"], stdin=p1.stdout, stdout=PIPE) p3 = Popen(["nroff","-man"], stdin=p2.stdout, stdout=PIPE) output = p3.co

Computed attribute names

2009-04-08 Thread Dale Amon
There are a number of things which I have been used to doing in other OO languages which I have not yet figured out how to do in Python, the most important of which is passing method names as args and inserting them into method calls. Here are two cases I have been trying to figure out for a curren

Re: Computed attribute names

2009-04-08 Thread Dale Amon
On Wed, Apr 08, 2009 at 09:03:00PM +0200, paul wrote: > I'd say you can use: Thanks. I could hardly ask for a faster response on a HowTo than this! signature.asc Description: Digital signature -- http://mail.python.org/mailman/listinfo/python-list

regexp strangeness

2009-04-09 Thread Dale Amon
This finds nothing: import re import string card = "abcdef" DEC029 = re.compile("[^&0-9A-Z/ $*,.\-:#@'=\"[<(+\^!);\\\]%_>?]") errs = DEC029.findall(card.strip("\n\r")) print errs This works correctly: import re import string card = "abcdef" DEC029 = re.compile("[^&0-9A-

design question, metaclasses?

2009-04-11 Thread Darren Dale
I am working on a project that provides a high level interface to hdf5 files by implementing a thin wrapper around h5py. I would like to generalize the project so the same API can be used with other formats, like netcdf or ascii files. The format specific code exists in File, Group and Dataset clas

Re: design question, metaclasses?

2009-04-12 Thread Darren Dale
On Apr 11, 2:15 pm, Darren Dale wrote: > I am working on a project that provides a high level interface to hdf5 > files by implementing a thin wrapper around h5py. I would like to > generalize the project so the same API can be used with other formats, > like netcdf or ascii files

Re: design question, metaclasses?

2009-04-12 Thread Darren Dale
On Apr 12, 3:23 pm, Aaron Brady wrote: > On Apr 12, 1:30 pm, Darren Dale wrote: > > > > > On Apr 11, 2:15 pm, Darren Dale wrote: > > _ > > > > format1.Group # implementation of group in format1 > > > format2.Group # ... > > > Base.DerivedGro

Re: design question, metaclasses?

2009-04-12 Thread Darren Dale
On Apr 12, 4:50 pm, Kay Schluehr wrote: > On 11 Apr., 20:15, Darren Dale wrote: > > > I am working on a project that provides a high level interface to hdf5 > > files by implementing a thin wrapper around h5py. > > I would like to > > generalize the project so the s

Re: any(), all() and empty iterable

2009-04-16 Thread Dale Roberts
the intended audience: programmers, who like to make sure all bases and cases are covered. dale -- http://mail.python.org/mailman/listinfo/python-list

Re: any(), all() and empty iterable

2009-04-16 Thread Dale Roberts
> an empty iterable. > > as one of the instigators in this thread, I'm +1 on this solution. Yes, I now appreciate the motivation for having the word "all" in the text, and simply adding something like "or the iterable is empty" might head off future confusion. dale -- http://mail.python.org/mailman/listinfo/python-list

send() to a generator in a "for" loop with continue(val)??

2009-04-17 Thread Dale Roberts
e from the idea of a "co- routine" style generator (where send() is used). Maybe combining the two idioms in this way would cause confusion? What do folks think? dale -- http://mail.python.org/mailman/listinfo/python-list

Re: send() to a generator in a "for" loop with continue(val)??

2009-04-19 Thread Dale Roberts
nt. I'd made a modified version of my generator that was "for loop aware" and had two yields in it, but this seemed very fragile and hackish to me, and left my generator only usable inside a "for" loop. The wrapper method seems to be a much better way to go. dale -- http://mail.python.org/mailman/listinfo/python-list

Re: send() to a generator in a "for" loop with continue(val)??

2009-04-19 Thread Dale Roberts
contained to just the few routines that make up the state machine. It works very well, makes it easy to implement the state machine clearly, and is easy to understand and maintain. I can see where it could get very confusing to use this mechanism in a more general way. dale -- http://mail.python.org/mailman/listinfo/python-list

import and package confusion

2009-04-29 Thread Dale Amon
I am going around in circles right now and have to admit I do not understand what is going on with import of hierarchical packages/modules. Perhaps someone can get me on the road again. Here is a subset of what I am trying to accomplish: The package directory set up: VLMLegacy/

Re: import and package confusion

2009-04-29 Thread Dale Amon
I am trying to get to the heart of what it is I am missing. Is it the case that if you have a module C in a package A: A.C that there is no way to load it such that you can use: x = A.C() in your code? This is just a simpler case of what I'm trying to do now, which has a module

Re: import and package confusion

2009-04-29 Thread Dale Amon
On Wed, Apr 29, 2009 at 01:12:33PM -0700, Scott David Daniels wrote: > Dale Amon wrote: >> I am trying to get to the heart of what it is I am >> missing. Is it the case that if you have a module C in a package A: >> A.C >> that there is no way to load it such that y

Re: import and package confusion

2009-04-29 Thread Dale Amon
On Wed, Apr 29, 2009 at 04:34:03PM -0400, Dale Amon wrote: > type = "VLM4997" > type.Header(args) > type.Plan(args) > type.Conditions(args) > Where the type might change from execution to execution > or even on different iterations. Actually l

Re: import and package confusion

2009-04-29 Thread Dale Amon
On Wed, Apr 29, 2009 at 03:06:13PM -0700, Scott David Daniels wrote: > You did not answer the question above, and I think the answer is the root > of your misunderstanding. A class and a module are _not_the_same_thing_. > sys is not a package, it is a module. >>> Just because you put a class insid

Re: import and package confusion

2009-04-29 Thread Dale Amon
Well, I've managed to get close to what I want, and just so you can see: #!/usr/bin/python import sys sys.path.extend (['../lib', '../bin']) from VLMLegacy.CardReader import CardReader rdr = CardReader ("../example/B767.dat","PRINTABLE") iotypes = ["WINGTL","VLMPC","VLM4997"] for iotype in

Re: import and package confusion

2009-04-29 Thread Dale Amon
On Wed, Apr 29, 2009 at 04:06:23PM -0700, Scott David Daniels wrote: > Dale Amon wrote: >> >> The point I take away from this is that packages and >> modules have dotted names, but Classes do not and there >> is no way to do exactly what I wanted to do. > Nope.

Re: Re: import and package confusion

2009-04-29 Thread Dale Amon
On Wed, Apr 29, 2009 at 10:02:46PM -0400, Dave Angel wrote: > The dot syntax works very > predictably, and quite flexibly. The problem was that by using the same > name for module and class, you didn't realize you needed to include both. It is one of the hazards of working in many very differ

Re: import and package confusion

2009-04-30 Thread Dale Amon
On Thu, Apr 30, 2009 at 08:32:31AM +0200, Jeroen Ruigrok van der Werven wrote: -On [20090430 02:21], Dale Amon (a...@vnl.com) wrote: >>import sys >>sys.path.extend (['../lib', '../bin']) >> >>from VLMLegacy.CardReader import CardReader >>

Re: import and package confusion

2009-04-30 Thread Dale Amon
On Thu, Apr 30, 2009 at 02:38:03AM -0400, Dave Angel wrote: > As Scott David Daniels says, you have two built-in choices, depending on > Python version. If you can use __import__(), then realize that > mod = __import__("WINGTL") > > will do an import, using a string as the import name. I do

Re: import and package confusion

2009-04-30 Thread Dale Amon
On Thu, Apr 30, 2009 at 04:33:57AM -0300, Gabriel Genellina wrote: > En Thu, 30 Apr 2009 03:04:40 -0300, alex23 escribió: >> Are you familiar with __import__? >> >> iotypes = ["WINGTL","VLMPC","VLM4997"] >> for iotype in iotypes: >> packagename = "VLMLegacy." + iotype + ".Conditions" >> classn

Re: import and package confusion

2009-04-30 Thread Dale Amon
Gabriel gave me the key to a fine solution, so just to put a bow tie on this thread: #!/usr/bin/python import sys sys.path.extend (['../lib', '../bin']) from VLMLegacy.CardReader import CardReader rdr = CardReader ("../example/B767.dat","PRINTABLE") iotypes = ["WINGTL","VLMPC","VLM4997"] fo

windows installers and license agreement

2008-06-29 Thread Darren Dale
Is it possible to create a windows installer using distutils that includes a prompt for the user to agree to the terms of the license? Thanks, Darren -- http://mail.python.org/mailman/listinfo/python-list

is it possible to add a property to an instance?

2008-07-22 Thread Darren Dale
Does anyone know if it is possible to add a property to an instance at runtime? I didn't see anything about it in the standard library's new module, google hasn't turned up much either. Thanks, Darren -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >