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

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 can

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)

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 trigonometry

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

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 numbers

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 also

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 If you're

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
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.jeremysanders.net/ -- http://mail.python.org

ANN: Veusz 1.7

2010-03-28 Thread Jeremy Sanders
Veusz 1.7 - Velvet Ember Under Sky Zenith - http://home.gna.org/veusz/ Veusz is Copyright (C) 2003-2010 Jeremy Sanders jer...@jeremysanders.net Licenced under the GPL (version 2 or greater). Veusz is a Qt4 based scientific plotting package. It is written

[issue8069] struct documentation problem and suggestion to add fixed size formats

2010-03-05 Thread Jeremy Sanders
New submission from Jeremy Sanders jer...@jeremysanders.net: The struct documentation at http://docs.python.org/library/struct.html says: Standard size and alignment are as follows: no alignment is required for any type (so you have to use pad bytes); short is 2 bytes; int and long are 4

[issue8069] struct documentation problem and suggestion to add fixed size formats

2010-03-05 Thread Jeremy Sanders
Jeremy Sanders jer...@jeremysanders.net added the comment: Sorry - I didn't read the docs clearly enough. This probably isn't a bug then. Can you mark it invalid? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8069

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 jer...@jeremysanders.net Licenced under the GPL (version 2 or greater). Veusz is a Qt4 based scientific plotting package. It is written

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 jer...@jeremysanders.net Licenced under the GPL (version 2 or greater). Veusz is a Qt4 based scientific plotting package. It is written

Re: os.system function

2010-01-12 Thread Jeremy Sanders
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
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://mail.python.org/mailman

Re: PyQt4 - remember widget positions

2009-10-22 Thread Jeremy Sanders
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.jeremysanders.net/ -- http

ANN: Veusz 1.5 released

2009-09-28 Thread Jeremy Sanders
Veusz 1.5 - Velvet Ember Under Sky Zenith - http://home.gna.org/veusz/ Veusz is Copyright (C) 2003-2009 Jeremy Sanders jer...@jeremysanders.net Licenced under the GPL (version 2 or greater). Veusz is a Qt4 based scientific plotting package. It is written

Re: Python code for testing well parenthesized expression

2009-07-14 Thread Jeremy Sanders
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? a='aAAA(bbb(cc)))' a.count('(') == a.count(')') Jeremy -- Jeremy Sanders http://www.jeremysanders.net

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: Package for fast plotting of many data points in Python?

2009-07-10 Thread Jeremy Sanders
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
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
, 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 http://www.jeremysanders.net/ -- http

ANN: Veusz 1.4

2009-06-04 Thread Jeremy Sanders
Veusz 1.4 - Velvet Ember Under Sky Zenith - http://home.gna.org/veusz/ Veusz is Copyright (C) 2003-2009 Jeremy Sanders jer...@jeremysanders.net Licenced under the GPL (version 2 or greater). Veusz is a Qt4 based scientific plotting package. It is written

ANN: Veusz 1.3 - a scientific plotting module and package

2009-02-25 Thread Jeremy Sanders
Veusz 1.3 - Velvet Ember Under Sky Zenith - http://home.gna.org/veusz/ Veusz is Copyright (C) 2003-2009 Jeremy Sanders jer...@jeremysanders.net Licenced under the GPL (version 2 or greater). Veusz is a scientific plotting package. It is written in Python

Re: subprocess.Popen inheriting

2008-12-17 Thread Jeremy Sanders
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
? 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

ANN: Veusz 1.2.1 - a scientific plotting package / module

2008-11-30 Thread Jeremy Sanders
Note: the Python embedding interface is now more robust and works under windows. Veusz 1.2.1 --- Velvet Ember Under Sky Zenith - http://home.gna.org/veusz/ Veusz is Copyright (C) 2003-2008 Jeremy Sanders [EMAIL PROTECTED] Licenced under the GPL (version 2

Re: calling python scripts as a sub-process

2008-11-19 Thread Jeremy Sanders
', '--istep=16', '--chmetric=M2', '--use_texid=true'] 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
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

os.pipe and subprocess under Windows

2008-11-17 Thread Jeremy Sanders
(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: os.pipe and subprocess under Windows

2008-11-17 Thread Jeremy Sanders
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://www.jeremysanders.net/ -- http://mail.python.org/mailman

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=False

ANN: Veusz 1.1

2008-10-03 Thread Jeremy Sanders
Veusz 1.1 - Velvet Ember Under Sky Zenith - http://home.gna.org/veusz/ Veusz is Copyright (C) 2003-2008 Jeremy Sanders [EMAIL PROTECTED] Licenced under the GPL (version 2 or greater). Veusz is a scientific plotting package written in Python, using PyQt4

Re: indirectly addressing vars in Python

2008-10-01 Thread Jeremy Sanders
. 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 mutable. -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

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

Re: random numbers according to user defined distribution ??

2008-08-08 Thread Jeremy Sanders
. 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
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
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/mailman/listinfo

Re: breaking out of outer loops

2008-01-29 Thread Jeremy Sanders
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
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
. 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
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.jeremysanders.net/ -- http

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] Licenced under

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] Licenced under

Re: ANN: Veusz 1.0 - a scientific plotting package

2007-10-29 Thread Jeremy Sanders
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

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: Stopping a fucntion from printing its output on screen

2007-10-17 Thread Jeremy Sanders
= 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
(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
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
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.net/ -- http://mail.python.org

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

2007-09-20 Thread Jeremy Sanders
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
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
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/ -- http://mail.python.org/mailman/listinfo/python

Re: Co-developers wanted: document markup language

2007-08-24 Thread Jeremy Sanders
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
. 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
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: Smoother Lines in Turtle Graphics

2007-08-10 Thread Jeremy Sanders
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
(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: f() Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http

Re: stripping the first byte from a binary file

2007-07-10 Thread Jeremy Sanders
= 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
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/ -- http://mail.python.org/mailman/listinfo/python

Re: Matrix Multiplication

2007-06-18 Thread Jeremy Sanders
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 numeric data

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 numeric data

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... -- Jeremy Sanders

Re: Beginner: Formatting text output (PyQt4)

2007-04-19 Thread Jeremy Sanders
? 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: Console UI

2007-04-09 Thread Jeremy Sanders
://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: Database in memory

2007-04-09 Thread Jeremy Sanders
', 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 of them... Jeremy -- Jeremy Sanders http://www.jeremysanders.net

Re: Managing a file buffer

2007-04-09 Thread Jeremy Sanders
/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: Watching a file another app is writing

2007-03-12 Thread Jeremy Sanders
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.wikipedia.org/wiki/Named_pipe Jeremy -- Jeremy Sanders

Re: PyQt4 strangeness

2007-01-23 Thread Jeremy Sanders
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
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 os.system(cmd) oops! -- Jeremy Sanders http://www.jeremysanders.net/ -- http

Re: maximum number of threads

2007-01-10 Thread Jeremy Sanders
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 http://www.jeremysanders.net/ -- http

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.jeremysanders.net

Re: PyQt app in seperate thread

2006-11-23 Thread Jeremy Sanders
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=530view=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
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
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
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 Sanders http://www.jeremysanders.net/ -- http://mail.python.org

Re: Plot pkg - Multiple Y axes?

2006-11-07 Thread Jeremy Sanders
/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

Python 123 introduction

2006-10-30 Thread Jeremy Sanders
://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
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
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: 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(num) ) for i in range(10): x

Re: Writing 2d array in an ascci file

2006-09-28 Thread Jeremy Sanders
() Jeremy -- 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
and CONTinuing processes), or sleep statements, or saving state, don't work investigate these. e.g. http://www.cs.wisc.edu/~zandy/ckpt/ These programs have limitations on what can be restored (e.g. threads, shared memory, network connections...). I don't know which ones work with python. -- Jeremy

Re: naming objects from string

2006-09-21 Thread Jeremy Sanders
': {'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: Force sleep to ignore interrupts

2006-09-14 Thread Jeremy Sanders
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
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
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.net/ -- http://mail.python.org

Re: Python and STL efficiency

2006-08-22 Thread Jeremy Sanders
? 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 compare it. -- Jeremy Sanders http

Re: Small Troll on notation of variables over time

2006-08-21 Thread Jeremy Sanders
): 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
= What do you know?; for (long int i=0; i1 ; ++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

  1   2   >