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

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: 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: 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: 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: 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: 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: 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: 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: Making Line Graphs

2011-02-19 Thread Jeremy Sanders
spam head wrote: > Does anybody have any recommendations for a good program from > generating these simple graphs? Have a look at Veusz, written in python: http://home.gna.org/veusz/ (I am the lead author). Jeremy -- http://mail.python.org/mailman/listinfo/python-list

Re: Saving (unusual) linux filenames

2010-08-31 Thread Jeremy Sanders
amfr...@web.de wrote: > i have a script that reads and writes linux paths in a file. I save the > path (as unicode) with 2 other variables. I save them seperated by "," and > the "packets" by newlines. So my file looks like this: > path1, var1A, var1B > path2, var2A, var2B > path3, var3A, var3B I

Re: Multiline regex

2010-07-21 Thread Jeremy Sanders
Brandon Harris wrote: > I'm trying to read in and parse an ascii type file that contains > information that can span several lines. > Example: What about something like this (you need re.MULTILINE): In [16]: re.findall('^([^ ].*\n([ ].*\n)+)', a, re.MULTILINE) Out[16]: [('createNode animCurveTU

Re: GUIs - A Modest Proposal

2010-06-13 Thread Jeremy Sanders
.py Personally I find the Qt layout to be much better than anything provided by CSS and HTML. Personally I'd rather be writing complex C++ templates that those, though it does give you a feeling of achievement when you get what you want with CSS. Jeremy -- Jeremy Sanders http://www.jeremy

ANN: Veusz 1.6

2010-01-26 Thread Jeremy Sanders
Veusz 1.6 - Velvet Ember Under Sky Zenith - http://home.gna.org/veusz/ Veusz is Copyright (C) 2003-2010 Jeremy Sanders Licenced under the GPL (version 2 or greater). Veusz is a Qt4 based scientific plotting package. It is written in Python, using PyQt4 for

Re: os.system function

2010-01-12 Thread Jeremy Sanders
aws in your program. - It's inefficient as you have to start a new program to do the work (slow on windows) - Error handling from the xcopy process will not be easy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Psyco on 64-bit machines

2009-11-16 Thread Jeremy Sanders
n x86 mode, so Python will typically run faster in 64 bit mode (this is more pronounced in AMD processors, in my experience). It will depend on your application whether 32 bit mode plus Psyco is faster than 64 bit mode. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://m

Re: PyQt4 - remember widget positions

2009-10-22 Thread Jeremy Sanders
ainWindow to save the dockwidget geometries. I save the size and position of the main window separately and restore it with resize() and move(). You need to make sure all your toolbars and dockwidgets have unique object names for saveState to work. Jeremy -- Jeremy Sanders http://www.jerem

Re: Python code for testing well parenthesized expression

2009-07-14 Thread Jeremy Sanders
Diez B. Roggisch wrote: > Yep, you are: > > "((((" > > is certainly not "well parenthized". Thanks for that! -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python code for testing well parenthesized expression

2009-07-14 Thread Jeremy Sanders
e follows at the end. > > If you have a better algorithm or a better Python code (I'm a beginner in > the Python world), don't hesitate ... Don't you want to just test that the number of "("s equals the number of ")"s or am I missing the point? >

Re: Package for fast plotting of many data points in Python?

2009-07-10 Thread Jeremy Sanders
ple of seconds on my system. It's a bit faster without antialiasing, slower if you want to actually plot markers at each position. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Status of Python threading support (GIL removal)?

2009-06-21 Thread Jeremy Sanders
27;s certainly a very interesting read if you're interested in this subject. -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Once again, comparison wxpython with PyQt

2009-06-19 Thread Jeremy Sanders
PL. You have to abide by the LGPL, however, which means that the user has to be able to relink a modified form of the library, Qt, with your application should they wish. You should check whether the LGPL is appropriate for the way you want to ship your program. Jeremy -- Jeremy Sanders htt

Re: subprocess.Popen inheriting

2008-12-17 Thread Jeremy Sanders
s instead, which seem much more portable between Windows and Unix (though you don't get to use socketpair and AF_UNIX in Windows). Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to dynamically get an attribute from a module from within the same module

2008-12-01 Thread Jeremy Sanders
n a dict? That would be clearer, would not mess around with global namespace, and more pythonic IMHO. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: calling python scripts as a sub-process

2008-11-19 Thread Jeremy Sanders
to remove any shell quoting you may use on the unix/dos command line. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: calling python scripts as a sub-process

2008-11-19 Thread Jeremy Sanders
ely in the list without the shell quoting and extra spaces, i.e. ['python', '../src_python/Match1.py', '--file_ref=.hdf', '--file_cmp=.hdf', '--block_start=xx', '--block_end=62', '--istep=16', '--chmetric=M2', '--use_texid=true'] Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: os.pipe and subprocess under Windows

2008-11-17 Thread Jeremy Sanders
Jeremy Sanders wrote: > Hi - I have some code which works under linux. It starts a remote python > process using subprocess and communicates to it via a pipe created by > os.pipe. As far as I understand, child processes should inherit file > descriptors from the parent if close_fds=

Re: os.pipe and subprocess under Windows

2008-11-17 Thread Jeremy Sanders
wrong to me. I know Windows has no fork - that's why I used subprocess. This MSDN page suggests you you need to do something with SetHandleInformation to get them to be inherited. Doesn't subprocess do that? http://msdn.microsoft.com/en-us/library/ms682499(VS.85).aspx -- Jeremy Sanders http:

os.pipe and subprocess under Windows

2008-11-17 Thread Jeremy Sanders
s.stderr.write('* %s\n' % intext) if __name__ == '__main__': fd = int(sys.argv[1]) runSlave(fd) --- Does anyone have any ideas how to get this to work under Windows? Is it correct code under unix? Thanks Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: indirectly addressing vars in Python

2008-10-01 Thread Jeremy Sanders
"credits" or "license" for more information. >>> oats=[1] >>> peas=[6] >>> mylist = [oats, peas] >>> mylist[1][0] = mylist[1][0]+1 >>> mylist [[1], [7]] >>> peas [7] This is because integers are immutable, but lists are mu

Re: Getting references to obect instances into a list

2008-08-27 Thread Jeremy Sanders
self.lst = lst In [6]: m = foo([2,3,4]) In [7]: p = foo(['a','b','c']) In [8]: import weakref In [20]: q = [weakref.proxy(m), weakref.proxy(p)] In [23]: q[0].lst, q[1].lst Out[23]: ([2, 3, 4], ['a', 'b', 'c']) In [24]: del p In [27]: q[1].lst gives a reference error -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: random numbers according to user defined distribution ??

2008-08-08 Thread Jeremy Sanders
ite a lot of distributions. See help(numpy.random). Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: how to proccess the blank in the path on linux

2008-05-21 Thread Jeremy Sanders
might be better to use subprocess to launch it so that you don't need the escaping: subprocess.call(['ls', '8000 dir']) This avoids using the shell. -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Reversing a dict?

2008-05-06 Thread Jeremy Sanders
around as the dict is modified. Have a look at diveintopython: http://www.diveintopython.org/getting_to_know_python/dictionaries.html You'll have to store your keys in a list or tuple to keep them ordered. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/ma

Re: breaking out of outer loops

2008-01-29 Thread Jeremy Sanders
ntinue > break Perhaps Python needs a "continue N" or a "break N" statement :-) for i in outerLoop: for j in innerLoop: if condition: break 2 Seeing as we can't have a goto :-) Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: multidimensional "arrays"

2007-12-06 Thread Jeremy Sanders
Horacius ReX wrote: > do you know how to do similar but in two dimensions ? Investigate the numpy module if you are dealing with numbers. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Extended date and time

2007-11-12 Thread Jeremy Sanders
cross all platforms. Is there any way to convert a datetime into seconds from a certain date? Is the most robust way of doing it just to subtract two datetime objects and turn the timedelta into a floating point number? Thanks Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Extended date and time

2007-11-10 Thread Jeremy Sanders
past. Thanks, Jeremy. -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Drawing charts in Qt

2007-11-06 Thread Jeremy Sanders
re almost like bar charts...). It is implemented with PyQt4. You can use the windows.PlotWindow widget in your PyQt4 app, but unfortunately I haven't got round to documenting this properly... If you're interested I can give instructions. Jeremy -- Jeremy Sanders http://www.jeremysa

Re: ANN: Veusz 1.0 - a scientific plotting package

2007-10-29 Thread Jeremy Sanders
Wildemar Wildenburger wrote: > Oh, OK. I though it was a library. I now see that it is an actual > application. Sorry to have bothered you :) It's a library too :-) -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Veusz 1.0 - a scientific plotting package

2007-10-29 Thread Jeremy Sanders
mitive to use as a backend for Veusz (see previous threads on this subject). Maybe that has changed now, but IMHO Veusz output still looks better. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

ANN: Veusz 1.0 - a scientific plotting package

2007-10-29 Thread Jeremy Sanders
I'm pleased to announce Veusz 1.0. Source, windows and linux i386 binaries are available. Jeremy Sanders Veusz 1.0 - Velvet Ember Under Sky Zenith - http://home.gna.org/veusz/ Veusz is Copyright (C) 2003-2007 Jeremy Sanders <[EMAIL PROTECTED]> Lic

Re: Stopping a fucntion from printing its output on screen

2007-10-17 Thread Jeremy Sanders
): print "this is a test" nullwrite = NullWriter() oldstdout = sys.stdout sys.stdout = nullwrite # disable output testfunc() sys.stdout = oldstdout # enable output testfunc() -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Wrapper functions and arguments

2007-10-01 Thread Jeremy Sanders
f __init__(self, func): self.func = func def __call__(self, *args, **argsk): self.func(*args, **argsk) Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: sorteddict PEP proposal [started off as orderedict]

2007-09-26 Thread Jeremy Sanders
..), (or you could > create a sorteddict and use update() since that takes the same args as > dict's constructor). first() and last() would also be nice on a sorted dict. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: sorteddict PEP proposal [started off as orderedict]

2007-09-25 Thread Jeremy Sanders
ccessing the last item in the dictionary. By the way, I think a LRU cache dictionary would be a great addition to the standard library. Is there any speed advantage from implementing the sorteddict as a red-black tree or something similar in C? Jeremy -- Jeremy Sanders http://www.jeremysanders.ne

Re: limiting memory consumption of Python itself or a dict in a Python program

2007-09-20 Thread Jeremy Sanders
keeps track of the total space of the items stored (using len on the strings)? It could automatically clean out old entries when the memory usage becomes too much. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie: self.member syntax seems /really/ annoying

2007-09-12 Thread Jeremy Sanders
as self as "s", it's only two more characters per variable access, which is the same as the C++ "m_" naming convention. -- 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/ --

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: 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: 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: 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: 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: 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: 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: 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

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: 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.

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: Managing a file buffer

2007-04-09 Thread Jeremy Sanders
n play from one. e.g. http://www2.linuxjournal.com/article/2156 You can create a named pipe from python. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Database in memory

2007-04-09 Thread Jeremy Sanders
f name and age data = [ ['fred', 42], ['jim', 16], ... ] name_index = {} for item in data: name_index[item[0]] = item >>> name_index['fred'] ['fred', 42] Dictionaries are one of the most useful things in Python. Make sure you know how to take adavantage

Re: Console UI

2007-04-09 Thread Jeremy Sanders
e http://tvision.sourceforge.net/ ). I haven't used these, but I fondly remember turbovision from my Turbo Pascal/Turbo C++ days. I think it is still a good text based GUI. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Watching a file another app is writing

2007-03-12 Thread Jeremy Sanders
d manually readlines() from it to keep up to date, > it's the automatic part I'm having trouble with. This is on Windows. It occurs to me under Unix you could perhaps get your first program to write to a "named pipe", which you 2nd program could read from. See http://en.wikipe

Re: PyQt4 strangeness

2007-01-23 Thread Jeremy Sanders
ke: import PyQt4.Qt as Qt which imports QtCore and QtGui Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: when format strings attack

2007-01-19 Thread Jeremy Sanders
des arguments that trigger that > bug, then naturally your application will inherit whatever security > vulnerabilities the external application suffers from. No surprises there. There are also big risks like this filename = 'foo; rm importantfile' cmd = 'ls %s' % filename o

Re: maximum number of threads

2007-01-10 Thread Jeremy Sanders
address space is still used up. So, > when you try to create the 383rd thread, the kernel can't find anyplace > to put its stack. So you can't create it. Interesting. That's why I can get over 3000 on my x86-64 machine... Much more address space. -- Jeremy Sanders

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: 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: 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

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: 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: 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: 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: 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

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: 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: 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: 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: 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: 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: 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: 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: 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: 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

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: 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: 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: 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: 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: 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-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: 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://

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

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

Re: Why 3.0/5.0 = 0.59999...

2006-05-09 Thread Jeremy Sanders
Davy wrote: > Is there some precision loss? And how to overcome it? See http://docs.python.org/tut/node16.html for some useful information. -- 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

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

  1   2   >