ipython-0.5 and returned tuples
f(x) returns a 2-tuple. This works fine under 0.4, but 0.5 reports the following. In [23]: sum,diff = f(1) ------------------------------------------------------------ File "<console>", line 1 sum(,diff = f(1)) ^ SyntaxError: invalid syntax -------> sum(,diff = f(1)) -- Jeffery Collins (http://www.boulder.net/~jcollins)
Jeffery D. Collins wrote:
f(x) returns a 2-tuple. This works fine under 0.4, but 0.5 reports the following.
In [23]: sum,diff = f(1) ------------------------------------------------------------ File "<console>", line 1 sum(,diff = f(1)) ^ SyntaxError: invalid syntax
-------> sum(,diff = f(1))
Noted, maybe I can fix one real quick. In the meantime, keep in mind this bug will be triggered only if sum was a function to begin with: In [2]: def f(): ...: return 1,2 ...: In [3]: f() Out[3]: (1, 2) In [4]: x,y=f() In [5]: x Out[5]: 1 In [6]: y Out[6]: 2 In [7]: x=f In [8]: x,y=f() ------> x(,y=f()) ------------------------------------------------------------ File "<console>", line 1 x(,y=f()) ^ SyntaxError: invalid syntax Only when 'x' is assigned to be a callable does the bug surface. So as a temporary workaround, don't reassign to callables as the _first_ item for a list unpacking :) But it IS a bug, I'll look into it (I think it's easy). Cheers, f.
Thanks for pointing that out:) I often use "sum" in my algorithms, forgetting that it's a numeric function. Fernando Perez wrote:
Jeffery D. Collins wrote:
f(x) returns a 2-tuple. This works fine under 0.4, but 0.5 reports the following.
In [23]: sum,diff = f(1) ------------------------------------------------------------ File "<console>", line 1 sum(,diff = f(1)) ^ SyntaxError: invalid syntax
-------> sum(,diff = f(1))
Noted, maybe I can fix one real quick. In the meantime, keep in mind this bug will be triggered only if sum was a function to begin with:
In [2]: def f(): ...: return 1,2 ...:
In [3]: f() Out[3]: (1, 2)
In [4]: x,y=f()
In [5]: x Out[5]: 1
In [6]: y Out[6]: 2
In [7]: x=f
In [8]: x,y=f() ------> x(,y=f()) ------------------------------------------------------------ File "<console>", line 1 x(,y=f()) ^ SyntaxError: invalid syntax
Only when 'x' is assigned to be a callable does the bug surface. So as a temporary workaround, don't reassign to callables as the _first_ item for a list unpacking :) But it IS a bug, I'll look into it (I think it's easy).
Cheers,
f.
_______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user
-- Jeffery Collins (http://www.boulder.net/~jcollins)
Jeffery D. Collins wrote:
Thanks for pointing that out:) I often use "sum" in my algorithms, forgetting that it's a numeric function.
By the way, the fix is super simple. I doubt I'll find the time to make a relase before leaving, but you can apply it yourself in one minute. Change line 999 of iplib.py from: (len(theRest)==0 or theRest[0] not in '!=()<>[') and \ to: (len(theRest)==0 or theRest[0] not in '!=()<>[,') and \ The only change is the added ',' in the string of characters to avoid. This should do, since it seems to catch all unpacking situations. Let me know if it works ok for you, and when I return I'll add it to a release. I'll put this in CVS in a minute for those who use the code from CVS. Thanks for the report! Cheers, f.
Fernando Perez wrote:
Jeffery D. Collins wrote:
Thanks for pointing that out:) I often use "sum" in my algorithms, forgetting that it's a numeric function.
By the way, the fix is super simple. I doubt I'll find the time to make a relase before leaving, but you can apply it yourself in one minute.
Change line 999 of iplib.py from:
(len(theRest)==0 or theRest[0] not in '!=()<>[') and \ to: (len(theRest)==0 or theRest[0] not in '!=()<>[,') and \
The only change is the added ',' in the string of characters to avoid. This should do, since it seems to catch all unpacking situations.
Let me know if it works ok for you, and when I return I'll add it to a release. I'll put this in CVS in a minute for those who use the code from CVS.
That works! -- Jeffery Collins (http://www.boulder.net/~jcollins)
Jeffery D. Collins wrote:
Let me know if it works ok for you, and when I return I'll add it to a release. I'll put this in CVS in a minute for those who use the code from CVS.
That works!
Great. The fix is in CVS now. The readline problem will be, I suspect, a LOT nastier to track down, especially b/c I'll have to deal (it seems) with undocumented changes to the underlying C module. That will probably take a while. Cheers, f.
There have been a few threads on this with no definitive answers. Is there a way that works? I can report that the fink version is outdated, calling for pdflib-4.0.3 which is no longer available from pdflib.com. I was able to find pdflib-4.0.3 on a kde ftp site, so I got past that, but experienced network problems, so the installation didn't have a chance to finish. Clearly: some people have it running, and others have struggled. Anyone wish to share their wisdom? -Gary
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I think Bob Ippolito may be working on a MacPython-2.3 Package Manager release which uses Apple's vecLib, so let's keep our fingers crossed... (I suppose one might accelerate this process by hiring him. He's definitely a whiz at getting stuff to work on OS X.) In the meantime, I exist quite happily by grabbing ATLAS from fink, but using the "official" MacPython-2.3 from Jack Jansen and compiling scipy (and other python modules not available through Package Manager) from CVS sources. I posted some stuff to this list about a few tweaks to scipy's build system -- I think site.cfg or something. Other details: g77 3.1 doesn't like the MACOSX_DEPLOYMENT_TARGET=10.2. shuksan ~$ g77 -v Reading specs from /sw/lib/gcc-lib/powerpc-apple-darwin6.6/3.1/specs Configured with: ../gcc3/configure --prefix=/sw --enable-languages=f77 - --infodir=${prefix}/share/info Thread model: single Apple Computer, Inc. GCC version 1151, based on gcc version 3.1 20020420 (prerelease) shuksan ~$ gcc -v Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs Thread model: posix gcc version 3.3 20030304 (Apple Computer, Inc. build 1435) Good luck! Andrew On Wednesday, Sep 10, 2003, at 12:08 Australia/Adelaide, Gary Pajer wrote:
There have been a few threads on this with no definitive answers.
Is there a way that works?
I can report that the fink version is outdated, calling for pdflib-4.0.3 which is no longer available from pdflib.com. I was able to find pdflib-4.0.3 on a kde ftp site, so I got past that, but experienced network problems, so the installation didn't have a chance to finish.
Clearly: some people have it running, and others have struggled. Anyone wish to share their wisdom?
-Gary
_______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user
-----BEGIN PGP SIGNATURE----- iD8DBQE/XpgX1xWcCSPVbpgRAn3hAKD82JSAe3fJejBO7znsHWFC0Hy12gCeI4xV Yzb9NUSVyWrmHZWk5yc4Fx4= =pXz7 -----END PGP SIGNATURE-----
From: "Andrew Straw" <andrew.straw@adelaide.edu.au>
I think Bob Ippolito may be working on a MacPython-2.3 Package Manager release which uses Apple's vecLib, so let's keep our fingers crossed...
Thanks to all who have responded to my post. I'm new to Mac, and still getting used to things. Do I understand correctly that the "porting" of scipy will be to the MacPython system and not the fink distribution? Will we always have two mutually exclusive pythons for Mac? (<-- that's got to be a very FAQ) Is one dominant over the other? OK, I'm getting off topic ... - Gary
On Wednesday, Sep 10, 2003, at 22:37 America/New_York, Gary Pajer wrote:
From: "Andrew Straw" <andrew.straw@adelaide.edu.au>
I think Bob Ippolito may be working on a MacPython-2.3 Package Manager release which uses Apple's vecLib, so let's keep our fingers crossed...
Thanks to all who have responded to my post.
I'm new to Mac, and still getting used to things. Do I understand correctly that the "porting" of scipy will be to the MacPython system and not the fink distribution? Will we always have two mutually exclusive pythons for Mac? (<-- that's got to be a very FAQ) Is one dominant over the other? OK, I'm getting off topic ...
We'll probably have two (or three, if you count Apple's, but Apple's is essentially MacPython missing the tools and some modules) mutually exclusive Python distributions as long as Fink is around. Someone from the Fink project may independently port SciPy to OS X, but I write and port software for use with the official MacPython, so you're not going to see a Fink version from me. MacPython will eventually be dominant over Fink's if I have anything to say about it :) For now, Fink has a few Python extensions that MacPython does not, particularly with regard to stuff that requires X11, and Fink is (probably?) missing quite a few of the Carbon/Cocoa sort of modules. In any case, if there's a module that you can't compile yourself for MacPython, that does not require X11, post to pythonmac-sig and someone will likely port it for you or help you along the way. -bob
I'm trying to install scipy on OSX using the Fink installer. As noted earlier, I had to find and manually download pdflib-4.0.3 because pdflib.com is delivering 5.x.x. Fink stops at one point, reporting a checksum problem with pdflib. I just said go ahead anyway. With that, lots of compiling takes place. I'm stuck now because Fink is trying to install numeric-atlas, but it finds already installed both numeric and numeric-py22. Fink stops here, refusing to go beyond this conflict. Since I have numeric-py22 already, is there some way to force Fink to ignore this step? I'm not sure how/why two versions of numeric are registered as installed. (Recall I'm new at the Mac.) In the actual filestructure, only numeric-py22 exists. (that is, /sw/lib/python22/site-packages) I've installed several packages; apparantly numeric was installed twice. Only one seems to exist, yet both are registered with Fink as being installed. I tried sudo fink remove numeric sudo fink remove numeric-py22 after which both packages are no longer registered, *and* I mangled the name of the numeric directory and numeric.pth in the hopes that the scipy installation would see nothing installed, and install numeric-atlas. But no, it still finds numeric-py22 as installed, and quits. (I also have MacPython installed ... but shouldn't that be entirely independent?) So once again, I beseech thee for help. -Gary
I think the Fink list it'd be a better place to ask for. I'm sure you can find much more help there. By the way I use Fink and I installed scipy last week without a problem. In order to solve your problem I need more information about your configuration. What's your output for: % fink list numeric % fink list scipy % fink list atlas I suspect you are trying to install scipy (old realese) instead of scipy-py22 (new one). Cheers, Andrea. On Friday, Sep 12, 2003, at 02:16 Europe/Rome, Gary Pajer wrote:
I'm trying to install scipy on OSX using the Fink installer. As noted earlier, I had to find and manually download pdflib-4.0.3 because pdflib.com is delivering 5.x.x. [snip]
Andrea Riciputi "Science is like sex: sometimes something useful comes out, but that is not the reason we are doing it" -- (Richard Feynman)
participants (6)
-
Andrea Riciputi -
Andrew Straw -
Bob Ippolito -
Fernando Perez -
Gary Pajer -
Jeffery D. Collins