Re: Syntax error after upgrading to Python 2.4

2005-08-06 Thread Fernando
> I don't see the problem yet. I certainly do not see anything that should > have been affected by the upgrade (was it from 2.3 on XP also?) Yes. > After checking for nonprinting chars, I would shuffle the param-default > lines to try to determine which is really at fault. Good luck, or wait fo

Re: Python becoming less Lisp-like

2005-03-14 Thread Fernando
On Sun, 13 Mar 2005 18:23:05 GMT, Peter Seibel <[EMAIL PROTECTED]> wrote: >Looks like the BDFL is planning to take lambda, reduce, filter, and >map out of Python in the next big rev of Python (so called Python >3000): > > Basically, it sa

Re: Python becoming less Lisp-like

2005-03-14 Thread Fernando
On Tue, 15 Mar 2005 00:01:09 +0100, Torsten Bronger <[EMAIL PROTECTED]> wrote: >> The new 'perlified' syntax for decorators, > >Python lost its innocence here: The first really special character, >disturbing the former syntax style. Not important, but irritating. > >> the new static type bonds >

Re: Lisp-likeness

2005-03-15 Thread Fernando
On 15 Mar 2005 00:43:49 -0800, "Kay Schluehr" <[EMAIL PROTECTED]> wrote: >Maybe You can answer my question what this simple LISP function does ? > >(defun addn (n) > #'(lambda (x) > (+ x n))) The same as def addn(n): def fn(x): return n + x ret

Re: Lisp-likeness

2005-03-16 Thread Fernando
On Wed, 16 Mar 2005 00:36:40 +0100, Marcin 'Qrczak' Kowalczyk <[EMAIL PROTECTED]> wrote: > > >BTW, the fact that a closure refers to a variable itself rather to its >current value can be used to check the true attitude of languages with >respect to functional programming, by observing how they un

are DLLs needed to run glade interfaces in python with Windows?

2005-04-13 Thread Fernando
Hi, I've a .glade file with a little interface I made. I've managed to load it from a python script, using pyGTK, but the only way it succeed was copying into the same directory the "libxml2.dll" and "libglade-2.0.0.dll" files. I think you only need to install theese as packages in Linux, but I'm

Registering a python function in C

2007-08-30 Thread fernando
Could someone post an example on how to register a python function as a callback in a C function? It expects a pointer to PyObject... how do I expose that? Basically, the signature of the function is foo(PyObject* obj), where obj is the callback function... It's not exactly extending or embedding,

Re: Registering a python function in C

2007-08-31 Thread fernando
Thanks for the responses. To be more specific, this code is part of a Maya plugin. The funcion MFnPlugin::registerUI takes a pointer to a PyObject which is the function that will set up the UI for that plugin. The code Matimus posted seems to me exactly like what I need to do, except that maya give

Re: Registering a python function in C

2007-09-03 Thread fernando
> Is Maya a different python build than what is contained at python.org? > If so, I suggest you get your C program to work with the latest python > build > from python.org. Then see if you can get it to work with the Maya > version. Ok, did that. If I write a normal C++ program and use the pytho

Trouble with subprocess.Popen()

2009-04-04 Thread Fernando
Hi, I'm having a very strange issue with subprocess.Popen. I'm using it to call several times an external exe and keep the output in a list. Every time you call this external exe, it will return a different string. However, if I call it several times using Popen, it will always return the SAME s

[ANN] IPython 0.13 is officially out!

2012-06-30 Thread Fernando Perez
. Many thanks to all who contributed! Fernando, on behalf of the IPython development team. http://ipython.org -- http://mail.python.org/mailman/listinfo/python-list

A sad day for the scientific Python community. John Hunter, creator of matplotlib: 1968-2012.

2012-08-29 Thread Fernando Perez
the ICU and worked to ensure that those last hours were as comfortable as possible for John; her generous actions helped us through a very difficult moment. It is now time to close this already too long message... John, thanks for everything you gave all of us, and for the privilege of knowin

how to use property?

2012-09-17 Thread Fernando Jiménez
Hi guys! I'm noob in python and I would know how to correctly use the property. I have read some things about it but I do not quite understand. I found this: class C(object): def __init__(self): self._x = None @property def x(self): """I'm the 'x' property."""

[ANN] IPython 0.11 is officially out

2011-07-31 Thread Fernando Perez
ures: http://stronginference.com/weblog/2011/7/15/innovations-in-ipython.html As usual, if you find any problem, please file a ticket --or even better, a pull request fixing it-- on our github issues site (https://github.com/ipython/ipython/issues/). Many thanks to all who contributed! Fernando,

Re: array subset could be improved? -repost ;)

2005-10-14 Thread Fernando Perez
Jim O'D wrote: > Hi all > > I have an array a=array([2,3,-1]). > > I want to extract an array with all the elements of a that are less than 0. Numeric is currently changing into the new scipy core. If you are willing to play with beta code, get it here: http://numeric.scipy.org if not, wait

Re: Yes, this is a python question, and a serious one at that (moving to Win XP)

2005-10-14 Thread Fernando Perez
> Kenneth McDonald a écrit : >> For unfortunate reasons, I'm considering switching back to Win XP (from >> OS X) as my "main" system. Windows has so many annoyances that I can >> only compare it to driving in the Bay Area at rush hour (OS X is like >> driving in Portland at rush hour--not as bad

Re: need an example of Python numarray to C++ and back again, Boost / SWIG?

2005-11-09 Thread Fernando Perez
PL wrote: > I want to pass a 2D array from Python to C++, manipulate it in C++ (for > example, add 1 to each element) and pass it back to Python. > > With these building blocks I will be able to figure out all the rest of > what I need to do for my project. I am very familiar with Python, but >

Re: Command-line tool able to take multiple commands at one time?

2005-11-10 Thread Fernando Perez
Peter A.Schott wrote: > Per subject - I realize I can copy/paste a line at a time into an interactive > session when I'm trying to debug, but was wondering if there is any tool out > there that allows me to copy sections of working Python scripts to paste into > my interactive console and let thos

Re: exceptions, internals (introspection?)

2005-11-10 Thread Fernando Perez
ej wrote: > I have often wondered how to get at other internals, such as the name of > the current function, file, line number I am in? The arguments to the > current function, etc. I browsed through the table of contents of both the > Library Reference & Language Reference. I see section 18

Re: need an example of Python numarray to C++ and back again, Boost / SWIG?

2005-11-10 Thread Fernando Perez
PL wrote: > I looked at Stefan's post - but he remarks that "Unfortunately, Blitz > jealously guards its data (restricted pointers), so that it is not so > easy to do the conversion in the other direction. If anyone knows an > answer to this problem, I'd be glad to hear it" > > I've previously l

Re: Zope vs Php

2005-11-17 Thread Fernando Lujan
on inheritance >>hierarchy. >> In this article you will have a great overview about Zope and Zope 3. http://www.zopemag.com/Issue010/Section_Articles/article_WhyZope3.html Fernando Lujan -- http://mail.python.org/mailman/listinfo/python-list

Re: Readline configuration

2005-01-05 Thread Fernando Perez
Mark Roach wrote: > I have readline set up pretty much the same way as in the example in the > python docs (http://docs.python.org/lib/readline-example.html) and > something I find myself doing fairly often is > > type some code > more code > more code > ... > > and then wanting to s

Re: Display Function Code Body?

2005-01-09 Thread Fernando Perez
Haibao Tang wrote: > > Hail Python pals! I played with the R (http://r-project.cran.org) last > night to do some statistics and it has an interactive session too, and > I found a feature that is quite useful. [...] > # or any shallow function code from a file import calendar; disp(calendar

Installer made with bdist_wininst segfaulting...

2005-01-23 Thread Fernando Perez
Hi all, I am seeking advice/help from those with more win32 experience than myself. I am trying to build a proper win32 installer for IPython, after a user did most of the hard work. For the most part, it's working very well, but I am running into a nasty problem, which took me a few hours to fi

Re: Installer made with bdist_wininst segfaulting...

2005-01-25 Thread Fernando Perez
Hi Thomas, Thomas Heller wrote: > Fernando Perez <[EMAIL PROTECTED]> writes: >> Here is a brief summary: if the installer file is run from a windows drive >> which is different from the one where python resides (and hence where >> ipython will >> end up), the i

Re: Installer made with bdist_wininst segfaulting...

2005-01-25 Thread Fernando Perez
Thomas Heller wrote: > There are a couple of known bugs in bdist_wininst, and you just reported > another one. All these bugs are related to using the > post_install_script, and show up when either (thats what I currently > remember): > > - the installer is run from a readonly location, > - the

Re: gnuplot on Canvas widget

2005-01-27 Thread Fernando Perez
Jonathan Ellis wrote: > Blues wrote: >> I have used two great models - Tkinter and Gnuplot.py - for a while. > I >> can display an image on a Canvas widget using Tkinter and I can also >> generate a gnuplot from Python on the fly in a separate window. Does >> anyone know how to display such a gn

ANN: IPython 0.6.10 is out.

2005-01-27 Thread Fernando Perez
cess (P. Ramachandran report). * Other minor fixes and cleanups, both to code and documentation. Enjoy, and as usual please report any problems. Regards, Fernando. -- http://mail.python.org/mailman/listinfo/python-list

bdist_wininst post-install bug?

2005-01-28 Thread Fernando Perez
Hi all, I just noticed a problem (which forced me to a last-minute update of the windows ipython installer). As far as I can tell, this should be considered a bug. >From the Python docs, sys.executable is: executable A string giving the name of the executable binary for the Python interpret

Re: Installing Numeric with ATLAS and LAPACK

2005-01-28 Thread Fernando Perez
drife wrote: > Thanks John. Those are the steps I followed, and to no avail. > > Interestingly, I downloaded and installed SciPy, and ran the > same eigenvector problem. SciPy greatly speeds up the > calculation...was 1.5 hours using Numeric, now only 15 min > with SciPy. > > Unfortunately, SciP

Re: Installing Numeric with ATLAS and LAPACK

2005-01-29 Thread Fernando Perez
drife wrote: > Could you clarify this please? > > Let's say that I want to make a call to the LAPACK > routine sspevd, and pass it a matrix, and get the result. How do I > accomplish this? I just had a quick look, and it seems that sspevd is NOT one of the already wrapped LAPACK functions. Try

Re: Image stats - going from Matlab to Python

2005-01-30 Thread Fernando Perez
[EMAIL PROTECTED] wrote: > Hi all, > I am working with images in python using PIL. I come from a MATLAB > background so I am finding it to be sometimes frustrating to do things > correctly and quickly. All I need to do is load an image and store a > list of pixel coordinates at which the alpha cha

Re: python-mode tab completion problem

2005-02-03 Thread Fernando Perez
Skip Montanaro wrote: > > test1dellboy3> I am exploring python-mode on emacs. When I open foo.py > test1dellboy3> in emacs and hit C-!, it starts the python interpreter in > test1dellboy3> another window. Next, I execute - > > ... > > That's not really intended to be used as an

Re: IPython colors in windows

2005-02-03 Thread Fernando Perez
Ashot wrote: > I am using IPython in windows and the LightBG setting doesn't correctly > because the background of the text is black even if the console background > is white. Anyone know whats going on? Thanks. It's quite possible that it's a bug in the UNC readline implementation proper. How

Re: exporting mesh from image data

2005-02-03 Thread Fernando Perez
John Hunter wrote: > > I am trying to generate a mesh for a finite volume solver (gambit, > fluent) from 3D image data (CT, MRI). To generate the fluent msh > file, you need not only a list of vertices and polygons, much like > what is available in the vtk file format, but also the volume elemen

Re: exporting mesh from image data

2005-02-04 Thread Fernando Perez
John Hunter wrote: >>>>>> "Fernando" == Fernando Perez <[EMAIL PROTECTED]> writes: > > Fernando> I hope you posted this on the VTK list with a CC to > Fernando> Prabhu as well... The hopes of a positive reply there > Fernando> a

Re: IPython colors in windows

2005-02-04 Thread Fernando Perez
Claudio Grondi wrote: > I use this one, > http://heanet.dl.sourceforge.net/sourceforge/uncpythontools/readline-1.7.win > 32.exe > which I assume is the right one. Try version 1.8, some coloring problems have been recently fixed. If that doesn't do it, let me know and I'll try to get in touch wit

Re: IPython colors in windows

2005-02-04 Thread Fernando Perez
Ashot wrote: > this is what it looks like: > > http://www.freshraisins.com/sand/ipythonscreen.PNG > > does cygwin have a readline utility in it? Perhaps this is overriding the > correct one? Thats the only thing I can think of. Thanks for the screenshot. I've contacted the readline author, I

Re: IPython colors in windows

2005-02-04 Thread Fernando Perez
Ashot wrote: > this is what it looks like: > > http://www.freshraisins.com/sand/ipythonscreen.PNG > > does cygwin have a readline utility in it? Perhaps this is overriding the > correct one? Thats the only thing I can think of. Hi folks, could you please test under windows the 1.9 version of

Re: IPython colors in windows

2005-02-04 Thread Fernando Perez
Fernando Perez wrote: > Hi folks, > > could you please test under windows the 1.9 version of readline? > > http://sourceforge.net/project/showfiles.php?group_id=82407&package_id=84552&release_id=302513 > > This was just put up a moment ago by the developer, le

Re: IPython colors in windows

2005-02-04 Thread Fernando Perez
Fernando Perez wrote: > Ashot wrote: > >> this is what it looks like: >> >> http://www.freshraisins.com/sand/ipythonscreen.PNG >> >> does cygwin have a readline utility in it? Perhaps this is overriding the >> correct one? Thats the only thing I c

Re: IPython colors in windows

2005-02-04 Thread Fernando Perez
Ashot wrote: > One more thing I was wondering about: why not highlight the source code in > the errors since you already have this functionality (with '??' command). > It would be nice to have it highlighed on the prompt as well, but I > imagine this may be more difficult.. I've been using IPython

Re: IPython colors in windows

2005-02-04 Thread Fernando Perez
Ashot wrote: > whoa, that was quick, looks like it works for me. Thanks a lot! > It would be nice to be able to set the colors in the prefs file, although > its possible to edit the pyColorize file as Claudio mentioned. Yes, I haven't implemented user-definable color schemes. Not impossible, bu

Re: IDLE history, Python IDE, and Interactive Python with Vim

2005-02-05 Thread Fernando Perez
Hi, Ashot wrote: > This is sort of both Python and Vim related (which is why I've posted to > both newsgroups). [...] I know you've been using ipython recently (the readline color bugs), so perhaps my reply is a bit redundant. Forgive me if that's the case, I just want to give you some useful

Re: question about introspection using inspect module

2005-07-07 Thread Fernando Perez
Benjamin Rutt wrote: > I'm trying to learn about introspection in Python. my ultimate goal > is to be able to build a module "text database" of all modules that > are in the sys.path, by discovering all candidate modules (I've > already done that), importing all of them, and then introspecting on

Re: question about introspection using inspect module

2005-07-07 Thread Fernando Perez
Benjamin Rutt wrote: > Fernando Perez <[EMAIL PROTECTED]> writes: > >> I certainly don't want to discourage you from learning about python >> introspection, it's one of the most fun aspects of the language. But just >> as an FYI, the pydoc system alread

Re: PyX, matplotlib, 3D & LaTeX

2005-07-08 Thread Fernando Perez
Francisco Borges wrote: > I like PyX, use it a lot and would suggest it as a beter plotting > library than the ones at Scipy (for as long as you don't need on-screen > plotting). FWIW, the plotting support in scipy is essentially unmaintained and abandoned, since the advent of matplotlib. It has

Re: goto

2005-07-18 Thread Fernando Perez
Steven Bethard wrote: > Hayri ERDENER wrote: >> what is the equivalent of C languages' goto statement in python? > > Download the goto module: > http://www.entrian.com/goto/ > And you can use goto to your heart's content. And to the horror of all > your friends/coworkers. ;) > > STeVe Tha

Re: goto

2005-07-19 Thread Fernando Perez
Steven Bethard wrote: > Fernando Perez wrote: >> Steven Bethard wrote: >> >>>Download the goto module: >>> http://www.entrian.com/goto/ >>>And you can use goto to your heart's content. And to the horror of all >>>your friends/cowork

Re: PEP on path module for standard library

2005-07-21 Thread Fernando Perez
Peter Hansen wrote: > Michael Hoffman wrote: >> For the PEP, do any of you have arguments for or against including path? >> Code samples that are much easier or more difficult with this class >> would also be most helpful. > > I believe the strongest argument for "path" can be made for how it > i

Re: A Module on Time & Date

2005-07-27 Thread Fernando Perez
Robert Maas, see http://tinyurl.com/uh3t wrote: >> From: Robert Kern <[EMAIL PROTECTED]> >> As you can see in the datetime documentation, the module was introduced >> in Python 2.3. I recommend updating your Python installation. > > What do you mean "your"?? I don't have any Python installation o

python SMTP server

2005-07-30 Thread Fernando M.
Hi, i made a test with smtplib module a few days ago, for sending mails, and i was wondering if there's another module for running an SMTP server, so i could make a standalone script for sending mails without using an external SMTP server. I've been searching but i'm not sure if there are modules f

Re: Dabo in 30 seconds?

2005-08-02 Thread Fernando Perez
* Oops, IPython crashed. We do our best to make it stable, but... A crash report was automatically generated with the following information: - A verbatim copy of the traceback above this text. - A copy of your input history during this session. - Data on your current IPython configuration.

Re: Dabo in 30 seconds?

2005-08-02 Thread Fernando Perez
Paul McNett wrote: > Fernando Perez wrote: >> If you are interested, just get ipython and grab the files for this, it's >> all >> BSD licensed. You can also browse the SVN repo here if you want to look at >> the code: >> >> http://ipython.scipy.org/s

Re: Dabo in 30 seconds?

2005-08-03 Thread Fernando Perez
Paul McNett wrote: > I've done things like this in the past, in my own Visual Foxpro > framework. In that situation, I had enough control over the deployment > to also ship a small smtp client, and automatically email the error > without requiring any interaction at all. Clients were impressed whe

Re: interpreter frame

2005-08-11 Thread Fernando Perez
Peter Hansen wrote: > Leo wrote: >> Good try, but that doesn't seem to work either. Maybe I should have >> emphasized that what I really want is the line of code, as opposed to >> the entire frame. > > Ah, it wasn't clear from your first post that you were specifically > interested in a line you

Re: Traceback Questions

2005-08-19 Thread Fernando Perez
ncf wrote: > I'm just beginning with tracebacks, building off of what I see in > asyncore's compact_traceback code, in order to hopefully store all the > values from the location in which the exception occured. > > I'm actually trying to make this into a python bug report system for my > current

Re: Precise timings ?

2005-08-30 Thread Fernando Perez
Madhusudan Singh wrote: > Madhusudan Singh wrote: > >> Hi >> >> I am using time.clock() to get the current time of the processor in >> seconds. For my application, I need really high resolution but currently >> seem to be limited to 0.01 second. Is there a way to specify the >> resolution (say 1

Re: job scheduling framework?

2005-09-08 Thread Fernando Perez
Larry Bates wrote: > Google turned up these links that might be of interest: > > http://www.foretec.com/python/workshops/1998-11/demosession/hoegl/ > http://www.webwareforpython.org/Webware/TaskKit/Docs/QuickStart.html > http://www.slac.stanford.edu/BFROOT/www/Computing/Distributed/Bookkeeping/SJ

Re: Creating BibTex files with XdkBibTeX

2005-09-12 Thread Fernando Perez
Rob Cowie wrote: > I'm looking for a module that is able to create valid BibTex documents. > I'm currently using string substitution to create the content, but it > is not validated in any way. > > The only BibTex creation module available in Python (that I can find) > is XdkBibTeX > (http://arti

Re: Detailed traceback

2005-09-13 Thread Fernando Perez
Echo wrote: > I have been working on handling unhanded exceptions and making a > detailed print out of the traceback after the exception. I found that > traceback.extract_tb worked nice and was quite simple. > > During my searching around I found out that it might be possible to > get the variabl

Re: working with VERY large 'float' and 'complex' types

2005-09-14 Thread Fernando Perez
Todd Steury wrote: > Greetings Python'ers: > > I'm just an amature who occasionally uses Python for complex mathematical > models. The current model I'm working with occasionally generates really > large numbers that are either "float" or "complex" types. These numbers are > so large that I eithe

Re: IPython colors in windows

2005-02-06 Thread Fernando Perez
Claudio Grondi wrote: > It works for me as it is now, so probably it is better to wait for the > next release of IPython with a cleaner implementation of color > schemes before further efforts towards support for choosing > of background colors for each colorized text output in IPython > via exten

Re: empty classes as c structs?

2005-02-06 Thread Fernando Perez
Steven Bethard wrote: > The complications with attribute hiding is one of main reasons I've > tried to minimize the number of methods associated with Bunch... in order for bunches to be fully useful in general, open contexts, I think that number of methods should be exactly zero (at least without

Re: IPython colors in windows

2005-02-06 Thread Fernando Perez
Claudio Grondi wrote: > Hi, > > I have just updated previously announced > and uploaded to > http://people.freenet.de/AiTI-IT/Python/Console.py > version > of Console.py because I was not satisfied with > it (it didn't support arbitrary ANSI escape > sequences for setting text colors ...) I'd s

Re: IDLE history, Python IDE, and Interactive Python with Vim

2005-02-07 Thread Fernando Perez
Ashot wrote: > yup, this is why I've been using it, its (almost exactly :) what I was looking > for. I had tried it before, but was reluctant to use it because the windows > terminal is not very appealing. Some things I've noticed so far that I think > could be improved, some of which are minor b

Re: IDLE history, Python IDE, and Interactive Python with Vim

2005-02-07 Thread Fernando Perez
Ashot wrote: > Sorry, a few more things I forgot to mention having to do with editing > multiline entries in the console: > > Autotab setting doesn't seem to have any effect, I have to type "ctrl-o" > manually I've noticed it doesn't work under win32. It's fine under *nix. There's only so much

Re: Hack with os.walk()

2005-02-12 Thread Fernando Perez
Michael Spencer wrote: > The path module by Jorendorff: http://www.jorendorff.com/articles/python/path/ > > wraps various os functions into an interface that can make this sort of thing > cleaner Wow, many thanks for the pointer. This has to be one of the single most useful small python modules

Re: Hack with os.walk()

2005-02-12 Thread Fernando Perez
Robert Kern wrote: > Fernando Perez wrote: > >> Perhaps this path.py could be considered for inclusion in the stdlib? I've >> only >> read the page linked above, so perhaps it can use some polishing. But it >> certainly looks like a big improvement over the

Re: graphing

2005-02-14 Thread Fernando Perez
Jan Rienyer Gadil wrote: > i'm currently using python 2.3(enthought edition) on win 2000/xp. > i'm using boa constructor on the GUI part and matplotlib 0.71 on > plotting the graph. You should post this on the matplotlib list directly, where your chances of a reply are much better. I use matplot

[ANN] IPython 0.6.11 is out.

2005-02-15 Thread Fernando Perez
n the previous call produced a syntax error. * Fix crash when inspecting classes without constructor. * Other small fixes and cleanups. Enjoy, and as usual please report any problems. Regards, Fernando. -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] IPython 0.6.11 is out.

2005-02-16 Thread Fernando Perez
Ville Vainio wrote: > Warning - if you are upgrading and have an old pysh.py dangling around > in $HOME/.ipython, be sure to delete it. The old version is > incompatible with the new ipython. Just to clarify: you need to delete ONLY the old pysh.py, not your entire $HOME/.ipython/ directory. Y

Re: huge help for interactive python

2005-02-16 Thread Fernando Perez
David S. wrote: > If you are using ipython on Windows then you will > have made sure you have Gary Bishop's readline > library as instructed in the ipython install > directions found at: > http://ipython.scipy.org/ [...] Thanks, very handy. I just reposted your message to the ipyhton-users list

Re: recommended way of generating HTML from Python

2005-02-20 Thread Fernando Perez
Michele Simionato wrote: > What is the recommended way of generating HTML from Python? I know of > HTMLGen and of > few recipes in the Cookbook, but is there something which is more or > less standard? I'm also an htmlgen user, but it's getting a bit long in the tooth, and the installation is not

[ANN] IPython 0.6.12 is out.

2005-03-02 Thread Fernando Perez
prompts, if users so want them. * New %time magic to time statements and expressions. It reports CPU and wall clock time. * Other small fixes and cleanups. Enjoy, and as usual please report any problems. Regards, Fernando. -- http://mail.python.org/mailman/listinfo/python-list

Re: computing a weighted sum

2005-03-16 Thread Fernando Perez
[EMAIL PROTECTED] wrote: > Suppose I have a list of n floats x and a list of n floats w and I want > to compute x[0]*w[0] + .. + x[n-1]*w[n-1]. > > Is there some elegant expression (perhaps using lambda) to have it done > in one statement ? As in : > y = lambda x,w : ... > > I ask because t

ANN: IPython 0.6.5 is out

2004-12-01 Thread Fernando Perez
to code and documentation. Enjoy, and as usual please report any problems. Regards, Fernando. -- http://mail.python.org/mailman/listinfo/python-list

Re: memoize factorial example (was Re: decorators ?)

2004-12-07 Thread Fernando Perez
Terry Reedy wrote: > > "Daniel 'Dang' Griffith" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> But the factorial example on the wiki has a defect. It incorrectly >> calculates factorial(0) as 0, when it should be 1. > > This is a matter of definition, and definitions apparentl

Re: 3D plotting library / OpenGL

2004-12-07 Thread Fernando Perez
Andrew Dalke wrote: > I've been looking for a decent 3D plotting library with support > for user selection that works under OpenGl, preferable with wxPython. > > For this first project I need to do a 3D scatter plot with > different colors and glyphs (spheres, crosses, etc.) for the points. > The

Re: memoize factorial example (was Re: decorators ?)

2004-12-07 Thread Fernando Perez
Fernando Perez wrote: > No, fact(0)==1 simply because any proper definition of a factorial has to > match > up with the gamma function (offset by one) at all non-negative integers. So > there's no room for any ambiguity here. I should have added a link to the ever-useful

Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Fernando Perez
Hi all, I was wondering if someone can help me understand why __getslice__ has been deprecated, yet it remains necessary to implement it for simple slices (i:j), while __getitem__ gets called for extended slices (i:j:k). The problem with this approach, besides a bit of code duplication, is that

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Fernando Perez
Fernando Perez wrote: > Hi all, > > I was wondering if someone can help me understand why __getslice__ has been > deprecated, yet it remains necessary to implement it for simple slices (i:j), > while __getitem__ gets called for extended slices (i:j:k). [...] > def __

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Fernando Perez
Steven Bethard wrote: > Fernando Perez wrote: >> I was wondering if someone can help me understand why __getslice__ has been >> deprecated, yet it remains necessary to implement it for simple slices >> (i:j), while __getitem__ gets called for extended slices (i:j:k). >

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Fernando Perez
Steven Bethard wrote: > Fernando Perez wrote: >> classes which implement slicing must now do runtime type-checking inside >> __getitem__. > > Just in case you thought that they wouldn't have to do runtime > type-checking otherwise: > > >>> class

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Fernando Perez
Terry Reedy wrote: > >> If no __getslice__() is found, a slice object is created instead, and >> passed to __getitem__() instead. > > The overwhelmingl most common case of a simple slice is more efficiently > done by having a separate function since no slice object is created. > a=[1,2,3]

Re: Rationale behind the deprecation of __getslice__?

2004-12-09 Thread Fernando Perez
Steven Bethard wrote: > Presumably the numarray code has to do quite a bit of type checking to > perform all these slicings right (and I didn't even show you what > happens when you use another array as an "index"). I'm not necessarily Yes, I know. I haven't switched to numarray because of the

ANN: IPython 0.6.5 is out.

2004-12-13 Thread Fernando Perez
ocumentation. The NEWS file can be found at http://ipython.scipy.org/NEWS, and the full ChangeLog at http://ipython.scipy.org/ChangeLog. Enjoy, and as usual please report any problems. Regards, Fernando. -- http://mail.python.org/mailman/listinfo/python-list

Re: ".>>>" is a good idea! (OT, was: Re: do you master list comprehensions?)

2004-12-16 Thread Fernando Perez
Kent Johnson wrote: > Keith Dart wrote: >> What I do is set Python's sys.ps1 variable to something else. I have a >> module called "interactive" that I import implicitly by shell alias: >> >> py='python -i -c '\''import interactive'\' >> >> Which, among other things, sets the prompt to "Python>

Re: Adding paths to sys.path permanently, and another problem...

2004-12-16 Thread Fernando Perez
Amir Dekel wrote: > Hi everyone, > > I have two problems: > > 1. How can I keep my changes in sys.path after closing the interpreter? As others said, use $PYTHONPATH > 2. os.path.expanduser("~") always gives me "C:\\" instead of my > homepath. I have tried to change my homepath in WinXP using

Re: ".>>>" is a good idea! (OT, was: Re: do you master list comprehensions?)

2004-12-17 Thread Fernando Perez
Keith Dart wrote: > Fernando Perez wrote: > >> >> >> You might want to look at ipython: >> >> http://ipython.scipy.org, >> >> >> >> > > I did just recently install that. It looks very nice. Would make a great > interac

Bug in inspect.py for python 2.3?

2004-12-17 Thread Fernando Perez
Hi all, IPython has suffered quite a few problems with the inspect module in python 2.3. For these, unfortunately all I've been able to do is guard with overreaching except clauses, as I had not been able to find small, reproducible examples to pass on to the devs. But today I got a crash report

Re: expression form of one-to-many dict?

2004-12-17 Thread Fernando Perez
Steven Bethard wrote: > Actually, it's even smaller now, because I've pretty much removed map > from all my code in favor of list comprehensions, which I find much > easier to read. While I agree that listcomps are more readable in most cases (and certainly for all cases with any amount of comple

Re: Bug in inspect.py for python 2.3?

2004-12-17 Thread Fernando Perez
Terry Reedy wrote: > [I removed the blank lines which made it diffificult to cut and paste.] > [Here is the output (from 2.2) you forgot to include'-):] Yes, that's exactly the output I see. Note that in ipython I have had to protect ALL calls for inspect.get* functions in blanket excepts, becau

lambdas vs functions: a bytecode question

2004-12-17 Thread Fernando Perez
Hi all, there are a couple of threads on lambdas today, which got me curious about their differences as far as bytecode goes: planck[~]|2> lf=lambda x: x**2 planck[~]|3> def ff(x): return x**2 |.> planck[~]|4> import dis planck[~]|5> dis.dis(lf) 1 0 LOAD_FAST0

Re: Bug in inspect.py for python 2.3?

2004-12-17 Thread Fernando Perez
Peter Otten wrote: > Fernando Perez wrote: > >> I'd like to hear from some of our resident gurus if this is really an >> inspect.py bug before I bother the developers with a formal bug report on >> SF. >> The script below illustrates the problem. Just ru

Re: lambdas vs functions: a bytecode question

2004-12-17 Thread Fernando Perez
Erik Max Francis wrote: > Fernando Perez wrote: > >> Can someone explain to me what the extra two bytecodes at the end of the >> function version (ff) are for? >> >> This is just curiosity, please note that I am NOT making any arguments pro >> or against

Re: ANN: IPython 0.6.5 is out.

2004-12-13 Thread Fernando Perez
Fernando Perez wrote: > I'm glad to announce the release of IPython 0.6.6. IPython's homepage is at: Sorry, the _title_ was incorrect. 0.6.6 is indeed a new release put out today, I just copied an old title and missed the change. Regards, f -- http://mail.python.org/mailman/li

Re: gather information from various files efficiently

2004-12-14 Thread Fernando Perez
Keith Dart wrote: > Aye... > > the dict.keys() line creates a temporary list, and then the 'in' does a > linear search of the list. Better would be: > > try: > dict[a].append(b) > except KeyError: > dict[a] = [b] > > since you expect the key to be there most of the time, this method i

Re: expression form of one-to-many dict?

2004-12-20 Thread Fernando Perez
Doug Holton wrote: > Mike Meyer wrote: > >> Personally, I'd love a language feature that let you create a function >> that didn't evaluate arguments until they were actually used - lazy >> evaluation. That lets you write the C ?: operator as a function, for >> a start. >> >> Hmmm. No, iterators

Re: Lambda going out of fashion

2004-12-23 Thread Fernando Perez
Alex Martelli wrote: > I don't know what it IS about lambda that prompts so much dubious to > absurd use, but that's what I observed. I don't know if that plays any > role in Guido's current thinking, though -- I have no idea how much > "dubious Python" he's had to struggle with. Just a side com

  1   2   >