Re: Newbie question: Allocation vs references

2005-06-02 Thread Stian =?iso-8859-1?Q?S=F8iland?=
On 2005-06-02 14:43:40, Jan Danielsson wrote: > a = [ 'Foo', 'Bar' ] > b = [ 'Boo', 'Far' ] > q = [ a, b ] >Or, better yet, how do I store a and b in q, and then tell Python > that I want a and b to point to new lists, without touching the contents > in q? There are several ways to create a

Re: FAQ: __str__ vs __repr__

2005-06-15 Thread =?iso-8859-1?q?S=E9bastien_Boisg=E9rault?=
rstand what __repr__ should be. It is an *exact* (if possible) description of the object's content, nicely packaged into a string. >>> repr(0.1) 0.10001 >>> repr("it's a bad idea") '"it\'s a bad idea"' >

Re: FAQ: __str__ vs __repr__

2005-06-15 Thread =?iso-8859-1?q?S=E9bastien_Boisg=E9rault?=
Errata: >>> str(0.1) '0.1' >>> str("it's a bad idea") "it's a bad idea" >>> repr(0.1) ' 0.10001' >>> repr("it's a bad idea") '"it\'s a bad idea"' SB -- http://mail.python.org/mailman/listinfo/python-list

Embedding Python

2005-06-17 Thread =?iso-8859-1?q?S=E9bastien_Boisg=E9rault?=
Hi, Imagine that you have a PyObject pointer 'object' pointing to a Python integer ... let's say 42. How would do you attach the variable "answer" to it so that the code PyRun_SimpleString("print answer"); works as expected ? My current solution is: __main__ = PyImport_ImportModule("__main__"

<    3   4   5   6   7   8