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
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
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
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,))
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
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):
I am attempting to contribute to the h5py project by porting the code
for python-3. The code is available in a branch at github:
http://github.com/darrendale/h5py/tree/py3k . That code uses cython to
wrap the hdf5 library.
So far, only a few minor changes have been needed (relative imports,
change
On Aug 24, 4:32 pm, Thomas Jollans wrote:
> On Tuesday 24 August 2010, it occurred to Darren Dale to exclaim:
>
>
>
>
>
> > On Aug 23, 9:58 am, Darren Dale wrote:
> > > The following script runs without problems on Ubuntu and Windows 7.
> > > h5py is
On Aug 24, 4:32 pm, Thomas Jollans wrote:
> On Tuesday 24 August 2010, it occurred to Darren Dale to exclaim:
>
>
>
>
>
> > On Aug 23, 9:58 am, Darren Dale wrote:
> > > The following script runs without problems on Ubuntu and Windows 7.
> > > h5py is
On Aug 24, 5:29 pm, Benjamin Kaplan wrote:
> On Tue, Aug 24, 2010 at 3:31 PM, Darren Dale wrote:
> > On Aug 23, 9:58 am, Darren Dale wrote:
> >> The following script runs without problems on Ubuntu and Windows 7.
> >> h5py is a package wrapping the hdf5 librar
On Aug 23, 9:58 am, Darren Dale wrote:
> The following script runs without problems on Ubuntu and Windows 7.
> h5py is a package wrapping the hdf5 library (http://code.google.com/p/
> h5py/):
>
> from multiprocessing import Pool
> import h5py
>
> def update(i):
&
The following script runs without problems on Ubuntu and Windows 7.
h5py is a package wrapping the hdf5 library (http://code.google.com/p/
h5py/):
from multiprocessing import Pool
import h5py
def update(i):
print i
def f(i):
"hello foo"
return i*i
if __name__ == '__main__':
pool
On Jul 13, 9:38 am, Darren Dale wrote:
> I am learning about the python C-api in order to contribute a feature
> to numpy. I see a discussion (http://docs.python.org/extending/
> extending.html#keyword-parameters-for-extension-functions) on how to
> create a function or method in C
I am learning about the python C-api in order to contribute a feature
to numpy. I see a discussion (http://docs.python.org/extending/
extending.html#keyword-parameters-for-extension-functions) on how to
create a function or method in C that accepts kwargs, but is it
possible to call such a method
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
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
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
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
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
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
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
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:
>
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
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
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
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
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
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
GHUM wrote:
>> 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.
>
> yes. You need nothing special, just add it:
>
> class fish(object):
> pass
>
> a
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
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
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
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
[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
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
>>
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
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
I am trying to work with properties, using python 2.4.2. I can't get the
docstrings to work, can someone suggest what I'm doing wrong? I think the
following script should print "This is the doc string.", but instead it
prints:
"float(x) -> floating point number
Convert a string or number to a flo
Fredrik Lundh wrote:
> Darren Dale wrote:
>
>> If I change my script a bit, I get a different error:
>>
>> import subprocess
>> process = subprocess.Popen(['dir'])
>> stat = process.wait()
>> print process.stdout.read()
>
>> Wind
I'm a developer on the matplotlib project, and I am having trouble with the
subprocess module on windows (Python 2.4.2 on winXP). No trouble to report
with linux. I need to use _subprocess instead of pywin32, but my trouble
exists with either option:
import subprocess
process = subprocess.Popen
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
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'):
>>
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
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
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
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
> 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
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
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:
&
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
50 matches
Mail list logo