473,382 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Pivy problem and some other stuff

Hy Guys

Did anyone manage to install and use Pivy. I'm trying it and cant come
closer to the goal I get the message:
Please set the COIN3DDIR environment variable to your Coin root
directory! ** Aborting **

Familiar to anyone?

And there is anoher question in my mind.
Is there a way to make a list in python which contains a series of
functions. I did'n try it. Something like:
>>>def a():
return 1
>>>def b():
return 2
>>>def c():
return 3
>>>def d():
return 4
>>list=[a(),b(),c(),d()]
list
[1,2,3,4]

I kow that for this kind of stuff this in not neccesarry, but for
other suff it, gets interesting.

Aug 30 '07 #1
7 1027
On Thu, 30 Aug 2007 19:21:47 +0000, azrael wrote:
And there is anoher question in my mind.
Is there a way to make a list in python which contains a series of
functions. I did'n try it. Something like:
Why don't you just try!?
>>>>def a():
return 1
>>>>def b():
return 2
>>>>def c():
return 3
>>>>def d():
return 4
>>>list=[a(),b(),c(),d()]
list
[1,2,3,4]
This isn't a list of functions but a list of results of function calls.
If you want the functions in that list then leave off the parentheses,
because those are the "call operator".

In [55]: def a():
....: return 1
....:

In [56]: def b():
....: return 2
....:

In [57]: funcs = [a, b]

In [58]: funcs
Out[58]: [<function a at 0xb7792e2c>, <function b at 0xb779e1ec>]

In [59]: funcs[0]()
Out[59]: 1

In [60]: funcs[1]()
Out[60]: 2

Ciao,
Marc 'BlackJack' Rintsch
Aug 30 '07 #2
azrael a écrit :
Hy Guys

Did anyone manage to install and use Pivy. I'm trying it and cant come
closer to the goal I get the message:
Please set the COIN3DDIR environment variable to your Coin root
directory! ** Aborting **

Familiar to anyone?
I don't even know what Pivy is, but it obviously wants you to set an
environment variable (how you do so depends on your environment - on
most linux distros, and AFAIK on most unix systems, it's usually done in
your ~/.bash_profile file) named COIN3DIR and pointing to a directory !-)
Aug 30 '07 #3
Marc 'BlackJack' Rintsch wrote:
A fine repy
In [57]: funcs = [a, b]
In [58]: funcs
Out[58]: [<function a at 0xb7792e2c>, <function b at 0xb779e1ec>]

In [59]: funcs[0]()
Out[59]: 1

In [60]: funcs[1]()
Out[60]: 2
and a "list comprehension" allows you to call these things no matter how
long the list is.

So after the above:
>>results = [f() for f in funcs]
print results
[1, 2]
Aug 31 '07 #4
Look, what I think about is this.
I'd like to make a multi dimensional list in which evry single element
would represent a function. By looping through the list I would
execute the functions. But not only that, it is possible to experiment
with recoursions.
the return 1 2 and 3 examples are just a examples. Of course that the
thing I'm thinking about is a little bit more complex.

Sep 1 '07 #5
On Aug 30, 8:10 pm, Scott David Daniels <dani...@dsl-only.netwrote:
Marc 'BlackJack' Rintsch wrote:

A fine repy
In [57]: funcs = [a, b]
In [58]: funcs
Out[58]: [<function a at 0xb7792e2c>, <function b at 0xb779e1ec>]
In [59]: funcs[0]()
Out[59]: 1
In [60]: funcs[1]()
Out[60]: 2

and a "list comprehension" allows you to call these things no matter how
long the list is.

So after the above:
>>results = [f() for f in funcs]
>>print results
[1, 2]
You can also use exec, but someone will tell you that the sky is going
to fall if you do. I am one of the ones who think that calling a
function with
results = [f() for f in funcs]
doesn't "work" because it gives a meaningless error message that the
calling line didn't work. There is already enough discussion about
this, so if you use "some_string()" to call a function, wrap it in a
try/except with a traceback.

Sep 2 '07 #6
On Sun, 02 Sep 2007 14:35:00 +0000, Zentrader wrote:
You can also use exec, but someone will tell you that the sky is going
to fall if you do. I am one of the ones who think that calling a
function with
results = [f() for f in funcs]
doesn't "work" because it gives a meaningless error message that the
calling line didn't work.
What meaningless error message are you talking about!?

Ciao,
Marc 'BlackJack' Rintsch
Sep 2 '07 #7
What meaningless error message are you talking about!?
>
Ciao,
Marc 'BlackJack' Rintsch
My mistake. It appears that this is no longer the case. And my
apologies. It was probably in version 2.3 or earlier that this was a
problem. Given the way that the Python community constantly improves
the language, I should have checked first, but "shoulds" don't count.

Sep 2 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Hal Vaughan | last post by:
If I have a class like this: public class Tester { ObjectType1 ot1; ObjectType2 ot2; ObjectType3 ot3; public void main(String args) { //Preliminary checking, resulting in bRun being
6
by: Karl A. Krueger | last post by:
I'm in the middle of refactoring a small mod_python Web application, which uses the Publisher handler. This application is currently a single main Python file (which loads several other files as...
24
by: Charif Lakchiri | last post by:
Okay, here's what I know so far about Python: It's an object-oriented scripting language, supported on many platforms. Now here are my questions: It is easy to learn? Does it support GUI...
1
by: Chump Wad | last post by:
I will now die. I am too ignorant to make it work. 10.2.setEventCB.py segfaults for me. It is almost there, but it is not there. SoQt.init returns a string, which I can't use as the parent...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
4
by: lawrence | last post by:
Can anyone tell me why this code works in Netscape 7.1 but not in IE??? <SCRIPT type='text/javascript'> function makeVisible(nameOfDiv) {...
7
by: David Sworder | last post by:
Hi, I'm developing an application that will support several thousand simultaneous connections on the server-side. I'm trying to maximize throughput. The client (WinForms) and server communicate...
64
by: yossi.kreinin | last post by:
Hi! There is a system where 0x0 is a valid address, but 0xffffffff isn't. How can null pointers be treated by a compiler (besides the typical "solution" of still using 0x0 for "null")? -...
5
by: Kentor | last post by:
Hello, how can I grab some information from other websites? Like for example the way housingmaps.com is grabbing stuff from craigslist.org ... Can someone redirect me to a few examples of where...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.