Re: RE Module Performance

2013-07-25 Thread Jeremy Sanders
wxjmfa...@gmail.com wrote: > Short example. Writing an editor with something like the > FSR is simply impossible (properly). http://www.gnu.org/software/emacs/manual/html_node/elisp/Text-Representations.html#Text-Representations "To conserve memory, Emacs does not hold fixed-length 22-bit number

Re: interactive plots

2011-07-06 Thread Jeremy Sanders
Mihai Badoiu wrote: > How do I do interactive plots in python? Say I have to plot f(x) and g(x) > and I want in the plot to be able to click on f and make it disappear. > Any python library that does this? You could try veusz, which is a python module and plotting program combined. You can als

Re: Classes derived from dict and eval

2005-09-22 Thread Jeremy Sanders
On Tue, 20 Sep 2005 13:59:50 -0700, Robert Kern wrote: > globals needs to be a real dictionary. The implementation uses the C > API, it doesn't use the overridden __getitem__. The locals argument, > apparently can be some other kind of mapping. It seems that on Python 2.3 then neither globals or

Wrapping classes

2005-09-22 Thread Jeremy Sanders
Is it possible to implement some sort of "lazy" creation of objects only when the object is used, but behaving in the same way as the object? For instance: class Foo: def __init__(self, val): """This is really slow.""" self.num = val # this doesn't call Foo.__init__ yet a = lazyclass(F

Re: Wrapping classes

2005-09-23 Thread Jeremy Sanders
nd on each other, and the easiest way to get the evaluation order correct is to only evaluate them when they're used. An alternative way is to do some string processing to replace a with computearray("a") in the expression or something horrible like that. Thanks Jeremy -- J

Re: Wrapping classes

2005-09-23 Thread Jeremy Sanders
tunately it needs Python 2.4, and I can't rely on my users having that. Traceback (most recent call last): File "test.py", line 15, in ? print eval("10 * a + b", globals(), l) TypeError: eval() argument 3 must be dict, not Foo If you subclass dict it doesn't ca

Re: Wrapping classes

2005-09-23 Thread Jeremy Sanders
bruno modulix wrote: > Could it work with a UserDict subclass ? Unfortunately not: Traceback (most recent call last): File "test.py", line 17, in ? print eval("10 * a + b", globals(), l) TypeError: eval() argument 3 must be dict, not instance Thanks Jeremy

Re: Wrapping classes

2005-09-23 Thread Jeremy Sanders
ic application. I don't think they'd like to put () after each variable name. I could always munge the expression after the user enters it, of course. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

ANN: Veusz 0.8 released

2005-10-21 Thread Jeremy Sanders
Veusz 0.8 - Velvet Ember Under Sky Zenith - http://home.gna.org/veusz/ Veusz is Copyright (C) 2003-2005 Jeremy Sanders <[EMAIL PROTECTED]> Licenced under the GPL (version 2 or greater) Veusz is a scientific plotting package written in Python (current

Re: Scanning a file

2005-10-28 Thread Jeremy Sanders
> > Read in blocks, not byte for byte. I had good experiences with block > sizes like 4096 or 8192. It's difficult to handle overlaps. The four byte sequence may occur at the end of one block and beginning of the next. You'd need to check for these special cases. Jeremy -- J

Re: PyFLTK - an underrated gem for GUI projects

2005-11-08 Thread Jeremy Sanders
aum wrote: > But for smaller gui programs not needing the power of wx, I find I get > the job done much more quickly and effortlessly with PyFLTK. Interesting. I've found PyQt very easy to use too. I wonder how they compare (providing you can GPL your app, of course). -- Jeremy S

Re: Pylab and pyserial plot in real time

2005-11-08 Thread Jeremy Sanders
as the windowing runs in a separate thread. The main problem is that I have only really tested it on Unix, but I have reports that it "mostly" works in Windows (I'm looking into supporting this soon). http://home.gna.org/veusz/ Alternatively matplotlib may be another solution. --

Re: Using python for writing models: How to run models in restricted python mode?

2005-11-09 Thread Jeremy Sanders
e process, and use ulimit (or the resource module) to limit the memory usage. -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Using python for writing models: How to run models in restricted python mode?

2005-11-10 Thread Jeremy Sanders
ng back and forth all the time. -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: how to extract columns like awk $1 $5

2005-01-07 Thread Jeremy Sanders
On Fri, 07 Jan 2005 12:15:48 -0500, Anand S Bisen wrote: > Is there a simple way to extract words speerated by a space in python > the way i do it in awk '{print $4 $5}' . I am sure there should be some > but i dont know it. mystr = '1 2 3 4 5 6' parts = mystr.split() print parts[3:5] Jeremy

Re: simultaneous multiple requests to very simple database

2005-01-19 Thread Jeremy Sanders
On Tue, 18 Jan 2005 11:26:46 -0500, Eric S. Johansson wrote: > So the solutions that come to mind are some form of dictionary in shared > memory with locking semaphore scoreboard or a multithreaded process > containing a single database (Python native dictionary, metakit, gdbm??) > and have all of

Re: Python with no significant whitespace

2005-01-26 Thread Jeremy Sanders
On Wed, 26 Jan 2005 11:31:18 +0800, mep wrote: > Hi,all > Is there anybody trying to release a modification version to current > python source code with no significant whitespace, say replacing whitespace > by {} > like C or java. I do *NOT* mean whitespace is good or bad, just > want to know.

webbrowser.py

2005-02-02 Thread Jeremy Sanders
It occurs to me that webbrowser could be more intelligent on Linux/Unix systems. Both Gnome and KDE have default web browsers, so one could use their settings to choose the appropriate browser. I haven't been able to find a freedesktop common standard for web browser, however. Firefox now sets it

Re: Python choice of database

2005-06-21 Thread Jeremy Sanders
On Mon, 20 Jun 2005 23:42:21 -0800, EP wrote: > until my records (text - maybe 50KB average) unexpectedly blossomed into > the 10,000-1,000,000 ranges. If I or someone else (who innocently doesn't > know better) opens up one of the directories with ~150,000 files in it, > the machine's personalit

Re: User interfaces in console (dialog like)

2005-06-23 Thread Jeremy Sanders
Negroup wrote: > Do you guys know an alternative that fits my needings without moving > from Python? Turbo Vision in dos used to be really good. There's a python binding to the free version here: http://tvision.sourceforge.net/ (I haven't tried it) -- Jer

Re: Dictionary to tuple

2005-06-28 Thread Jeremy Sanders
Erik Max Francis wrote: > But it doesn't return a tuple of them. Which is what the tuple call > there does. Yes, but I think he meant: t = tuple(d.items()) -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Store multiple dictionaries in a file

2005-06-30 Thread Jeremy Sanders
epr() writes onto one line. If you're storing types without repr() representations this will not work. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Sort files by date

2005-07-12 Thread Jeremy Sanders
fargo wrote: > I'm looking for some way to sort files by date. you could do something like: l = [(os.stat(i).st_mtime, i) for i in glob.glob('*')] l.sort() files = [i[1] for i in l] Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: breaking out of nested loop

2005-07-12 Thread Jeremy Sanders
rbt wrote: > What is the appropriate way to break out of this while loop if the for > loop finds a match? queue discussion why Python doesn't have a "break N" statement... -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

ANN: Veusz 0.7 - a scientific plotting package

2005-07-24 Thread Jeremy Sanders
Veusz 0.7 - Velvet Ember Under Sky Zenith - http://home.gna.org/veusz/ Veusz is a scientific plotting package written in Python (currently 100% Python). It uses PyQt for display and user-interfaces, and numarray for handling the numeric data. Veusz is designed

Re: Psyco & Linux

2005-08-12 Thread Jeremy Sanders
st otherwise. See http://psyco.sourceforge.net/psycoguide/req.html Maybe you could recompile your python in 32 bit mode. You may find that native 64 bit python is faster than 32 bit psyco however! -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: round() wrong in Python 2.4?

2005-09-13 Thread Jeremy Sanders
;copyright", "credits" or "license" for more information. >>> 0.0225 0.022499 See http://www.python.org/doc/current/tut/node13.html#SECTION001380 If you need exact maths, then you're better off using integers or decimal arithmet

Re: round() wrong in Python 2.4?

2005-09-14 Thread Jeremy Sanders
enations. Any code which relies on a particular behaviour is broken. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Classes derived from dict and eval

2005-09-20 Thread Jeremy Sanders
Hi - I'm trying to subclass a dict which is used as the globals environment of an eval expression. For instance: class Foo(dict): def __init__(self): self.update(globals()) self['val'] = 42 def __getitem__(self, item): # this doesn't get called fr

Re: supress creation of .pyc files

2005-02-16 Thread Jeremy Sanders
On Wed, 16 Feb 2005 14:53:22 +0100, Thomas Guettler wrote: > The imported file is a config file, not a script. You could use execfile() to read the file, and not import. Jeremy -- http://mail.python.org/mailman/listinfo/python-list

Splitting strings - by iterators?

2005-02-25 Thread Jeremy Sanders
I have a large string containing lines of text separated by '\n'. I'm currently using text.splitlines(True) to break the text into lines, and I'm iterating over the resulting list. This is very slow (when using 40 lines!). Other than dumping the string to a file, and reading it back using the

Re: Splitting strings - by iterators?

2005-02-25 Thread Jeremy Sanders
On Fri, 25 Feb 2005 17:14:24 +0100, Diez B. Roggisch wrote: > Maybe [c]StringIO can be of help. I don't know if it's iterator is lazy. But > at least it has one, so you can try and see if it improves performance :) Excellent! I somehow missed that module. StringIO speeds up the iteration by a fac

Re: Splitting strings - by iterators?

2005-02-25 Thread Jeremy Sanders
On Fri, 25 Feb 2005 10:57:59 -0600, Larry Bates wrote: > How did you get the string in memory in the first place? They're actually from a generated python script, acting as a saved file format, something like: interpret(""" lots of lines """) another_command() Obviously this isn't the most effi

Re: Sorting in huge files

2004-12-08 Thread Jeremy Sanders
On Tue, 07 Dec 2004 12:27:33 -0800, Paul wrote: > I have a large database of 15GB, consisting of 10^8 entries of > approximately 100 bytes each. I devised a relatively simple key map on > my database, and I would like to order the database with respect to the > key. You won't be able to load this

High level SNMP

2004-12-09 Thread Jeremy Sanders
Hi - I'd like to write a program which basically does a few snmpgets. I haven't been able to find a python package which gives you a nice high-level and simple way of doing this (like PHP has). Everything appears to be extremely low level. All I need is SNMPv1. Does anyone know of a simple python

Re: High level SNMP

2004-12-09 Thread Jeremy Sanders
On Thu, 09 Dec 2004 15:34:14 +0200, Petri Laakso wrote: >> have you tested twistedsnmp? > http://twistedsnmp.sourceforge.net/ I looked at it, but it needs Twisted compiled and installed, which is a pain. The old versions of PySNMP (version 2.XX), seem to be a lot simpler to use than later ones,

Re: Help beautify ugly heuristic code

2004-12-09 Thread Jeremy Sanders
On Wed, 08 Dec 2004 18:38:14 -0500, Stuart D. Gathman wrote: >> Here are the last 20 (which my subjective judgement says are correct): > > 65.112.76.15usfshlxmx01.myreg.net 201.128.108.41 [snip] > 80.143.79.97p508F4F61.dip0.t-ipconnect.de DYN Looks like you could do something like look

ANN: Veusz 0.5 - a scientific plotting package

2005-04-17 Thread Jeremy Sanders
Veusz 0.5 - Velvet Ember Under Sky Zenith - http://home.gna.org/veusz/ Veusz is Copyright (C) 2003-2005 Jeremy Sanders <[EMAIL PROTECTED]> Licenced under the GPL (version 2 or greater) Veusz is a scientific plotting package written in Python (current

Re: ANN: Veusz 0.5 - a scientific plotting package

2005-04-18 Thread Jeremy Sanders
On Mon, 18 Apr 2005 00:55:17 -0700, hemanth wrote: > Why not matplotlib? Of late, it has seemed to have picked up a lot of > attention. I would prefer that the different plotting packages developers > join hands and implement missing features into a single plotting package > and make this a part o

Re: ANN: Veusz 0.5 - a scientific plotting package

2005-04-19 Thread Jeremy Sanders
On Mon, 18 Apr 2005 13:40:09 -0700, jdh2358 wrote: > I'll start by saying that I for one won't criticize you for rolling you > own plotting package rather than join forces with an existing project. > I've been accused of the same, on more than one occasion :-) But I'm also > aware of the problem

Re: squeeze out some performance

2013-12-06 Thread Jeremy Sanders
Robert Voigtländer wrote: > I try to squeeze out some performance of the code pasted on the link > below. http://pastebin.com/gMnqprST > > The code will be used to continuously analyze sonar sensor data. I set > this up to calculate all coordinates in a sonar cone without heavy use of > trigonome

Re: GUI:-please answer want to learn GUI programming in python , how should i proceed.

2013-12-16 Thread Jeremy Sanders
Michael Torrie wrote: > I think PyQt is slowly being pushed aside in favor of PySide, which is > more license-friendly for use in closed or open projects. I would > recommend using PySide unless PyQt is a requirement for your project. That's not the impression I get from the PySide mailing lists

Re: Python, C++ interaction

2014-12-04 Thread Jeremy Sanders
Michael Kreim wrote: > What are you using to wrap C++ classes for Python? I'm using SIP, as it fits nicely with my PyQt user interface. http://www.riverbankcomputing.com/software/sip/intro It's a pretty flexible and fast way of wrapping C++ and C. If you want to pass numpy arrays and such, it

Re: checking if two things do not equal None

2014-03-31 Thread Jeremy Sanders
contact.tri...@gmail.com wrote: > if (a, b) != (None, None): > or > if a != None != b: > > Preference? Pros? Cons? Alternatives? I couldn't see anyone else give this, but I like if None not in (a, b): pass Jeremy -- https://mail.python.org/mailman/listinfo/python-list

Re: semicolon at end of python's statements

2013-09-05 Thread Jeremy Sanders
Chris Angelico wrote: > Because s/he thought it made for better code, or as a joke? Usually I > see this sort of thing as the latter... http://oldhome.schmorp.de/marc/bournegol.html http://utcc.utoronto.ca/~cks/space/blog/programming/BourneGol Jeremy -- https://mail.python.org/mailman/listinf

Re: Multiple scripts versus single multi-threaded script

2013-10-04 Thread Jeremy Sanders
Roy Smith wrote: > Threads are lighter-weight. That means it's faster to start a new > thread (compared to starting a new process), and a thread consumes fewer > system resources than a process. If you have lots of short-lived tasks > to run, this can be significant. If each task will run for a

Re: Python Random vs. Cython C Rand for Dice Rolls

2015-06-08 Thread Jeremy Sanders
C.D. Reimer wrote: > Is there something in the Cython code that I need to change and/or find > a better C random number generator? This may not be helpful, but numpy is pretty helpful for this sort of thing: import numpy import numpy.random a=numpy.random.randint(1,6,5000) b=numpy.random.ra

Re: A new module for performing tail-call elimination

2015-07-16 Thread Jeremy Sanders
Robin Becker wrote: > I believe the classic answer is Ackermann's function > > http://demonstrations.wolfram.com/RecursionInTheAckermannFunction/ > > which is said to be not "primitive recursive" ie cannot be unwound into > loops; not sure whether that implies it has to be recursively defined or

Re: Optimizing if statement check over a numpy value

2015-07-23 Thread Jeremy Sanders
Heli Nix wrote: > Is there any way that I can optimize this if statement. Array processing is much faster in numpy. Maybe this is close to what you want import numpy as N # input data vals = N.array([42, 1, 5, 3.14, 53, 1, 12, 11, 1]) # list of items to exclude exclude = [1] # convert to a bool

ANN: Veusz 0.9, a scientific plotting package

2006-01-20 Thread Jeremy Sanders
Veusz 0.9 - Velvet Ember Under Sky Zenith - http://home.gna.org/veusz/ Veusz is Copyright (C) 2003-2006 Jeremy Sanders <[EMAIL PROTECTED]> Licenced under the GPL (version 2 or greater) Veusz is a scientific plotting package written in Python. It uses Py

Re: How to have application-wide global objects

2006-07-13 Thread Jeremy Sanders
sn't create new objects, so that's not very likely. can you > post some code so we don't have to guess what you've tried and not ? It does if you mess around with sys.path between doing two imports of the same thing (at least I found out the hard way on Python 2.4). I'm

Re: How to have application-wide global objects

2006-07-14 Thread Jeremy Sanders
ported twice, once as foo.bar and secondly as bar. The value of 42 in myvar does not get retained, as there are two copies of the module imported. -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: How to have application-wide global objects

2006-07-14 Thread Jeremy Sanders
ike "Details of the module searching and loading process are implementation and platform specific". The results can be a little suprising! It would be include a check so that you could get a warning with debugging switched on. -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: pyqt scrollview layout

2006-07-21 Thread Jeremy Sanders
//www.informatik.uni-freiburg.de/~steffenh/premiselist.{html|py} You should ask on the PyQt mailing list - you're much more likely to get an answer. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested function scope problem

2006-07-27 Thread Jeremy Sanders
tok = [''] def inner(): tok[0] += 'hi' ... tok[0] = 'foo' inner() print tok[0] -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Small Troll on notation of variables over time

2006-08-21 Thread Jeremy Sanders
val): self.vals.append(val) a = Hist() a.set(5) print a() a.set('hi there') print a() print a(-2) Which prints 5 hi there 5 -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and STL efficiency

2006-08-21 Thread Jeremy Sanders
const string foo = "What do you know?"; for (long int i=0; i<1 ; ++i){    a.push_back(foo); ... } as many C++ implementations use reference counting for identical strings. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and STL efficiency

2006-08-22 Thread Jeremy Sanders
7:~> ./a.out What do you know? chicken crosses road fool so long... What do you know? chicken crosses road fool so long... Elapsed 2.11 Elapsed 1.11 (This is with an Althon 64 4600+ running Linux). Unfortunately the Python on this computer doesn't have set as it is too old, so I can't

Python 123 introduction

2006-10-30 Thread Jeremy Sanders
http://www-xray.ast.cam.ac.uk/~jss/lecture/computing/notes/out/python_123.pdf LaTeX source: http://www-xray.ast.cam.ac.uk/~jss/lecture/computing/notes/out/python_123.tex Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 123 introduction

2006-10-30 Thread Jeremy Sanders
needs a bit of cleaning up as it assumes things such as python being in /usr/local/bin... I may try to improve this later. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 123 introduction

2006-10-30 Thread Jeremy Sanders
quick 2 hour course for people to work through. It overlaps quite a bit with the tutorial, but I tried to minimise any detail. I just publicised it in case anybody wanted something similar. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Plot pkg - Multiple Y axes?

2006-11-07 Thread Jeremy Sanders
http://home.gna.org/veusz/ You can have any number of y-axes, see http://home.gna.org/veusz/screenshots/screenshot1.png The PyQt4 version is coming along nicely too... Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: How to choose the right GUI toolkit ?

2006-11-09 Thread Jeremy Sanders
e Windows. I too like to learn from > actual printed books, so I'll check this one out. O'Reilly should do a > book on Python GUI stuff! PyQt is well supported under native Windows. Qt-4 is now GPLd for Windows too. I'd highly recommend it. Jeremy -- Jeremy San

Re: How to choose the right GUI toolkit ?

2006-11-10 Thread Jeremy Sanders
ll. You normally use PyQt/Qt on Windows without Cygwin. There are very few bugs and lots of professional companies base their products on Qt Windows. -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Programmatically finding "significant" data points

2006-11-14 Thread Jeremy Sanders
, and remove points which are more than N-times the standard deviation from the median. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Mutual interdependency problem

2006-06-07 Thread Jeremy Sanders
eaks! I can work around it by removing the "as XXX" parts on the import statement, but it gets annoying having to specify the full path. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

import hook

2006-06-11 Thread Jeremy Sanders
o use my version. Any ideas? Thanks Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: import hook

2006-06-18 Thread Jeremy Sanders
'veusz' sys.modules['veusz'] = veusz This is part of the main program. If it can't import it (i.e. it is not installed), it imports the __init__ module, renames it, and corrects its path, then sticks it into the list of imported modules. Jeremy -- Jeremy Sanders http://

Re: ntp in python

2006-08-29 Thread Jeremy Sanders
delay out from the ntpdc console using dmpeers, or lopeers in ntpq. You could have two peers either side of the link and measure the delay from NTP. You may also be able to query remote ntp servers to get their delays to their peers. Jeremy -- Jeremy Sanders http://www.jeremysanders

Re: ntp in python

2006-08-30 Thread Jeremy Sanders
ithm. I saw something about ntp on the twisted mailing list, so you could ask there. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Force sleep to ignore interrupts

2006-09-14 Thread Jeremy Sanders
> the event loop out of sync with real time. Maybe you could install a signal handler to ignore ctrl+c, when required import signal signal.signal(signal.SIGINT, signal.SIG_IGN) -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it possible to save a running program and reload next time ?

2006-09-21 Thread Jeremy Sanders
I don't know which ones work with python. -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: naming objects from string

2006-09-21 Thread Jeremy Sanders
']['apple'] = (1,2,3,4) myvals['bob']['orange'] = (2,3,4) myvals['pete']['red'] = (4,5,6,7) and so on >>> myvals {'pete': {'red': (4, 5, 6, 7)}, 'bob': {'orange': (2, 3, 4), 'apple': (1, 2, 3,4)}} -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing 2d array in an ascci file

2006-09-28 Thread Jeremy Sanders
>>f, str(x).replace('[',' ').replace(']', ' ') f.close() Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to handle large lists?

2006-10-03 Thread Jeremy Sanders
Chaz Ginger wrote: > What would sets do for me over lists? It's faster to tell whether something is in a set or dict than in a list (for some minimum size). Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to handle large lists?

2006-10-03 Thread Jeremy Sanders
Jeremy Sanders wrote: > Chaz Ginger wrote: > >> What would sets do for me over lists? > > It's faster to tell whether something is in a set or dict than in a list > (for some minimum size). As a footnote, this program import random num = 10 a = set( range(nu

Re: PyQt app in seperate thread

2006-11-23 Thread Jeremy Sanders
allows the user to send it python commands from the main thread. Have a look at this code to see how it works: http://svn.gna.org/viewcvs/veusz/branches/qt4/embed.py?rev=530&view=markup Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

RE: How to read the directory which the actively running python file islocated in?

2006-12-01 Thread Jeremy Sanders
Michael Malinowski wrote: > Nevermind, I got it using the sys.argv[0] That doesn't always work, as on unix the path isn't prepended onto sys.argv[0] necessarily. import os.path ... os.path.dirname(os.path.abspath(__file__)) may be better. -- Jeremy Sanders http://www.jere

Re: PyGTK

2006-02-09 Thread Jeremy Sanders
ose it depends on what sort of image manipulation you need. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: is there a better way?

2006-02-10 Thread Jeremy Sanders
. There are never O's between > X's. What not for x in list: if x == O: break storage.append(x) ?? -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Poisson Distribution (for a newbie)

2006-02-16 Thread Jeremy Sanders
sed numarray's poisson distribution generator, which was very useful. There may well be something similar in NumPy/Numeric/SciPy. e.g. from numarray.random_array import poisson for i in xrange(100): print poisson(10) Where 10 is the mean. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/

Re: ls files --> list packer

2006-02-24 Thread Jeremy Sanders
I V wrote: > snd_filelist = [f for f in os.listdir('/snd/Public/') if > f.endswith('.aiff')] Or even from glob import glob snd_filelist = glob('/snd/Public/*.aiff') Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing a file

2006-02-28 Thread Jeremy Sanders
ce to the dialog to get the user-selected page range, etc. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing a file

2006-03-02 Thread Jeremy Sanders
e printer as usual. No - that was in my example. The work I was refering to was taking the user's input to the dialog and writing the pages to the device in the right order (I don't think this is done automatically). Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

ANN: Veusz 0.6 - a scientific plotting package

2005-05-19 Thread Jeremy Sanders
Veusz 0.6 - Velvet Ember Under Sky Zenith - http://home.gna.org/veusz/ Veusz is Copyright (C) 2003-2005 Jeremy Sanders <[EMAIL PROTECTED]> Licenced under the GPL (version 2 or greater) Veusz is a scientific plotting package written in Python (current

Re: __init__() not called automatically

2005-05-26 Thread Jeremy Sanders
On Wed, 25 May 2005 21:31:57 -0700, Sriek wrote: > Similarly, why do we have to explicitly use the 'self' keyword everytime? I didn't like that when starting Python. Now when I look back at C++ code, I find it very hard to work out which variables and methods and members, and which are not, unles

Re: Subprocess and time-out

2005-06-16 Thread Jeremy Sanders
On Thu, 16 Jun 2005 18:36:52 +0200, Gilles Lenfant wrote: > Grabbing the various docs of Python, I didn't find how to do this : > > I Use popen2 to run wvware that transforms lots of M$ word docs to plain > text. Sometimes wvware runs in a deadlock and I can't control this from > Python app. >

Re: Multiple instances of a python program

2005-06-17 Thread Jeremy Sanders
On Thu, 16 Jun 2005 11:47:10 -0700, Rahul wrote: > If you have a python script and you want that 75 copies of the script be > run simultaneously how will you do it? Is there anyway to do so without > running 75 copies of the python interpreter simultaneously? If you're running on Linux (and other

Re: Matrix Multiplication

2007-06-18 Thread Jeremy Sanders
- you do need to use its special matrix type to get this. You can use the dot function to get matrix multiplication with its normal arrays. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Matrix Multiplication

2007-06-19 Thread Jeremy Sanders
t. I was just clarifying it for a reader who may not have instantly realised that there were multiple array types in numpy (I didn't for a while), and could have wasted many hours and been discouraged. Explaining clearly is indeed important. -- Jeremy Sanders http://www.jeremysanders.net/ -- h

Re: stripping the first byte from a binary file

2007-07-10 Thread Jeremy Sanders
.read(1) # read 1st byte and ignore it rest = f.read() # read rest or data = f.read() data = data[1:] # skip 1st byte ? -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: questions about functions inside a function

2007-07-16 Thread Jeremy Sanders
ng like class MyFunc(object): """A function object.""" def __init__(self, val): self.val = val def __call__(self): """Return value squared""" return self.val**2 a = [] for i in range(4): a.append(MyFunc(i)) for f in a:

Re: Beginner: Formatting text output (PyQt4)

2007-04-19 Thread Jeremy Sanders
nt(QFont('fixed')) work? It seems to work for me if you use plain text. Tabs or html/rich text formatting should be a better way to get the layout (or just use a table). Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Screen Scraper

2007-04-24 Thread Jeremy Sanders
Michael Bentley wrote: > Possibly the easiest thing will be to read from firefox' cache. > Otherwise I think your only real options are to either build a proxy > or sniff the wire... Maybe another way would be to write a firefox addon/plugin. I believe python is now supported.

ANN: Veusz-0.99.0 - a scientific plotting package

2007-05-24 Thread Jeremy Sanders
- http://home.gna.org/veusz/ Veusz is Copyright (C) 2003-2007 Jeremy Sanders <[EMAIL PROTECTED]> Licenced under the GPL (version 2 or greater). Veusz is a scientific plotting package written in Python, using PyQt4 for display and user-interfaces, and numpy for handling the n

Re: Smoother Lines in Turtle Graphics

2007-08-10 Thread Jeremy Sanders
with). I suppose turtle wouldn't be that hard to reimplement it to use Qt/Gtk instead. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: best GUI library for vector drawing program

2007-08-17 Thread Jeremy Sanders
ialiasing is optional for bitmap formats. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: best GUI library for vector drawing program

2007-08-17 Thread Jeremy Sanders
an old distribution helps the compatibility (I use centos 3 in a virtual environment). jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Co-developers wanted: document markup language

2007-08-24 Thread Jeremy Sanders
ough controls for users over what they always complain about: fonts, page breaking, and positioning of figures? Maybe it's an okay first step however. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Co-developers wanted: document markup language

2007-08-25 Thread Jeremy Sanders
gonality in its commands (e.g. why no 8pt option for the document, why the crazy \small, \LARGE, etc commands?), and fixing the font system to be based around modern fonts. Finally making bibtex part of the core and making it easy to use would be great. -- Jeremy Sanders http://www.jeremysanders.net/ --

  1   2   >