rors (see below
the error output). I'm not sure if this has any relevance but if I change
argument x to a real scalar (instead of an array), then f2py executes fine and
the python module is generated.
I just don't get it! Can anybody explain me what I am doing wrong, please?
Thanks
ty is to use the eval function. Look at this snippet from an idle
session:
>>> s="[(1,2),(3,4)]"
>>> lst=eval(s)
>>> lst
[(1, 2), (3, 4)]
>>> lst[0]
(1, 2)
>>>
Hope this helped
Jose Amoreira
__
On Friday, June 11, 2010 02:57:34 pm Ken G. wrote:
> I have been working on this problem for several days and I am not making
> any progress. I have a group of 18 number, in ascending order, within a
> list. They ranged from 1 to 39. Some numbers are duplicated as much as
> three times or as few
On Friday, June 11, 2010 10:12:27 pm Advertising Department wrote:
> #!/Library/Frameworks/Python.framework/Versions/Current/bin/pythonw
> """still thinking in imperative"
> """
>
> ## obviously this is a bad construct.
> ## Can someone suggest a pythonesque way of doing this?
>
>
> def getid():
like Python, it
smells like Python, it even runs as Python, if you import random from random
beforehand.
Python really is executable pseudo code!
Cheers
Jose Amoreira
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Hi,
This is a somewhat algorithmic question, not strictly pythonic. I was writing
a program to generate all possible n-letter words with letters taken from an
alphabet (I mean, if the alphabet is ['a','b'] the one-letter words are 'a'
and 'b', the two letter words are 'aa', 'ab', 'ba', 'bb' and
On Tuesday, November 23, 2010 02:01:40 pm Mac Ryan wrote:
> The code you wrote generates programs like:
>
> for l0 in alphabet:
> for l1 in alphabet:
> for l2 in alphabet:
> word = "".join([eval("l"+str(i)) for i in range(n)])
> listOfWords.append(word)
>
> wh
Hello
I'm new to this list. I tried to find the answer to my question but found
nothing I could really use. I'm sorry if this is a FAQ.
I want to use a variable defined in an interactive session with the python
interpreter inside a function imported from a module.
For instance, imagine that my
y, thanks again!
Best Regards,
Jose
On Wednesday 14 October 2009 06:18:28 pm Alan Gauld wrote:
> "Jose Amoreira" wrote
>
> > Of course I could redefine my module function, including the parameter a
> > in
> > the list of arguments, but I'd rather not.
>
>
choir, all sorts
of crazy things. That's definitely the time to STOP!, and get some real sleep.
Cheers,
Jose Amoreira
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Hi!
Everytime your program calls function p, list1 is appended to. It keeps on
getting bigger and bigger. The function adds all the elements of the list, but
the total is divided by 1000, even if the list is already much longer that
1000!
And there's another thing. When var1 and var2 are intege
both lists, which may not be
convenient. Of course we can make backup copies of the lists if needed, but we
are then recovering the previous method ugliness...
Do you guys have any suggestions regarding this? Thanks
Jose Amoreira
___
Tutor maillist
Yes, Robert, that does it! Thanks a lot!
Have a nice weekend!
Jose
On Saturday 28 November 2009 10:54:56 am Robert Johansson wrote:
> Hi!
> I want to process corresponding elements of two lists, sequentially. Call
> the
> lists list1 and list2, and assume they have equal lengths. I can do
> someth
Hello!
In "A Primer on Scientific Programming with Python", they define a vectorized
function as a scalar function that, when called with a vector argument,
returns a vector with the values of the function for each of the values stored
in the argument vector.
I am trying to define a constant ve
HiOn Tuesday, November 01, 2011 01:55:18 PM Joel Goldstick wrote:
> On Tue, Nov 1, 2011 at 9:48 AM, Jefferson Ragot wrote:
> > In a Vista command prompt if I typed this:
> > >>> python somescript.py filename
> >
> > Will sys.argv[1] return a valid path or just the filename?
> > If it ju
Hello!
Is there any way to configure tkFileDialogs so that they don't display hidden
files?
Thanks.
Ze Amoreira
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On Tuesday, November 08, 2011 12:38:19 PM Dave Angel wrote:
> On 11/07/2011 09:45 PM, Jose Amoreira wrote:
> > Hello!
> > Is there any way to configure tkFileDialogs so that they don't display
> > hidden files?
> > Thanks.
> > Ze Amoreira
>
> I can'
Hello
I'm trying to plot a false-color map of a two dimensional function. My main
problem is that the function I want to plot depends also on time, and I wish
to show the plot as the function evolves, in real time. My first (and only, so
far) idea on how to achieve this was to iterate the comput
I'm so, so sorry! When editing my script before posting it, I accidently
deleted a line activating matplotlib interactive mode. The correct listing is
the one below.
Hello
I'm trying to plot a false-color map of a two dimensional function. My main
problem is that the function I want to plot dep
On Thursday, February 09, 2012 10:45:35 AM Nate Lastname wrote:
> Have you considered pygame and its surfarray module?
Thanks, Nate. I haven't, but I will.
Ze___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://ma
On Thursday, February 23, 2012 12:57:39 PM David Craig wrote:
> Hi,
> I am trying to write some code that will solve the 2D wave equation by
> the finite difference method, but it just returns an array full of zeros
> and NaN's. Not sure where I am going wrong, the code is attached so if
> could so
Hi.
This is a question about style. I have a class definition that calls a
small auxiliary function. Because this function isn't used anywhere
else, I'd like to include it inside the class definition. However, if
I do that, I'll have to use "self" in the call argument, which is (I
think) rather awk
Hi Mark,
Thanks.
> [SNIP]
>> Let me give an example:
>>
>> def is_odd(k):
>> if k % 2 == 0:
>> return False
>> else:
>> return True
>
>
> I'll point out before anyone else does that you can write this function as a
> one line return. I'll leave you to work out how. Pe
Hello!
On 07/31/2015 01:58 AM, D Wyatt wrote:
I just read in a book a little while ago that ** trumps a negative
sign? I am struggling with the audacity of that as -1 is negative 1,
NOT minus 1.
I'm not sure about what you mean by "trumps", but the square of negative
one is positive one (nega
On 07/31/2015 11:36 AM, Alan Gauld wrote:
On 31/07/15 10:55, Jose Amoreira wrote:
Given the precedence rules already mentioned by Alan and Todd, the
results of the operations you showed us are exactly as expected. You'll
get the same results if you try with a pocket calculator or usin
Hello
Suppose I have a list l_obj of similar objects. Is there any way I can
generate a list l_prp of references to a given property of those objects in
such a way that, if change the value of one element in l_prp, the
corresponding object in l_obj gets its property updated, and vice-versa?
Let giv
Thanks, Peter.
I was trying to avoid the regenerate step for updating. But maybe I can
restructure my code and objects to make this simpler. Before that I'll try
this view approach.
Thanks again
Ze
On Fri, Jan 18, 2013 at 11:37 AM, Peter Otten <__pete...@web.de> wrote:
> Jose
27;t like it. It'd be better (no duplication) if it was just a
list of references to the values stored in the planet objects, I think.
But I see your point.
Thanks again,
Jose Amoreira
___
Tutor maillist - Tutor@python.org
To unsubscribe or change
13]
In [7]: l[:][1]
Out[7]: [21, 22, 23]
Why is this so?
Thanks,
Jose Amoreira
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Jose,
Just for clarity, are you trying to access a particular *column* in your
last example?
Bob
Yes, that's it! I wanted to say "column", not "row" in my last example.
Sorry about that! Thanks
Jose
___
Tutor maillist - Tutor@python.org
To unsu
On 03/28/2014 10:32 AM, Alan Gauld wrote:
No, standard slices on the first element will give you sublists of the
first row. Python doesn't have any concept of that second dimension, it
only sees a list of items. The fact those items are themselves lists is
purely incidental to the interpreter.
Hello
I wrote a function that, given a list of numbers, finds clusters of
values by proximity and returns a reduced list containing the centers of
these clusters. However, I find it rather unclear. I would appreciate
any comments on how pythonic my function is and suggestions to improve
its re
Hi!
On 07/16/2014 10:14 PM, Wolfgang Maier wrote:
careful here: you just stored a tuple instead of a list; doesn't matter
for your current implementation, but may bite you at some point.
Oh, you're right. Silly mistake, even if harmless for the application I
have in mind.
else:
Hello,
On 07/17/2014 12:05 AM, Alan Gauld wrote:
Just throwing this idea in without really thinking about it...
Would itertools.groupby work?
It takes a sorted collection and groups the items found based on a key
function. If the key function deemed two items identical if they were
within dist
Hello
I stumbled on something I found surprising. I'm using standard python
(cpython, I guess) 2.7 on openSuse 13.1.
Consider the function
In [2]: def f(x,y=[]):
...: print y
...: y.append(x)
...: return x
This is the output of repeated calls to this function:
In [3]: f(
Hi
On 07/17/2014 06:34 PM, Danny Yoo wrote:
Yeah; the default value is not reevaluated between calls. It's a common
gotcha. Here are a few links to read more:
http://effbot.org/zone/default-values.htm
http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments
Good
36 matches
Mail list logo