Re: How to retrieve the filename of a module

2005-10-20 Thread Jim O'D
mku wrote: > Hi, > > thereĀ“s a function inside a module. How can these function retrieve > the path+name of his module ? (The path is most important). > That should also work if the module is part of a package. > > Thanks in advance > > Martin > Try the following in the function: import tra

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

2005-10-17 Thread Jim O'D
> With the new numeric, you'll be able to do: > > negatives = a[a<0] > > Cheers, > > f > Ooh, that's nice. Jim -- http://mail.python.org/mailman/listinfo/python-list

Re: my array subset method could be improved?

2005-10-14 Thread Jim O&#x27;D
> > new = Numeric.compress(Numeric.less(a,0),a) Ah, thank you! Sorry about subject mangle, I gave a silly example first time round. Jim -- http://mail.python.org/mailman/listinfo/python-list

array subset could be improved? -repost ;)

2005-10-14 Thread Jim O&#x27;D
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. Method 1. new = array([i for i in a if i < 0]) Method 2. new = a[nonzero(a<0)] I'm using Numeric arrays but can't seem to find a function that does this. Am I missing a more o

my array subset method could be improved?

2005-10-14 Thread Jim O&#x27;D
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. Method 1. new = array([i for i in a if i < 0]) Method 2. new = a[nonzero(a<0)] I'm using Numeric arrays but can't seem to find a function that does this. Am I missing a more ob

Re: assignment, references and list comprehension

2005-05-26 Thread Jim O&#x27;D
> reading this may help: > > http://effbot.org/zone/python-objects.htm > > > > > site bookmarked ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: assignment, references and list comprehension

2005-05-26 Thread Jim O&#x27;D
> trust me, it works the same way for all objects. > > Yes, it was lack of trust that led me on a 2 hour re-write to avoid creating subsets of object lists as I thought they were being copied. In fact it was another error... huh. I now know better. Jim -- http://mail.python.org/mailman/lis

assignment, references and list comprehension

2005-05-26 Thread Jim O&#x27;D
Hi everyone Was just posting a question as I got confused with a big messy sheaf of code when I thought I should make a simple example myself. Since I did I thought I'd post it for the good of mankind. I was confused as to whether the assignment of a result of a list comprehension created refe