On 10/03/2010 01:16 AM, Antoine Pitrou wrote:
You should check that you aren't doing anything wrong
with "env" and "start_response" (like deallocate them forcefully).
I commented out the `Py_DECREF(start_response)` after the `app` call and
the crash was gone. `start_response` is created via `P
, the stack trace being:
>
>#1 frame_clear ()
>#2 collect ()
>#3 _PyObject_GC_Malloc ()
[...]
>
> Now that is weird. The only difference between the two functions is that
> the second one (with the assignment) keeps a reference to the exc_info
> tuple in the
Hello list,
I have a really weird reference problem with `sys.exc_info`, and, if I'm
right, function frames.
The software in question is bjoern, a WSGI web server written in C,
which you can find at http://github.com/jonashaag/bjoern.
This WSGI application:
def app(env, start_res
Laszlo Nagy wrote:
In my shopzeus.db.pivot.convert.py file, in the run() method of my
Data2Facts class, I can write this into the docstring:
...you may have more joy asking about this on the Sphinx list:
http://groups.google.com/group/sphinx-dev
cheers,
Chris
--
http://mail.python.org/mai
In my shopzeus.db.pivot.convert.py file, in the run() method of my
Data2Facts class, I can write this into the docstring:
class Data2Facts(threading.Thread):
# code here...
def prepare(self,*args):
# code here...
# more code here
def run(self):
"""
Star
Bruno Desthuilliers wrote:
Would be better with :
return self.func(obj, *args, *kwds)
Thanks -- well spotted!
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
Gregory Ewing a écrit :
(snip)
import weakref
class weakmethod(object):
def __init__(self, bm):
self.ref = weakref.ref(bm.im_self)
self.func = bm.im_func
def __call__(self, *args, **kwds):
obj = self.ref()
if obj is None:
raise ValueError("Calling dead weak method")
Hi Christiaan,
> Instances of a class have no means of storing the bound method object.
> The or unbound bound method is a simple and small wrapper that keeps a
> reference to the class, "self" and the function object. Python keeps a
> pool of empty method objects in a f
Hi Gregory,
> You can create your own wrapper that keeps a weak reference to
> the underlying object. Here's an example.
> [...]
Thanks for the code!
Regards,
Vincent
--
http://mail.python.org/mailman/listinfo/python-list
Vincent van Beveren wrote:
I was working with weak references in Python, and noticed that it
> was impossible to create a weak-reference of bound methods.
> is there anything I can do about it?
You can create your own wrapper that keeps a weak reference to
the underlying object. Her
the bound method object.
The or unbound bound method is a simple and small wrapper that keeps a
reference to the class, "self" and the function object. Python keeps a
pool of empty method objects in a free list. The creation of a new bound
method just takes a few pointer assignment
Vincent van Beveren wrote:
> I did not know the object did not keep track of its bound methods. What
> advantage is there in creating a new bound method object each time its
> referenced? It seems kind of expensive.
While I didn't measure it I suppose that it saves a lot of memory.
Peter
--
htt
: vrijdag 30 juli 2010 15:06
To: python-list@python.org
Subject: Re: The untimely dimise of a weak-reference
Vincent van Beveren wrote:
> Hi everyone,
>
> I was working with weak references in Python, and noticed that it was
> impossible to create a weak-reference of bound methods. Here
Vincent van Beveren wrote:
> Hi everyone,
>
> I was working with weak references in Python, and noticed that it was
> impossible to create a weak-reference of bound methods. Here is a little
> python 3.0 program to prove my point:
>
> import weakref
>
> print(&quo
Hi everyone,
I was working with weak references in Python, and noticed that it was
impossible to create a weak-reference of bound methods. Here is a little python
3.0 program to prove my point:
import weakref
print("Creating object...")
class A(object):
def b(self):
On Thu, Jul 1, 2010 at 10:08 PM, John Nagle wrote:
> On 7/1/2010 10:02 PM, Chris Rebert wrote:
>> On Thu, Jul 1, 2010 at 9:50 PM, John Nagle wrote:
>>> Is there a reference manual for "pyparsing"? Not a tutorial. Not a
>>> wiki.
>>> Not a
On 7/1/2010 10:02 PM, Chris Rebert wrote:
On Thu, Jul 1, 2010 at 9:50 PM, John Nagle wrote:
Is there a reference manual for "pyparsing"? Not a tutorial. Not a wiki.
Not a set of examples. Not a "getting started guide".
Something that actually documents what each pr
On Thu, Jul 1, 2010 at 9:50 PM, John Nagle wrote:
> Is there a reference manual for "pyparsing"? Not a tutorial. Not a wiki.
> Not a set of examples. Not a "getting started guide".
> Something that actually documents what each primitive does?
http://pyparsi
Is there a reference manual for "pyparsing"? Not a tutorial. Not a
wiki. Not a set of examples. Not a "getting started guide".
Something that actually documents what each primitive does?
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
ft.com/en-us/library/system.windows.controls.stackpanel.aspx
StackPanel is in the System.Windows.Controls Namespace
When I try and set up a reference to that Namespace I get a "Could not
add reference to assembly
System.Windows.Controls" error on the line that reads
clr.AddReference('System.Window
In article , WH wrote:
>
>'x' in getattr() should be a reference to the "__main__" module, right?
>How to get it?
Just for the record, the best way to get a reference to __main__ is to
import it:
import __main__
--
Aahz (a...@pythoncraft.com) <*>
On Tue, 08 Jun 2010 22:29:04 -0700, WH wrote:
> Hi,
>
> I want to use one of two functions in a script:
>
> def func_one(): pass
> def func_two(): pass
>
> func = getattr(x, 'func_'+number)
> func()
>
> 'x' in getattr() should be a refere
On Tue, Jun 8, 2010 at 10:29 PM, WH wrote:
> Hi,
>
> I want to use one of two functions in a script:
>
> def func_one(): pass
> def func_two(): pass
>
> func = getattr(x, 'func_'+number)
> func()
>
> 'x' in getattr() should be a reference to
Hi,
I want to use one of two functions in a script:
def func_one(): pass
def func_two(): pass
func = getattr(x, 'func_'+number)
func()
'x' in getattr() should be a reference to the "__main__" module, right?
How to get it? The 'if' clause should work he
On Mon, May 31, 2010 at 2:46 PM, eb303 wrote:
> On May 29, 3:11 pm, Pradeep B wrote:
>> Do we have a standard reference library for Tkinter available?
>>
>> --
>> Pradeep
>
> Short answer: no, at least not a complete one for Tkinter itself.
>
> However, t
On May 29, 3:11 pm, Pradeep B wrote:
> Do we have a standard reference library for Tkinter available?
>
> --
> Pradeep
Short answer: no, at least not a complete one for Tkinter itself.
However, there is a complete reference for tcl/tk here:
http://www.tcl.tk/man/tcl8.5/
Once yo
Do you mean Tkinter API reference documentation ? If so, this is what I've
used years back http://www.nmt.edu/tcc/help/pubs/tkinter.pdf
you can also get some info from http://effbot.org/tkinterbook
On Sat, May 29, 2010 at 6:41 PM, Pradeep B wrote:
> Do we have a standard reference lib
Do we have a standard reference library for Tkinter available?
--
Pradeep
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 27, 11:45 pm, Michal M wrote:
> I've just found out that one of objects is not destroyed when it
> should be. This means that something was holding reference to this
> object or part of it (i.e. method). Is there any way to check what
> holds that reference? I am unabl
On Apr 28, 3:59 pm, Christian Heimes wrote:
> The trick works only for objects that are tracked by CPython's garbage
> collector. Simple and non-containerish objects like str, int, unicode
> and some other types aren't tracked by the gc.
Yes they are -- have you ever tried
>>> import gc
>>>
Almar Klein wrote:
Ah, it does exist! I wish I knew that two months ago, it would've saved me
some precious time ;)
The trick works only for objects that are tracked by CPython's garbage
collector. Simple and non-containerish objects like str, int, unicode
and some other types aren't tracked
On 27 April 2010 23:08, Chris Rebert wrote:
> On Tue, Apr 27, 2010 at 1:45 PM, Michal M
> wrote:
> > I've just found out that one of objects is not destroyed when it
> > should be. This means that something was holding reference to this
> > object or part of it (i
t found out that one of objects is not destroyed when it
> >>> > should be. This means that something was holding reference to this
> >>> > object or part of it (i.e. method). Is there any way to check what
> >>> > holds that reference? I am unable to do
hould be. This means that something was holding reference to this
>>> > object or part of it (i.e. method). Is there any way to check what
>>> > holds that reference? I am unable to do that just looking to the code
>>> > or debugging it because it is pretty compli
On Tue, Apr 27, 2010 at 2:42 PM, Michal M wrote:
> On 27 Kwi, 23:21, Duncan Booth wrote:
>> Michal M wrote:
>> > I've just found out that one of objects is not destroyed when it
>> > should be. This means that something was holding reference to this
>> &g
On 27 Kwi, 23:21, Duncan Booth wrote:
> Michal M wrote:
> > Hi
>
> > I've just found out that one of objects is not destroyed when it
> > should be. This means that something was holding reference to this
> > object or part of it (i.e. method). Is there a
Michal M wrote:
> Hi
>
> I've just found out that one of objects is not destroyed when it
> should be. This means that something was holding reference to this
> object or part of it (i.e. method). Is there any way to check what
> holds that reference? I am unable to do t
On Tue, Apr 27, 2010 at 1:45 PM, Michal M wrote:
> I've just found out that one of objects is not destroyed when it
> should be. This means that something was holding reference to this
> object or part of it (i.e. method). Is there any way to check what
> holds that reference?
> I've just found out that one of objects is not destroyed when it
> should be. This means that something was holding reference to this
> object or part of it (i.e. method). Is there any way to check what
> holds that reference? I am unable to do that just looking to the code
Michal,
May I ask why do you care about the object's management? Let Python worry
about that. What's your use case?
--
http://mail.python.org/mailman/listinfo/python-list
Hi
I've just found out that one of objects is not destroyed when it
should be. This means that something was holding reference to this
object or part of it (i.e. method). Is there any way to check what
holds that reference? I am unable to do that just looking to the code
or debugging it be
On Apr 12, 4:27 pm, Gerhard Häring
wrote:
> Maybe somebody can enlighten me here. I can't figure out why doing a
> rich comparison on my object decreases the total reference count by 1. [...]
Doh! It turned out the strange effect was due to my particular build
process.
My Python
Can be run like this:
ghaer...@ws124~/src/gh/test$ python3 setup.py build_ext --inplace
running build_ext
building 'foo' extension
gcc -fno-strict-aliasing -g -fwrapv -O0 -Wall -Wstrict-prototypes -
arch i386 -m32 -I/opt/jetstream/include/python3.1 -c foo.c -o build/
temp.macosx-10.4-i386-3.1-pyde
Maybe somebody can enlighten me here. I can't figure out why doing a
rich comparison on my object decreases the total reference count by 1.
Linked is the minimal test case with a C exension that compiles under
both Python 2.6 and 3.1. No external dependencies, except a DEBUG
build of Pyth
On Wed, Mar 24, 2010 at 10:34 AM, John Smithury wrote:
> ==source
> the
> is
> name
> ==source end=
>
> First, get the word only(discard the "" and ""), it can use
> regular expression, right?
>
> the
> is
> name
> Second, get a charactor in each word an
On Wed, Mar 24, 2010 at 10:07 AM, John Smithury wrote:
> Dear pythoners,
>
> I'm a new member to studay the python, i wan't to studay the "regular
> expressions" handle like below:
>
> ==source
> the
> is
> name
> ==source end=
>
>
> after convert, the r
Dear pythoners,
I'm a new member to studay the python, i wan't to studay the "regular
expressions" handle like below:
==source
the
is
name
==source end=
after convert, the result like below:
-result
{'t
On Fri, 05 Feb 2010 09:53:33 -0600, David Thole wrote:
> I read thisand am a tiny bit confused about the actual problem.
>
> It's not exactly complex to realize that something like: a = b = array
> that a and b both point to the array.
>
> Logically speaking, I'm not sure how one could assum
["Followup-To:" header set to comp.lang.perl.misc.]
Jürgen Exner wrote:
> David Thole wrote in comp.lang.perl.misc:
>>I read thisand am a tiny bit confused about the actual problem.
>>
>>It's not exactly complex to realize that something like:
>>a = b = array
>>that a and b both point to th
want two additional references to the same array
insted then you have to create that reference first and assign that
reference to $a and $b instead of copying the array, see "perldoc
perlref" for details. And remember, references are scalars, no matter if
they reference other scalars or ar
I read thisand am a tiny bit confused about the actual problem.
It's not exactly complex to realize that something like:
a = b = array
that a and b both point to the array.
Logically speaking, I'm not sure how one could assume that the same
assignment would yield a and b point to the same dup
Paul Rubin wrote:
Ryan Kelly writes:
I know, I know, do not feed the trolls. But this is just so *wrong*
that I can't help myself.
See: http://xkcd.com/386/
:-)
--
http://mail.python.org/mailman/listinfo/python-list
()On Feb 2, 6:46Â pm, Ryan Kelly wrote:
> > On Tue, 2010-02-02 at 17:28 -0800, Xah Lee wrote:
>
> I know, I know, do not feed the trolls. Â But this is just so *wrong*
> that I can't help myself.
>
> > In Python, there are 2 ways to clear a hash:
>
> No, no there's not. Â There's one way to clear
Ryan Kelly writes:
> I know, I know, do not feed the trolls. But this is just so *wrong*
> that I can't help myself.
See: http://xkcd.com/386/
--
http://mail.python.org/mailman/listinfo/python-list
> On Tue, 2010-02-02 at 17:28 -0800, Xah Lee wrote:
I know, I know, do not feed the trolls. But this is just so *wrong*
that I can't help myself.
> In Python, there are 2 ways to clear a hash:
No, no there's not. There's one way to clear a hash and there's one way
to assign a new object to a
just wrote this essay. Comment & feedback very welcome.
Python's Reference And Internal Model Of Computing Languages
Xah Lee, 2010-02-02
In Python, there are 2 ways to clear a hash: âmyHash = {}â and
âmyHash.clear()â. What is the difference?
â
The difference is that âm
Joel Davis wrote:
>
>Emile, essentially, the situation is that I'm trying to create an API
>for consumption scripting. As it stands now, in initial development
>they can pass callback function. The idea was to enable them to pass
>variables and have the handling function determine the type and jus
, are
they Python programmers, are they scientists?
Presumably you're trying to define a language (not Python) that these
users can program in, where you want to achieve call by reference. I'm
sure you have some good reason for that, but could we hear it?
When you need to do something
Joel Davis wrote:
I'm just curious if anyone knows of a way to get the variable name of
a reference passed to the function.
Put another way, in the example:
def MyFunc ( varPassed ):
print varPassed;
MyFunc(nwVar)
how would I get the string "nwVar" from inside of
Joel Davis wrote:
On Dec 29, 11:21 am, Emile van Sebille wrote:
On 12/29/2009 7:02 AM Joel Davis said...
On Dec 29, 2:29 am, "Gabriel Genellina"
wrote:
I'm sure other limitations apply too -- don't rely on this technique for
anything critical.
--
Gabriel Genellina
Gabriel,
thanks for your i
On Dec 29, 11:21 am, Emile van Sebille wrote:
> On 12/29/2009 7:02 AM Joel Davis said...
>
> > On Dec 29, 2:29 am, "Gabriel Genellina"
> > wrote:
> >> I'm sure other limitations apply too -- don't rely on this technique for
> >> anything critical.
>
> >> --
> >> Gabriel Genellina
>
> > Gabriel,
>
On Tue, Dec 29, 2009 at 8:17 AM, Joel Davis wrote:
> did set the tone and I think I've been more than a little tolerant on
> this. Someone posts a question, responds back with a "n/m I found the
> solution, here it is" and his response is essentially to berate them,
> telling them how crappy their
ot;123")
>>>> None
>>>>>>> x = "123"
>>>>>>> testing(x)
>>>> None
>>>> When a "solution" doesn't work under some circumstances (in this case,
>>>> when run in the interactive interpre
On 12/29/2009 7:02 AM Joel Davis said...
On Dec 29, 2:29 am, "Gabriel Genellina"
wrote:
I'm sure other limitations apply too -- don't rely on this technique for
anything critical.
--
Gabriel Genellina
Gabriel,
thanks for your input, I had no idea that did that and it could have
been deployed
>>>> testing(x)
> >> None
>
> >> When a "solution" doesn't work under some circumstances (in this case,
> >> when run in the interactive interpreter) that's a warning that you need
> >> to understand when and where it will work bef
[0][3]
>> ...
>>
>>>>> testing("123")
>> None
>>>>> x = "123"
>>>>> testing(x)
>> None
>>
>> When a "solution" doesn't work under some circumstances (in this case,
>> when run
On 29 Dic, 00:54, Joel Davis wrote:
> I'm just curious if anyone knows of a way to get the variable name of
> a reference passed to the function.
>
> Put another way, in the example:
>
> def MyFunc ( varPassed ):
> print varPassed;
>
> MyFunc(nwVar)
>
On Dec 29, 2:29 am, "Gabriel Genellina"
wrote:
> En Tue, 29 Dec 2009 00:28:32 -0300, Joel Davis
> escribió:
>
>
>
> > On Dec 28, 9:37 pm, Joel Davis wrote:
> > my thanks go out to Emile and Mr Hanson for their responses, I think
> > I've found the solution, much shorter as well:
>
> > > #!
t;123")
> None
> >>> x = "123"
> >>> testing(x)
>
> None
>
> When a "solution" doesn't work under some circumstances (in this case,
> when run in the interactive interpreter) that's a warning that you need
> to understand
En Tue, 29 Dec 2009 00:28:32 -0300, Joel Davis
escribió:
On Dec 28, 9:37 pm, Joel Davis wrote:
my thanks go out to Emile and Mr Hanson for their responses, I think
I've found the solution, much shorter as well:
> #!/usr/bin/python
> import traceback
> def testing ( varPassed
ances (in this case,
when run in the interactive interpreter) that's a warning that you need
to understand when and where it will work before using it in production.
Otherwise, how do you know that it will work under other circumstances?
Or, find an alternative. What are you actually trying to do? "Get the
name of a passed reference" is a means to an end. What are you expecting
to do with it?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Dec 28, 9:37 pm, Joel Davis wrote:
> As far as more positive things are concerned, is anyone aware of what
> the support for _getframe(1) the way I used it is? Does steven have a
> newer (or older) version than me, maybe? (2.6.2) it seems like the
> sort of thing that ought to have pretty unifo
As far as more positive things are concerned, is anyone aware of what
the support for _getframe(1) the way I used it is? Does steven have a
newer (or older) version than me, maybe? (2.6.2) it seems like the
sort of thing that ought to have pretty uniform behavior, but are
their certain calls it var
On Dec 28, 8:40 pm, Steven D'Aprano
wrote:
> On Mon, 28 Dec 2009 17:27:21 -0800, Joel Davis wrote:
> > For posterity, I figured out a solution:
>
> > > #!/usr/bin/python
>
> > > import sys
> > > from traceback import extract_stack
>
> > > varPassed="varName get"
>
> > > def MyFunc(varPassed):
On Mon, 28 Dec 2009 17:27:21 -0800, Joel Davis wrote:
> For posterity, I figured out a solution:
>
> > #!/usr/bin/python
>
> > import sys
> > from traceback import extract_stack
>
> > varPassed="varName get"
>
> > def MyFunc(varPassed):
> > try:
> > raise None
>
On Mon, 28 Dec 2009 15:54:04 -0800, Joel Davis wrote:
> I'm just curious if anyone knows of a way to get the variable name of a
> reference passed to the function.
>
> Put another way, in the example:
>
> def MyFunc ( varPassed ):
> print varPassed;
>
>
2009 3:54 PM Joel Davis said...
>
> > I'm just curious if anyone knows of a way to get the variable name of
> > a reference passed to the function.
>
> For curiosity, sure -- but it's real weak...
>
> > Put another way, in the example:
>
> > def My
On 12/28/2009 3:54 PM Joel Davis said...
I'm just curious if anyone knows of a way to get the variable name of
a reference passed to the function.
For curiosity, sure -- but it's real weak...
Put another way, in the example:
def MyFunc ( varPassed ):
print varPassed;
On Mon, Dec 28, 2009 at 3:54 PM, Joel Davis wrote:
> I'm just curious if anyone knows of a way to get the variable name of
> a reference passed to the function.
>
> Put another way, in the example:
>
> def MyFunc ( varPassed ):
> print varPassed;
>
> MyFun
I'm just curious if anyone knows of a way to get the variable name of
a reference passed to the function.
Put another way, in the example:
def MyFunc ( varPassed ):
print varPassed;
MyFunc(nwVar)
how would I get the string "nwVar" from inside of "MyFunc"?
On 10 Nov., 17:03, NickC wrote:
> Many thanks for the replies. getattr() works great:
You can get a little more versatile and even specify the location of
the name (i.e. the module / package name) without pre-importing it,
like this...
def importName(modulename, name=None):
""" Import ident
On Sat, Nov 14, 2009 at 6:53 PM, Terry Reedy wrote:
> Chris Rebert wrote:
>> On Sat, Nov 14, 2009 at 3:25 PM, AON LAZIO wrote:
>>> Hi, I have some problem with object reference
>>> Say I have this code
>>>
>>> a = b = c = None
>>> sl
Chris Rebert wrote:
On Sat, Nov 14, 2009 at 3:25 PM, AON LAZIO wrote:
Hi, I have some problem with object reference
Say I have this code
a = b = c = None
slist = [a,b,c]
Values are stored in the list, not references to names.
That is not right either, or else newbies would not be
Chris Rebert writes:
> On Sat, Nov 14, 2009 at 3:25 PM, AON LAZIO wrote:
> > Hi, I have some problem with object reference
> > Say I have this code
> >
> > a = b = c = None
> > slist = [a,b,c]
>
> Values are stored in the list, not references to names. Mo
On Sat, Nov 14, 2009 at 3:25 PM, AON LAZIO wrote:
> Hi, I have some problem with object reference
> Say I have this code
>
> a = b = c = None
> slist = [a,b,c]
Values are stored in the list, not references to names. Modifying the
list does not change what values the names a, b, an
Hi, I have some problem with object reference
Say I have this code
a = b = c = None
slist = [a,b,c]
for i in range(len(slist)):
slist[i] = 5
print slist
print a,b,c
I got this
[5, 5, 5]
None None None
Question is how can I got all a,b,c variable to have value 5 also?
Thanks in advance
NickC writes:
> moon2 = ephem.${!options.body}()
moon2 = getattr(ephem, options.body)()
--
http://mail.python.org/mailman/listinfo/python-list
Many thanks for the replies. getattr() works great:
>>> name='Moon'
>>> m2 = getattr(ephem,name)()
>>> m2.compute(home)
>>> print ephem.localtime(m2.rise_time)
2009-11-11 01:30:36.02
shows the moon will rise at 1:30am localtime tonight at my home location.
Excellent.
--
NickC
--
http://
On Tue, 10 Nov 2009 06:59:25 -0800, NickC
wrote:
I can't seem to find a way to do something that seems straighforward, so
I
must have a mental block. I want to reference an object indirectly
through a variable's value.
Using a library that returns all sorts of informa
On Nov 10, 2:59 pm, NickC wrote:
> I can't seem to find a way to do something that seems straighforward, so I
> must have a mental block. I want to reference an object indirectly
> through a variable's value.
>
> Using a library that returns all sorts of information ab
I can't seem to find a way to do something that seems straighforward, so I
must have a mental block. I want to reference an object indirectly
through a variable's value.
Using a library that returns all sorts of information about "something", I
want to provide the na
In article <626f24e5-4d8e-416c-b3ed-dc56a88dc...@s21g2000prm.googlegroups.com>,
Lambda wrote:
>
>def matrix_power(m, n):
> result = m[:]
> print result is m
Use copy.deepcopy()
--
Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/
"You could make Eskimos emigrate t
ow can I use a common stack for them?
>>
>> Thanks
>>
>> 2009/10/28 Dave Angel
>>
>>
>>
>>> Garito wrote:
>>>
>>>
>>>
>>>> Hi!
>>>> I'm trying to use exec in a recursive way but I have a problem
>>
Dave Angel
Garito wrote:
Hi!
I'm trying to use exec in a recursive way but I have a problem
When I read the manual I understand that the globals and the locals are
passed by reference but if I try to use it in a recursive way the new
values
added in a step are not passed to the next one
stack for them?
Thanks
2009/10/28 Dave Angel
> Garito wrote:
>
>> Hi!
>> I'm trying to use exec in a recursive way but I have a problem
>>
>> When I read the manual I understand that the globals and the locals are
>> passed by reference but if I try to us
Garito wrote:
Hi!
I'm trying to use exec in a recursive way but I have a problem
When I read the manual I understand that the globals and the locals are
passed by reference but if I try to use it in a recursive way the new values
added in a step are not passed to the next one
Could so
Mark Dickinson wrote:
On Oct 28, 8:24 am, Lambda wrote:
Thank you!
Following is my final code:
Looks good, but are you sure about that word 'final'? ;-)
def matrix_power(m, n):
"""
Raise 2x2 matrix m to nth power.
"""
if n =0: return [[1, 0], [0, 1]]
x =atrix_power(m,
Lambda wrote:
> I defined a function to raise a 2x2 matrix to nth power:
> BTW, numpy has such a function, but it doesn't support really large
> number.
> Does numpy has some functions that support arbitrarily large number?
You can tell it to use Python instead of C integers:
>>> import numpy
>
On Oct 28, 8:24 am, Lambda wrote:
> Thank you!
> Following is my final code:
Looks good, but are you sure about that word 'final'? ;-)
>
> def matrix_power(m, n):
> """
> Raise 2x2 matrix m to nth power.
> """
> if n == 0: return [[1, 0], [0, 1]]
>
> x = matrix_power(m, n / 2)
I sugg
Hi!
I'm trying to use exec in a recursive way but I have a problem
When I read the manual I understand that the globals and the locals are
passed by reference but if I try to use it in a recursive way the new values
added in a step are not passed to the next one
Could someone point me how
701 - 800 of 1823 matches
Mail list logo