Darwin build error with MacPorts Python 2.7.1 installed.

2011-03-02 Thread Santoso Wijaya
Hi,

I recently tried to play around with the latest source for Python-2.7.1, and
I came across this build error while trying to build a clean checkout (after
`./configure`, of course):

bash-3.2$ make
./Parser/asdl_c.py -h ./Include ./Parser/Python.asdl
Traceback (most recent call last):
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py",
line 553, in
main()
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py",
line 535, in main
known_paths = addusersitepackages(known_paths)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py",
line 268, in addusersitepackages
user_site = getusersitepackages()
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py",
line 243, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py",
line 233, in getuserbase
USER_BASE = get_config_var('userbase')
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py",
line 535, in get_config_var
return get_config_vars().get(name)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py",
line 434, in get_config_vars
_init_posix(_CONFIG_VARS)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py",
line 313, in _init_posix
raise
IOError(msg) IOError: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.4" but
"10.6" during configure
make: *** [Include/Python-ast.h] Error 1

I am using MacPorts with the latest updates. Any thoughts?

Thanks,
~/santa
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Darwin build error with MacPorts Python 2.7.1 installed.

2011-03-02 Thread Ned Deily
In article 
,
 Santoso Wijaya  wrote:
> I recently tried to play around with the latest source for Python-2.7.1, and
> I came across this build error while trying to build a clean checkout (after
> `./configure`, of course):
> 
> bash-3.2$ make
> ./Parser/asdl_c.py -h ./Include ./Parser/Python.asdl
[...]
> IOError(msg) IOError: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.4" but
> "10.6" during configure
> make: *** [Include/Python-ast.h] Error 1
> 
> I am using MacPorts with the latest updates. Any thoughts?

In this case, the simplest and best workaround should be to explicitly 
specify the deployment target when running ./configure:

./configure [...] MACOSX_DEPLOYMENT_TARGET=10.6

If you actually do need to build for an earlier version, you should be 
able to pre-build or possibly just touch the Parser targets which need a 
working Python of some sort early in the build process.  The problem is 
the working Python is being affected by the MACOSX_DEPLOYMENT_TARGET 
value, which configure currently defaults to 10.4 in the absence of 
other parameters.

I don't think there is a issue open on this;  I will open one and see 
that it gets fixed.

-- 
 Ned Deily,
 n...@acm.org

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: Code Examples

2011-03-02 Thread Martin De Kauwe
On Mar 2, 3:30 am, Robert Kern  wrote:
> On 2/28/11 10:03 AM, Fred Marshall wrote:
>
> > I'm interested in developing Python-based programs, including an engineering
> > app. ... re-writing from Fortran and C versions. One of the objectives 
> > would to
> > be make reasonable use of the available structure (objects, etc.). So, I'd 
> > like
> > to read a couple of good, simple scientific-oriented programs that do that 
> > kind
> > of thing.
>
> You may want to take a look at Clear Climate Code. It is a rewrite of an old,
> hairy FORTRAN climate analysis program with the goal of making it clearer and
> easier to understand. That's somewhat different from having an example of what
> you would write de novo, but it might help give you strategies for the process
> of translating your own FORTRAN and C engineering codes.
>
>    http://clearclimatecode.org/
>
> --
> Robert Kern
>
> "I have come to believe that the whole world is an enigma, a harmless enigma
>   that is made terrible by our own mad attempt to interpret it as though it 
> had
>   an underlying truth."
>    -- Umberto Eco

that link is really useful helps that it is the same field! Does
anyone have any more like that?
-- 
http://mail.python.org/mailman/listinfo/python-list


Hello Friends

2011-03-02 Thread Ashraf Ali
It’s good to be informed of the world.For lattest news just visit
www.newsbeam.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Plumber, an alternative to mixin-based subclassing

2011-03-02 Thread Florian Friesdorf
On 28 Feb 2011 17:54:21 -0800, a...@pythoncraft.com (Aahz) wrote:
> [posted & e-mailed]
> 
> In article ,
> Florian Friesdorf   wrote:
> >
> >An alternative to mixin-based subclassing:
> >
> >http://pypi.python.org/pypi/plumber
> 
> You'll probably get more interest if you provide a summary.

thx, good point!
will do when there are feature updates.

-- 
Florian Friesdorf 
  GPG FPR: 7A13 5EEE 1421 9FC2 108D  BAAF 38F8 99A3 0C45 F083
Jabber/XMPP: f...@chaoflow.net
IRC: chaoflow on freenode,ircnet,blafasel,OFTC


pgptrZ3CRjX6C.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list


xml -> dict: lxml faq solution inadequate

2011-03-02 Thread Johann Spies
In the lxml-faq I read:

How can I map an XML tree into a dict of dicts?

I'm glad you asked.

def recursive_dict(element):
 return element.tag, \
dict(map(recursive_dict, element)) or element.text

However this does not work where you have xml-elements where there are
more than one child on the same level.  For example:


Bayesian nonparametric statistics
Frailty modeling
Poly urn sampling
Proportional hazards model


results in

>>> alys[100]['item']['keywords']
{'keyword': 'Proportional hazards model'}

 How do I get it to give me the following result?

{'keywords': [
{'keyword': 'Bayesian nonparametric statistics'},
{'keyword': 'Frailty modeling'},
{'keyword': 'Poly urn sampling'},
{'keyword': 'Proportional hazards model'}
]}

Regards
Johann
-- 
 May grace and peace be yours in abundance through the full knowledge of God
and of Jesus our Lord!  His divine power has given us everything we need for
life and godliness through the full knowledge of the one who called us by
his own glory and excellence.
2 Pet. 1:2b,3a
-- 
http://mail.python.org/mailman/listinfo/python-list


python simplejson decoding

2011-03-02 Thread Arthur Mc Coy
Hi all,



I'm trying an example (in attached file, I mean the bottom of this
message).

First, I create a list of 3 objects. Then I do:


PutJSONObjects(objects)
objects = GetJSONObjects()
PutJSONObjects(objects, "objects2.json")


1) PutJSONObjects(objects) method creates objects.json file (by
default). It works fine.
2) Then objects = GetJSONObjects() method get the file contents and
return.

3) Finally the script fails on the third method
PutJSONObjects(objects, "objects2.json")
saying: AttributeError: 'dict' object has no attribute '__dict__'


That is true, because objects returned by GetJSONObjects() is not a
list of objects, but simple string

So here is the question, please, how should I DECODE .json file into
list of python objects so that I will be able to put the copy of these
objects into a new file called objects2.json ?

simplejson docs are hard to follow - without examples.



Please, help me. Be happy!

Arthur



# Python-JSON method for caching my objects.

import simplejson as json
import os.path
from datetime import datetime


def GetJSONObjects():

# determine the json data file path
filename = "objects.json"
filepath = "/home/docmccoy/Documents/" + filename
if os.path.isfile(filepath):
filename = filepath
f = open(filename, 'r')
objects = json.load( f )
print objects
else:
objects = list()

return objects


def PutJSONObjects(objects, filename = "objects.json"):

# determine the json data file path
filepath = "/home/docmccoy/Documents/" + filename
if os.path.isfile(filepath):
filename = filepath

f = open(filename, 'w')
json.dump([o.__dict__ for o in objects], f, indent = 4 * ' ' )


class MyObject:
def __init__(self, ID, url, category, osfamily, createDate):
self.id = ID
self.url = url
self.category = category
self.osfamily = osfamily
self.createDate = createDate


o1 = MyObject(1, "http://google.com";, "search", "linux",
unicode(datetime.now()))
o2 = MyObject(2, "http://localhost";, "mycomp", None,
unicode(datetime.now()))
o3 = MyObject(3, "http://milan.com";, "football", "windows",
unicode(datetime.now()))

objects = list()
objects.append(o1)
objects.append(o2)
objects.append(o3)

PutJSONObjects(objects)
objects = GetJSONObjects()
PutJSONObjects(objects, "objects2.json")
-- 
http://mail.python.org/mailman/listinfo/python-list


Checking against NULL will be eliminated?

2011-03-02 Thread Claudiu Popa
Hello Python-list,


I  don't  know how to call it, but the following Python 3.2 code seems to raise 
a
FutureWarning.

def func(root=None):
nonlocal arg
if root:
   arg += 1
The  warning is "FutureWarning: The behavior of this method will change
in future versions.  Use specific 'len(elem)' or 'elem is not None' test 
instead."
Why is the reason for this idiom to be changed?

  

-- 
-- 
Claudiu Popa

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Checking against NULL will be eliminated?

2011-03-02 Thread Stefan Behnel

Claudiu Popa, 02.03.2011 14:51:

Hello Python-list,


I  don't  know how to call it, but the following Python 3.2 code seems to raise 
a
FutureWarning.

def func(root=None):
 nonlocal arg
 if root:
arg += 1
The  warning is "FutureWarning: The behavior of this method will change
in future versions.  Use specific 'len(elem)' or 'elem is not None' test 
instead."
Why is the reason for this idiom to be changed?


Let me guess - this is using ElementTree, right?

It's not the idiom itself that changes, it's the Element class in 
ElementTree that will likely change its behaviour in later versions.


Fix: do as it says.

Stefan

--
http://mail.python.org/mailman/listinfo/python-list


Re: python simplejson decoding

2011-03-02 Thread Peter Otten
Arthur Mc Coy wrote:

> Hi all,
> 
> 
> 
> I'm trying an example (in attached file, I mean the bottom of this
> message).
> 
> First, I create a list of 3 objects. Then I do:
> 
> 
> PutJSONObjects(objects)
> objects = GetJSONObjects()
> PutJSONObjects(objects, "objects2.json")
> 
> 
> 1) PutJSONObjects(objects) method creates objects.json file (by
> default). It works fine.
> 2) Then objects = GetJSONObjects() method get the file contents and
> return.
> 
> 3) Finally the script fails on the third method
> PutJSONObjects(objects, "objects2.json")
> saying: AttributeError: 'dict' object has no attribute '__dict__'
> 
> 
> That is true, because objects returned by GetJSONObjects() is not a
> list of objects, but simple string
> 
> So here is the question, please, how should I DECODE .json file into
> list of python objects so that I will be able to put the copy of these
> objects into a new file called objects2.json ?
> 
> simplejson docs are hard to follow - without examples.

I suggest that you use json instead which is part of the standard library 
since Python 2.6. The documentation is here:

http://docs.python.org/library/json.html

If you know that there are only MyObject instances you need a function to 
construct such a MyObject instance from a dictionary. You can then recreate 
the objects with

objects = [object_from_dict(d) for d in json.load(f)]

or, if all dictionaries correspond to MyObject instances

objects = json.load(f, object_hook=object_from_dict)

A general implementation for old-style objects (objects that don't derive 
from object) is a bit messy:

# idea copied from pickle.py
class Empty:
pass

def object_from_dict(d):
obj = Empty()
obj.__class__ = MyObject
obj.__dict__.update((str(k), v) for k, v in d.iteritems()) # *
return obj

If you are willing to make MyClass a newstyle class with

class MyObject(object):
# ...

the function can be simplified to

def object_from_dict(d):
obj = object.__new__(MyObject)
obj.__dict__.update((str(k), v) for k, v in d.iteritems()) # *
return obj

(*) I don't know if unicode attribute names can do any harm, 
obj.__dict__.update(d) might work as well.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Checking against NULL will be eliminated?

2011-03-02 Thread Carl Banks
On Mar 2, 5:51 am, Claudiu Popa  wrote:
> Hello Python-list,
>
> I  don't  know how to call it, but the following Python 3.2 code seems to 
> raise a
> FutureWarning.
>
> def func(root=None):
>     nonlocal arg
>     if root:
>        arg += 1
> The  warning is "FutureWarning: The behavior of this method will change
> in future versions.  Use specific 'len(elem)' or 'elem is not None' test 
> instead."
> Why is the reason for this idiom to be changed?

I'm guessing root is an ElementTree Element?

The reason for this is that some element tree functions will return
None if an element is not found, but an empty element will have a
boolean value of false because it acts like a container.  Some people
who use ElementTree don't always have this behavior in mind when they
are testing to see if an element was found, and will use "if element:"
when they need to be using "if element is not None:".

The larger reason is that boolean evaluation in Python tries to be too
many things: for some types is means "not zero", for some types it
means "empty", and for some types it means "this is a value of this
type as opposed to None".  That causes conflicts when more than one of
those tests makes sense for a given type, as it does with Elements.

This change is only for ElementTree as far as I know.  (Incidentally,
Numpy arrays are another notable type that's disabled implicit
booleans, but it did it a long time ago.)


Carl Banks
-- 
http://mail.python.org/mailman/listinfo/python-list


arbitrary precision linear algebra

2011-03-02 Thread Ben123
Hello. I have a written Python program which currently uses numpy to
perform linear algebra operations. Specifically, I do matrix*matrix,
matrix*vector, numpy.linalg.inv(matrix), and linalg.eig(matrix)
operations. Now I am interested in allowing arbitrary precision. I
have tried gmpy, bigfloat, mpmath, and decimal but I have been unable
to easily implement any with my current program. I suspect I have to
change some commands but I am unsure what.

My question is which of the arbitrary precision implementations will
most easily handle linear algebra? I don't care about speed, just ease
of use. Online tutorials for arbitrary precision linear algebra
operations would be useful.

For example, it looks like mpmath can handle matrix operations
http://fredrik-j.blogspot.com/search?q=matrix
but I was unable to find a clear tutorial. The tutorials for most of
the arbitrary precision implementations demonstrate simple scalar
examples.

Thanks in advance
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: arbitrary precision linear algebra

2011-03-02 Thread Ben123
On Mar 2, 8:42 am, Ben123  wrote:
> Hello. I have a written Python program which currently uses numpy to
> perform linear algebra operations. Specifically, I do matrix*matrix,
> matrix*vector, numpy.linalg.inv(matrix), and linalg.eig(matrix)
> operations. Now I am interested in allowing arbitrary precision. I
> have tried gmpy, bigfloat, mpmath, and decimal but I have been unable
> to easily implement any with my current program. I suspect I have to
> change some commands but I am unsure what.
>
> My question is which of the arbitrary precision implementations will
> most easily handle linear algebra? I don't care about speed, just ease
> of use. Online tutorials for arbitrary precision linear algebra
> operations would be useful.
>
> For example, it looks like mpmath can handle matrix 
> operationshttp://fredrik-j.blogspot.com/search?q=matrix
> but I was unable to find a clear tutorial. The tutorials for most of
> the arbitrary precision implementations demonstrate simple scalar
> examples.
>
> Thanks in advance

Hello again. I forgot to mention I'm using
Python 2.6.4
mpmath 0.17
bigfloat 0.2.1
gmp 5.01
gmpy2 2.0.0a1
mpfr 3.0.0
all on Ubuntu x64
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python simplejson decoding

2011-03-02 Thread Felipe Vinturini
Hi Arthur,

Maybe this link helps you: http://www.doughellmann.com/PyMOTW/json/

I used it to learn JSON. =o)

Regards,
Felipe.

On Wed, Mar 2, 2011 at 11:24 AM, Peter Otten <__pete...@web.de> wrote:

> Arthur Mc Coy wrote:
>
> > Hi all,
> >
> >
> >
> > I'm trying an example (in attached file, I mean the bottom of this
> > message).
> >
> > First, I create a list of 3 objects. Then I do:
> >
> >
> > PutJSONObjects(objects)
> > objects = GetJSONObjects()
> > PutJSONObjects(objects, "objects2.json")
> >
> >
> > 1) PutJSONObjects(objects) method creates objects.json file (by
> > default). It works fine.
> > 2) Then objects = GetJSONObjects() method get the file contents and
> > return.
> >
> > 3) Finally the script fails on the third method
> > PutJSONObjects(objects, "objects2.json")
> > saying: AttributeError: 'dict' object has no attribute '__dict__'
> >
> >
> > That is true, because objects returned by GetJSONObjects() is not a
> > list of objects, but simple string
> >
> > So here is the question, please, how should I DECODE .json file into
> > list of python objects so that I will be able to put the copy of these
> > objects into a new file called objects2.json ?
> >
> > simplejson docs are hard to follow - without examples.
>
> I suggest that you use json instead which is part of the standard library
> since Python 2.6. The documentation is here:
>
> http://docs.python.org/library/json.html
>
> If you know that there are only MyObject instances you need a function to
> construct such a MyObject instance from a dictionary. You can then recreate
> the objects with
>
> objects = [object_from_dict(d) for d in json.load(f)]
>
> or, if all dictionaries correspond to MyObject instances
>
> objects = json.load(f, object_hook=object_from_dict)
>
> A general implementation for old-style objects (objects that don't derive
> from object) is a bit messy:
>
> # idea copied from pickle.py
> class Empty:
>pass
>
> def object_from_dict(d):
>obj = Empty()
>obj.__class__ = MyObject
>obj.__dict__.update((str(k), v) for k, v in d.iteritems()) # *
>return obj
>
> If you are willing to make MyClass a newstyle class with
>
> class MyObject(object):
># ...
>
> the function can be simplified to
>
> def object_from_dict(d):
>obj = object.__new__(MyObject)
>obj.__dict__.update((str(k), v) for k, v in d.iteritems()) # *
>return obj
>
> (*) I don't know if unicode attribute names can do any harm,
> obj.__dict__.update(d) might work as well.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Strange occasional marshal error

2011-03-02 Thread Graham Stratton
Hi,

I'm using Python with ZeroMQ to distribute data around an HPC cluster.
The results have been good apart from one issue which I am completely
stuck with:

We are using marshal for serialising objects before distributing them
around the cluster, and extremely occasionally a corrupted marshal is
produced. The current workaround is to serialise everything twice and
check that the serialisations are the same. On the rare occasions that
they are not, I have dumped the files for comparison. It turns out
that there are a few positions within the serialisation where
corruption tends to occur (these positions seem to be independent of
the data of the size of the complete serialisation). These are:

4 bytes starting at 548867 (0x86003)
4 bytes starting at 4398083 (0x431c03)
4 bytes starting at 17595395 (0x10c7c03)
4 bytes starting at 19794819 (0x12e0b83)
4 bytes starting at 22269171 (0x153ccf3)
2 bytes starting at 25052819 (0x17e4693)
3 bytes starting at 28184419 (0x1ae0f63)

I note that the ratio between the later positions is almost exactly
1.125. Presumably this has something to do with memory allocation
somewhere?

Some datapoints:

- The phenomenon has been observed in a single-threaded process
without ZeroMQ
- I think the phenomenon has been observed in pickled as well as
marshalled data
- The phenomenon has been observed on different hardware

Unfortunately after quite a lot of work I still haven't managed to
reproduce this error on a single machine. Hopefully the above is
enough information for someone to speculate as to where the problem
is.

Many thanks in advance for any help.

Regards,

Graham
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: arbitrary precision linear algebra

2011-03-02 Thread Arthur Mc Coy
What do you mean by "arbitrary precision" ? Each method of calculating
of something has its own precision...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Checking against NULL will be eliminated?

2011-03-02 Thread Philip Semanchuk

On Mar 2, 2011, at 9:21 AM, Stefan Behnel wrote:

> Claudiu Popa, 02.03.2011 14:51:
>> Hello Python-list,
>> 
>> 
>> I  don't  know how to call it, but the following Python 3.2 code seems to 
>> raise a
>> FutureWarning.
>> 
>> def func(root=None):
>> nonlocal arg
>> if root:
>>arg += 1
>> The  warning is "FutureWarning: The behavior of this method will change
>> in future versions.  Use specific 'len(elem)' or 'elem is not None' test 
>> instead."
>> Why is the reason for this idiom to be changed?
> 
> Let me guess - this is using ElementTree, right?
> 
> It's not the idiom itself that changes, it's the Element class in ElementTree 
> that will likely change its behaviour in later versions.
> 
> Fix: do as it says.

And it's documented, although you might have a hard time finding it. See the 
"Caution" at the end of this section of documentation:
http://docs.python.org/py3k/library/xml.etree.elementtree.html#element-objects

I wish this behavior had been changed for Python 3.x. That warning has been in 
the ElementTree doc since before it became part of the standard lib, so it's 
not a new idea. Python 3.x seems like it would have been an ideal time to make 
the change. Oh well.

bye
P
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Checking against NULL will be eliminated?

2011-03-02 Thread Tom Zych
On Wed, 02 Mar 2011 06:37 -0800, "Carl Banks" 
wrote:
> The larger reason is that boolean evaluation in Python tries to be too
> many things: for some types is means "not zero", for some types it
> means "empty", and for some types it means "this is a value of this
> type as opposed to None".  That causes conflicts when more than one of
> those tests makes sense for a given type, as it does with Elements.

You're right.

PEP 4000:
Proposing a new, backwards-incompatible version of Python in which
boolean evaluation
is not so overloaded.

Hmm, no, I don't think that will fly. We're stuck with it :(

Fortunately there are work-arounds for the cases that matter, as we've
seen.
Yay Python :)

-- 
Tom Zych / freethin...@pobox.com
Quidquid latine dictum sit, altum viditur.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: arbitrary precision linear algebra

2011-03-02 Thread Ben123
On Mar 2, 9:04 am, Arthur Mc Coy <1984docmc...@gmail.com> wrote:
> What do you mean by "arbitrary precision" ? Each method of calculating
> of something has its own precision...

If you are unfamiliar with arbitrary precision, I'm referring to
http://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic

Suppose I find the eigenvalues of a matrix and the eigenvalues range
from 1 to 0.0001. This can be handled by numpy in Python because the
smallest eigenvalue is larger than then numerical precision of 1E-19.
However, if the range of eigenvalues is 1 to 1E-40, then I will need
to increase the precision of all calculations leading up to finding
the eigenvalues.

I am working with complex valued matrices and I expect to get real
eigenvalues back (based on the physics of the system). The precision
of numpy is apparent from the imaginary component of the eigenvalues I
find, currently 1E-19 or 1E-20. I need better precision for small
eigenvalues.

In case you are curious, the complex-valued matrices are 20x20.

Thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Various behaviors of doctest

2011-03-02 Thread Gnarlodious
On Feb 28, Peter Otten wrote:

> Are you using Python 2.x? Then you cannot redefine print. Instead you have
> to redirect stdout. The following example should run as a cgi script:
>
> #!/usr/bin/env python
> import cgi
> import sys
> from cStringIO import StringIO
...

That works! Except for Py3 I had to say:

from io import StringIO

Thanks.

-- Gnarlie
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Checking against NULL will be eliminated?

2011-03-02 Thread Steven Howe
Back at NCR, they stressed the axiom '90% of the time is spent fixing 
10% of the code'.


How true that axiom is. Never more so then when faced with a programming 
language fix like PEP 4000. Fortunately for me, I never trusted python's 
complex, or should I say 'overloaded' Boolean usage.


If I want to know if a string or list dictionary is empty: if ( len(x) 
== 0 ).


If an item is None: if ( type(x) == types.NoneType ):

if truly Boolean and want to 'do' something on False, then I use 'not'.

I really like 'types'. Helps error checking, helps making logic flows 
cleaner and less error prone. And since 'pydev/Eclipse' is so good at 
finding my from/imports and inserting them for me, I use types liberally.


I guess being an old C programmer makes one a bit more cautious; nothing 
worse then compiler errors, accept runtime errors. And over course, I 
still use lots of parentheses to group my logic. Hell, I still do a lot 
of that when using bash.


So PEP 4000, go ahead, break some over indulgent code and coders; I'm 
not bothered.


Steven


On 03/02/2011 07:15 AM, Tom Zych wrote:

On Wed, 02 Mar 2011 06:37 -0800, "Carl Banks"
wrote:

The larger reason is that boolean evaluation in Python tries to be too
many things: for some types is means "not zero", for some types it
means "empty", and for some types it means "this is a value of this
type as opposed to None".  That causes conflicts when more than one of
those tests makes sense for a given type, as it does with Elements.

You're right.

PEP 4000:
Proposing a new, backwards-incompatible version of Python in which
boolean evaluation
is not so overloaded.

Hmm, no, I don't think that will fly. We're stuck with it :(

Fortunately there are work-arounds for the cases that matter, as we've
seen.
Yay Python :)



--
http://mail.python.org/mailman/listinfo/python-list


Re: arbitrary precision linear algebra

2011-03-02 Thread Arthur Mc Coy
On Mar 2, 5:26 pm, Ben123  wrote:
> On Mar 2, 9:04 am, Arthur Mc Coy <1984docmc...@gmail.com> wrote:
>
> > What do you mean by "arbitrary precision" ? Each method of calculating
> > of something has its own precision...
>
> If you are unfamiliar with arbitrary precision, I'm referring 
> tohttp://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic
>
> Suppose I find the eigenvalues of a matrix and the eigenvalues range
> from 1 to 0.0001. This can be handled by numpy in Python because the
> smallest eigenvalue is larger than then numerical precision of 1E-19.
> However, if the range of eigenvalues is 1 to 1E-40, then I will need
> to increase the precision of all calculations leading up to finding
> the eigenvalues.
>
> I am working with complex valued matrices and I expect to get real
> eigenvalues back (based on the physics of the system). The precision
> of numpy is apparent from the imaginary component of the eigenvalues I
> find, currently 1E-19 or 1E-20. I need better precision for small
> eigenvalues.
>
> In case you are curious, the complex-valued matrices are 20x20.
>
> Thanks

You probably have to change the method of finding eigenvalues.
Which one do you use? Power or algebraic ?
Do you use Gaussian method to simplify matrices ?

Languages can't support infinitely large or small numbers, so try to
multiply the inner variables by 10^n to increase their values if this
will not involve on the method. For example, I did this when was
calculating geometric means of computer benchmarks.
In such way you will be storing the number of zeros as n.

Yes, interesting what are you calculating.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: arbitrary precision linear algebra

2011-03-02 Thread Ben123
On Mar 2, 10:21 am, Arthur Mc Coy <1984docmc...@gmail.com> wrote:
> On Mar 2, 5:26 pm, Ben123  wrote:
>
>
>
>
>
>
>
>
>
> > On Mar 2, 9:04 am, Arthur Mc Coy <1984docmc...@gmail.com> wrote:
>
> > > What do you mean by "arbitrary precision" ? Each method of calculating
> > > of something has its own precision...
>
> > If you are unfamiliar with arbitrary precision, I'm referring 
> > tohttp://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic
>
> > Suppose I find the eigenvalues of a matrix and the eigenvalues range
> > from 1 to 0.0001. This can be handled by numpy in Python because the
> > smallest eigenvalue is larger than then numerical precision of 1E-19.
> > However, if the range of eigenvalues is 1 to 1E-40, then I will need
> > to increase the precision of all calculations leading up to finding
> > the eigenvalues.
>
> > I am working with complex valued matrices and I expect to get real
> > eigenvalues back (based on the physics of the system). The precision
> > of numpy is apparent from the imaginary component of the eigenvalues I
> > find, currently 1E-19 or 1E-20. I need better precision for small
> > eigenvalues.
>
> > In case you are curious, the complex-valued matrices are 20x20.
>
> > Thanks
>
> You probably have to change the method of finding eigenvalues.
> Which one do you use? Power or algebraic ?

I'm not sure what you mean by this. As I mentioned, in Python I am
using linalg.eig() from numpy on complex matrices. I have not
investigated how this is implemented.

> Do you use Gaussian method to simplify matrices ?

No

>
> Languages can't support infinitely large or small numbers, so try to
> multiply the inner variables by 10^n to increase their values if this
> will not involve on the method. For example, I did this when was
> calculating geometric means of computer benchmarks.

Currently I have values between 1 and 1E-300 (not infinitely small). I
don't see how scaling by powers of 10 will increase precision.

> In such way you will be storing the number of zeros as n.

Are you saying python cares whether I express a number as 0.001 or
scaled by 10^5 to read 100? If this is the case, I'm still stuck. I
need the full range of eigenvalues from 1 to 1E-300, so the entire
range could be scaled by 1E300 but I would still need better precision
than 1E19

>
> Yes, interesting what are you calculating.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python simplejson decoding

2011-03-02 Thread Arthur Mc Coy
Hi Peter,


I implemented my decoder using your approach. Very positive.

But that is for simple objects. My objects have nested lists. For
example MyObject has property (member) called benchmarks, which is the
list of defined benchmarks. I'm not sure if obj.__dict__.update will
help me to copy nested information. I will see later. Now, when the
testing environment is ready, I go for real world application.


Thank you!

Kostia

On Mar 2, 4:24 pm, Peter Otten <__pete...@web.de> wrote:
> Arthur Mc Coy wrote:
> > Hi all,
>
> > I'm trying an example (in attached file, I mean the bottom of this
> > message).
>
> > First, I create a list of 3 objects. Then I do:
>
> > PutJSONObjects(objects)
> > objects = GetJSONObjects()
> > PutJSONObjects(objects, "objects2.json")
>
> > 1) PutJSONObjects(objects) method creates objects.json file (by
> > default). It works fine.
> > 2) Then objects = GetJSONObjects() method get the file contents and
> > return.
>
> > 3) Finally the script fails on the third method
> > PutJSONObjects(objects, "objects2.json")
> > saying: AttributeError: 'dict' object has no attribute '__dict__'
>
> > That is true, because objects returned by GetJSONObjects() is not a
> > list of objects, but simple string
>
> > So here is the question, please, how should I DECODE .json file into
> > list of python objects so that I will be able to put the copy of these
> > objects into a new file called objects2.json ?
>
> > simplejson docs are hard to follow - without examples.
>
> I suggest that you use json instead which is part of the standard library
> since Python 2.6. The documentation is here:
>
> http://docs.python.org/library/json.html
>
> If you know that there are only MyObject instances you need a function to
> construct such a MyObject instance from a dictionary. You can then recreate
> the objects with
>
> objects = [object_from_dict(d) for d in json.load(f)]
>
> or, if all dictionaries correspond to MyObject instances
>
> objects = json.load(f, object_hook=object_from_dict)
>
> A general implementation for old-style objects (objects that don't derive
> from object) is a bit messy:
>
> # idea copied from pickle.py
> class Empty:
>     pass
>
> def object_from_dict(d):
>     obj = Empty()
>     obj.__class__ = MyObject
>     obj.__dict__.update((str(k), v) for k, v in d.iteritems()) # *
>     return obj
>
> If you are willing to make MyClass a newstyle class with
>
> class MyObject(object):
>     # ...
>
> the function can be simplified to
>
> def object_from_dict(d):
>     obj = object.__new__(MyObject)
>     obj.__dict__.update((str(k), v) for k, v in d.iteritems()) # *
>     return obj
>
> (*) I don't know if unicode attribute names can do any harm,
> obj.__dict__.update(d) might work as well.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: arbitrary precision linear algebra

2011-03-02 Thread Robin Becker

On 02/03/2011 16:39, Ben123 wrote:
...

Languages can't support infinitely large or small numbers, so try to
multiply the inner variables by 10^n to increase their values if this
will not involve on the method. For example, I did this when was
calculating geometric means of computer benchmarks.


Currently I have values between 1 and 1E-300 (not infinitely small). I
don't see how scaling by powers of 10 will increase precision.


In such way you will be storing the number of zeros as n.


Are you saying python cares whether I express a number as 0.001 or
scaled by 10^5 to read 100? If this is the case, I'm still stuck. I
need the full range of eigenvalues from 1 to 1E-300, so the entire
range could be scaled by 1E300 but I would still need better precision
than 1E19


...

If you enter a number as 1e-19 then python will treat as a float; by default I 
think that float is IEEE double precision so you're getting a 48 bit mantissa 
(others may have better details). That means you've already lost any idea of 
arbitrary precision.


When you say you have numbers like 1E-300 are those actually numerically zero or 
have you some valid inputs that vary over a huge range. It should be possible to 
compute determinants/inverses etc to arbitrary precision as those are known to 
be polynomial functions of the input elements. However, eigenvalues are not.


eg

[0 2]
[1 0]

has eigenvalues +/- sqrt(2) so even though you can represent the matrix in 
finite precision the eigenvalues require infinite precision.


Eigenvalues are roots of a polynomial in the elements and root solving may 
require an infinite number of steps so it will be difficult with arbitrary 
matrices to keep arbitrary precision.

--
Robin Becker

--
http://mail.python.org/mailman/listinfo/python-list


Re: arbitrary precision linear algebra

2011-03-02 Thread Arthur Mc Coy
> Are you saying python cares whether I express a number as 0.001 or
> scaled by 10^5 to read 100? If this is the case, I'm still stuck. I
> need the full range of eigenvalues from 1 to 1E-300, so the entire
> range could be scaled by 1E300 but I would still need better precision
> than 1E19

If python package can't compute 1E-300, then you can't use it.
You can try to split your task onto small subtasks, which can be
handled by specific python package.

Then you need to think of the way to do that. Mathematically. If no
way, then you can leave your task alone.
Programming is limiting, that is true.

I have heard about grid computing. You may find scientists working on
grid and ask how do they split their tasks.
But I think they do not an answer as well.

Also google uses its matrix to rank web pages. It computes the maximum
eigenvalue from the matrix which contain near zero entries too. Maybe
you can find how do they store those values.

Sorry, can't help anymore. I also have computing problems which I
can't yet solve :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: arbitrary precision linear algebra

2011-03-02 Thread Ben123
On Mar 2, 11:28 am, Robin Becker  wrote:
> On 02/03/2011 16:39, Ben123 wrote:
> ...
>
>
>
>
>
>
>
> >> Languages can't support infinitely large or small numbers, so try to
> >> multiply the inner variables by 10^n to increase their values if this
> >> will not involve on the method. For example, I did this when was
> >> calculating geometric means of computer benchmarks.
>
> > Currently I have values between 1 and 1E-300 (not infinitely small). I
> > don't see how scaling by powers of 10 will increase precision.
>
> >> In such way you will be storing the number of zeros as n.
>
> > Are you saying python cares whether I express a number as 0.001 or
> > scaled by 10^5 to read 100? If this is the case, I'm still stuck. I
> > need the full range of eigenvalues from 1 to 1E-300, so the entire
> > range could be scaled by 1E300 but I would still need better precision
> > than 1E19
>
> ...
>
> If you enter a number as 1e-19 then python will treat as a float; by default I
> think that float is IEEE double precision so you're getting a 48 bit mantissa
> (others may have better details). That means you've already lost any idea of
> arbitrary precision.
>
> When you say you have numbers like 1E-300 are those actually numerically zero 
> or
> have you some valid inputs that vary over a huge range. It should be possible 
> to
> compute determinants/inverses etc to arbitrary precision as those are known to
> be polynomial functions of the input elements. However, eigenvalues are not.

I meant that I expect the eigenvalues to be in a range from 1 to
1E-300. The values in the matrix are from sine and cosine values and
have range [-10,10] for the real and imaginary parts. Thus, I could
specify the matrix elements to arbitrary precision prior to
diagonalization. However, I'm looking for the resulting eigenvalues to
have precision to 1E-300

>
> eg
>
> [0 2]
> [1 0]
>
> has eigenvalues +/- sqrt(2) so even though you can represent the matrix in
> finite precision the eigenvalues require infinite precision.

Here's an example of a matrix I am diagonalizing:
from numpy import *
exmpl=array([[  9.39582700e-04 +1.21760986e-21j,   3.32958159e-04
-6.03359588e-04j, \
   -3.71551527e-04 -1.77143102e-04j,   2.87113322e-04
-9.84374562e-04j], \
 [  3.32958159e-04 +6.03359588e-04j,   5.05441331e-04
+6.80604208e-21j, \
   -1.79123354e-05 -3.01368276e-04j,   7.33866807e-04
-1.64459142e-04j], \
 [ -3.71551527e-04 +1.77143102e-04j,  -1.79123354e-05
+3.01368276e-04j, \
1.80324968e-04 -2.63622461e-21j,   7.20508934e-05
+4.43394732e-04j], \
 [  2.87113322e-04 +9.84374562e-04j,   7.33866807e-04
+1.64459142e-04j, \
7.20508934e-05 -4.43394732e-04j,   1.11903651e-03
-6.61744490e-21j]])

The eigenvalues I get back using linalg.eig(exmpl)[0] are

2.74438550e-03 +7.67536143e-20j
6.54324852e-12 +2.03438929e-20j
1.39471366e-13 +4.68335525e-20j
1.76591707e-12 +2.20243218e-20j])

Here I would want to have better precision in the eigenvalues, a
smaller imaginary component.

To use your example, I'd like to increase the number of digits shown
in the eigenvalue:
from numpy import *
test=array([[0, 2],[1, 0]])
linalg.eig(test)[0]

but using

import mpmath
from mpmath import *
mp.dps = 50
from numpy import *
test=array([[0, 2],[1, 0]])
linalg.eig(test)[0]

does not help

>
> Eigenvalues are roots of a polynomial in the elements and root solving may
> require an infinite number of steps so it will be difficult with arbitrary
> matrices to keep arbitrary precision.
> --
> Robin Becker

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: arbitrary precision linear algebra

2011-03-02 Thread geremy condra
On Wed, Mar 2, 2011 at 6:42 AM, Ben123  wrote:
> Hello. I have a written Python program which currently uses numpy to
> perform linear algebra operations. Specifically, I do matrix*matrix,
> matrix*vector, numpy.linalg.inv(matrix), and linalg.eig(matrix)
> operations. Now I am interested in allowing arbitrary precision. I
> have tried gmpy, bigfloat, mpmath, and decimal but I have been unable
> to easily implement any with my current program. I suspect I have to
> change some commands but I am unsure what.
>
> My question is which of the arbitrary precision implementations will
> most easily handle linear algebra? I don't care about speed, just ease
> of use. Online tutorials for arbitrary precision linear algebra
> operations would be useful.
>
> For example, it looks like mpmath can handle matrix operations
> http://fredrik-j.blogspot.com/search?q=matrix
> but I was unable to find a clear tutorial. The tutorials for most of
> the arbitrary precision implementations demonstrate simple scalar
> examples.
>
> Thanks in advance

Have you looked at Sage[0]? I don't know for a fact, but you should be
able to define a matrix over RealField(precision_in_bits) and then
take the eigenvalue of it. I don't know if it will actually produce
the precision you need though.

Geremy Condra
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: arbitrary precision linear algebra

2011-03-02 Thread geremy condra
On Wed, Mar 2, 2011 at 10:21 AM, geremy condra  wrote:
> On Wed, Mar 2, 2011 at 6:42 AM, Ben123  wrote:
>> Hello. I have a written Python program which currently uses numpy to
>> perform linear algebra operations. Specifically, I do matrix*matrix,
>> matrix*vector, numpy.linalg.inv(matrix), and linalg.eig(matrix)
>> operations. Now I am interested in allowing arbitrary precision. I
>> have tried gmpy, bigfloat, mpmath, and decimal but I have been unable
>> to easily implement any with my current program. I suspect I have to
>> change some commands but I am unsure what.
>>
>> My question is which of the arbitrary precision implementations will
>> most easily handle linear algebra? I don't care about speed, just ease
>> of use. Online tutorials for arbitrary precision linear algebra
>> operations would be useful.
>>
>> For example, it looks like mpmath can handle matrix operations
>> http://fredrik-j.blogspot.com/search?q=matrix
>> but I was unable to find a clear tutorial. The tutorials for most of
>> the arbitrary precision implementations demonstrate simple scalar
>> examples.
>>
>> Thanks in advance
>
> Have you looked at Sage[0]? I don't know for a fact, but you should be
> able to define a matrix over RealField(precision_in_bits) and then
> take the eigenvalue of it. I don't know if it will actually produce
> the precision you need though.
>
> Geremy Condra
>

Apologies, forgot the links:

http://www.sagemath.org/doc/constructions/linear_algebra.html
http://www.sagemath.org/doc/reference/sage/rings/complex_field.html

Geremy Condra
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: arbitrary precision linear algebra

2011-03-02 Thread Ben123
On Mar 2, 12:22 pm, geremy condra  wrote:
> On Wed, Mar 2, 2011 at 10:21 AM, geremy condra  wrote:
> > On Wed, Mar 2, 2011 at 6:42 AM, Ben123  wrote:
> >> Hello. I have a written Python program which currently uses numpy to
> >> perform linear algebra operations. Specifically, I do matrix*matrix,
> >> matrix*vector, numpy.linalg.inv(matrix), and linalg.eig(matrix)
> >> operations. Now I am interested in allowing arbitrary precision. I
> >> have tried gmpy, bigfloat, mpmath, and decimal but I have been unable
> >> to easily implement any with my current program. I suspect I have to
> >> change some commands but I am unsure what.
>
> >> My question is which of the arbitrary precision implementations will
> >> most easily handle linear algebra? I don't care about speed, just ease
> >> of use. Online tutorials for arbitrary precision linear algebra
> >> operations would be useful.
>
> >> For example, it looks like mpmath can handle matrix operations
> >>http://fredrik-j.blogspot.com/search?q=matrix
> >> but I was unable to find a clear tutorial. The tutorials for most of
> >> the arbitrary precision implementations demonstrate simple scalar
> >> examples.
>
> >> Thanks in advance
>
> > Have you looked at Sage[0]? I don't know for a fact, but you should be
> > able to define a matrix over RealField(precision_in_bits) and then
> > take the eigenvalue of it. I don't know if it will actually produce
> > the precision you need though.
>
> > Geremy Condra
>
> Apologies, forgot the links:
>
> http://www.sagemath.org/doc/constructions/linear_algebra.htmlhttp://www.sagemath.org/doc/reference/sage/rings/complex_field.html
>
> Geremy Condra

I've already implemented the algorithm in Mathematica for exactly this
reason - increasing precision there is trivial. I was interested in
Python because it is free and more portable. I knew of Sage but wasn't
sure if it was more appropriate than Python.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: arbitrary precision linear algebra

2011-03-02 Thread Ben123
On Mar 2, 12:22 pm, geremy condra  wrote:
> On Wed, Mar 2, 2011 at 10:21 AM, geremy condra  wrote:
> > On Wed, Mar 2, 2011 at 6:42 AM, Ben123  wrote:
> >> Hello. I have a written Python program which currently uses numpy to
> >> perform linear algebra operations. Specifically, I do matrix*matrix,
> >> matrix*vector, numpy.linalg.inv(matrix), and linalg.eig(matrix)
> >> operations. Now I am interested in allowing arbitrary precision. I
> >> have tried gmpy, bigfloat, mpmath, and decimal but I have been unable
> >> to easily implement any with my current program. I suspect I have to
> >> change some commands but I am unsure what.
>
> >> My question is which of the arbitrary precision implementations will
> >> most easily handle linear algebra? I don't care about speed, just ease
> >> of use. Online tutorials for arbitrary precision linear algebra
> >> operations would be useful.
>
> >> For example, it looks like mpmath can handle matrix operations
> >>http://fredrik-j.blogspot.com/search?q=matrix
> >> but I was unable to find a clear tutorial. The tutorials for most of
> >> the arbitrary precision implementations demonstrate simple scalar
> >> examples.
>
> >> Thanks in advance
>
> > Have you looked at Sage[0]? I don't know for a fact, but you should be
> > able to define a matrix over RealField(precision_in_bits) and then
> > take the eigenvalue of it. I don't know if it will actually produce
> > the precision you need though.
>
> > Geremy Condra
>
> Apologies, forgot the links:
>
> http://www.sagemath.org/doc/constructions/linear_algebra.htmlhttp://www.sagemath.org/doc/reference/sage/rings/complex_field.html
>
> Geremy Condra

I'm not sufficiently familiar with Sage, but from
http://www.sagemath.org/doc/constructions/linear_algebra.html

"currently Sage does not implement multiprecision numerical
eigenvalues/eigenvectors"

I'll ask on the Sage forums about this. In the mean time, I'm still
trying to get arbitrary precision linear algebra in Python
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: arbitrary precision linear algebra

2011-03-02 Thread geremy condra
On Wed, Mar 2, 2011 at 10:47 AM, Ben123  wrote:
> On Mar 2, 12:22 pm, geremy condra  wrote:
>> On Wed, Mar 2, 2011 at 10:21 AM, geremy condra  wrote:
>> > On Wed, Mar 2, 2011 at 6:42 AM, Ben123  wrote:
>> >> Hello. I have a written Python program which currently uses numpy to
>> >> perform linear algebra operations. Specifically, I do matrix*matrix,
>> >> matrix*vector, numpy.linalg.inv(matrix), and linalg.eig(matrix)
>> >> operations. Now I am interested in allowing arbitrary precision. I
>> >> have tried gmpy, bigfloat, mpmath, and decimal but I have been unable
>> >> to easily implement any with my current program. I suspect I have to
>> >> change some commands but I am unsure what.
>>
>> >> My question is which of the arbitrary precision implementations will
>> >> most easily handle linear algebra? I don't care about speed, just ease
>> >> of use. Online tutorials for arbitrary precision linear algebra
>> >> operations would be useful.
>>
>> >> For example, it looks like mpmath can handle matrix operations
>> >>http://fredrik-j.blogspot.com/search?q=matrix
>> >> but I was unable to find a clear tutorial. The tutorials for most of
>> >> the arbitrary precision implementations demonstrate simple scalar
>> >> examples.
>>
>> >> Thanks in advance
>>
>> > Have you looked at Sage[0]? I don't know for a fact, but you should be
>> > able to define a matrix over RealField(precision_in_bits) and then
>> > take the eigenvalue of it. I don't know if it will actually produce
>> > the precision you need though.
>>
>> > Geremy Condra
>>
>> Apologies, forgot the links:
>>
>> http://www.sagemath.org/doc/constructions/linear_algebra.htmlhttp://www.sagemath.org/doc/reference/sage/rings/complex_field.html
>>
>> Geremy Condra
>
> I'm not sufficiently familiar with Sage, but from
> http://www.sagemath.org/doc/constructions/linear_algebra.html
>
> "currently Sage does not implement multiprecision numerical
> eigenvalues/eigenvectors"
>
> I'll ask on the Sage forums about this. In the mean time, I'm still
> trying to get arbitrary precision linear algebra in Python

I'd suggest you read that slightly more carefully. It's speaking
specifically of RR and CC, ie, double-width reals and complex values.
Using RealField and ComplexField- the arbitrary precision real and
complex fields- seems to be working. Using the earlier example:

sage: M1 = Matrix(RealField(1000), [[0, 2], [1, 0]])
sage: M2 = Matrix(RR, [[0, 2], [1, 0]])
sage: M1.eigenvalues()
[1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623091229702492483605585073721264412149709993583141322266592750559275579995050115278206057147010955997160597027453459686201472851741864088919860955232923048430871432145083976260362799525140799,
-1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623091229702492483605585073721264412149709993583141322266592750559275579995050115278206057147010955997160597027453459686201472851741864088919860955232923048430871432145083976260362799525140799]
sage: M2.eigenvalues()
[1.41421356237310, -1.41421356237310]

Converting the first of the latter values to an element of
RealField(1000) yields much what I would expect from higher precision
arithmetic:

 R = RealField(1000)
sage: x = M1.eigenvalues()[0]
sage: y = R(M2.eigenvalues()[0])
sage: x
1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623091229702492483605585073721264412149709993583141322266592750559275579995050115278206057147010955997160597027453459686201472851741864088919860955232923048430871432145083976260362799525140799
sage: y
1.4142135623730951454746218587388284504413604736328125000

So, while I don't know for a fact that it's using the precision you
need, it certainly does seem to be using high precision arithmetic
here. Furthermore, repeating it for various precisions seems to
increase the difference, as would be expected from better
approximations, and the number of digits in the result is consistent
with the interpretation that it is using the specified precision.

All of this to say that it seems to be doing what you want it to do.

Geremy Condra
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: arbitrary precision linear algebra

2011-03-02 Thread Paul Rubin
Ben123  writes:
> I'll ask on the Sage forums about this. In the mean time, I'm still
> trying to get arbitrary precision linear algebra in Python

You probably have to use something like gmpy.mpq to implement your
favorite eigenvalue computation algorithm.  Maxima might be able to do
it out of the box, but is perhaps more hassle to use than you want to
deal with.  See: http://en.wikipedia.org/wiki/Maxima_(software)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: TkTable and Python 3.1

2011-03-02 Thread Marcel Jakobs
Hello Chuck,

I am working with Ubuntu 10.04 LTS - Lucid Lynx, Python 3.1 and Tktable2.10.

I have installed Python and Tktable separatly. So I had to "tell" Python where 
to find Tktable. 

I built a file named 'tkTable.pth' in the directory 
"/usr/lib/python3.1/dist-packages". The file is has only one row:
/usr/lib/Tktable2.10
This is the directory where my Tktable-module is stored. ".pth"-files are 
working as "pointer" to modules.

I don't know how your directories are built, but I think the structure is equal.

Marcel

> On Tuesday, February 16, 2010 12:00 AM Charles McKnight wrote:

> HI All,
> 
> I am fiddling around with Python and I am trying to get tktable to work
> with Python 3.1 on Apple OS X 10.6 (Snow Leopard). Has anyone
> successfully accomplished this task, and if so, can you share how that
> you got it working? I have got Darwin Ports installed (current version)
> and I am using Python 3.1 (ports), Tcl/Tk 8.5 (ports) and I have
> installed TkTable 2.10 (ports). Somehow, I have missed doing something
> because the Python interpreter cannot seem to find the tktable module.
> 
> Thanks in advance!
> 
> Chuck


> Submitted via EggHeadCafe 
> Statistics, Probability, Lotteries and Dumb Programmers
> http://www.eggheadcafe.com/tutorials/aspnet/041de19a-e704-468f-bd3c-79164fc739f5/statistics-probability-lotteries-and-dumb-programmers.aspx
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re: TkTable and Python 3.1

2011-03-02 Thread Marcel Jakobs

...
I built a file named 'tkTable.pth' in the directory
"/usr/lib/python3.1/dist-packages"
... 



Submitted via EggHeadCafe 
Pass Values Between Windows Forms
http://www.eggheadcafe.com/tutorials/aspnet/a3e1e170-21d9-4a59-a659-3ead05bb36f2/pass-values-between-windows-forms.aspx
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re: Re: TkTable and Python 3.1

2011-03-02 Thread Marcel Jakobs
I don't know why, but every time when I have "sent" the directories name, it's 
not to see in the site. 
=> '/usr/lib/python3.1/dist-packages' 
=> Got to the home-directory of python and then save the file in the 
subdirectory "dist-packages".

Marcel

Submitted via EggHeadCafe 
Excel Generate High Quality RoadMaps
http://www.eggheadcafe.com/tutorials/aspnet/3310004f-e1ae-45a7-9bea-7b2b970d1230/excel-generate-high-quality-roadmaps.aspx
-- 
http://mail.python.org/mailman/listinfo/python-list


[no subject]

2011-03-02 Thread Gert Schmidt



Von meinem iPhone gesendet
--
http://mail.python.org/mailman/listinfo/python-list


Re: arbitrary precision linear algebra

2011-03-02 Thread Nobody
On Wed, 02 Mar 2011 06:42:22 -0800, Ben123 wrote:

> Hello. I have a written Python program which currently uses numpy to
> perform linear algebra operations. Specifically, I do matrix*matrix,
> matrix*vector, numpy.linalg.inv(matrix), and linalg.eig(matrix)
> operations. Now I am interested in allowing arbitrary precision. I
> have tried gmpy, bigfloat, mpmath, and decimal but I have been unable
> to easily implement any with my current program. I suspect I have to
> change some commands but I am unsure what.

numpy is implemented in C, and is limited to the language's primitive
types. It provides a "float96" type which I would guess is actually a
"long double" (80 bits on x86). You can't extend numpy's precision by
using a separate arbitary-precision library.

-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: Wing IDE 3.2.13 released

2011-03-02 Thread Wingware

Hi,

Wingware has released version 3.2.13 of Wing IDE, an integrated development
environment designed specifically for the Python programming language.

This is a maintenance release for Wing 3.2 users only and includes the
following improvements:

* Support for Python 3.2
* 6 minor bug fixes

NOTE: Wing 3.2.13 is intended only for users that have not already upgraded
to the latest major release, Wing IDE 4.0.

See http://wingware.com/pub/wingide/3.2.13/CHANGELOG.txt for details.

*Downloads*

Wing IDE Professionalhttp://wingware.com/downloads/wingide/3.2

Wing IDE Personalhttp://wingware.com/downloads/wingide-personal/3.2

Wing IDE 101 http://wingware.com/downloads/wingide-101/3.2

*About Wing IDE*

Wing IDE is an integrated development environment designed specifically for
the Python programming language.  It provides powerful editing, testing, and
debugging features that help reduce development and debugging time, cut down
on coding errors, and make it easier to understand and navigate Python code.
Wing IDE can be used to develop Python code for web, GUI, and embedded
scripting applications.

Wing IDE is available in three product levels:  Wing IDE Professional is
the full-featured Python IDE, Wing IDE Personal offers a reduced feature
set at a low price, and Wing IDE 101 is a free simplified version designed
for teaching entry level programming courses with Python.

Version 3.2 of Wing IDE Professional includes the following major features:

* Professional quality code editor with vi, emacs, and other keyboard 
personalities
* Code intelligence for Python:  Auto-completion, call tips, 
goto-definition,

  error indicators, smart indent and re-wrapping, and source navigation
* Advanced multi-threaded debugger with graphical UI, command line 
interaction,

  conditional breakpoints, data value tool tips over code, watch tool, and
  externally launched and remote debugging
* Powerful search and replace options including keyboard driven and 
graphical

  UIs, multi-file, wild card, and regular expression search and replace
* Version control integration for Subversion, CVS, Bazaar, git, 
Mercurial, and

  Perforce
* Integrated unit testing for the unittest, nose, and doctest frameworks
* Many other features including project manager, bookmarks, code snippets,
  OS command integration, indentation manager, PyLint integration, and 
perspectives

* Extremely configurable and may be extended with Python scripts

Please refer to the feature list at http://wingware.com/wingide/features for
a detailed listing of features by product level.

System requirements are Windows 2000 or later, OS X 10.3.9 or later for 
PPC or

Intel (requires X11 Server), or a recent Linux system (either 32 or 64 bit).
Wing IDE supports Python versions 2.0.x through 3.1.x and Stackless Python.

For more information, see http://wingware.com/products

*Purchasing and Upgrading*

Wing 3.2.13 is a free upgrade for all Wing IDE 3.x users. Version 2.x
licenses must be upgraded.

Upgrade a license: https://wingware.com/store/upgrade

Purchase a license:https://wingware.com/store/purchase

--

Wingware | Python IDE

The Intelligent Development Environment
for Python Programmers

www.wingware.com

--
http://mail.python.org/mailman/listinfo/python-list


Re: Checking against NULL will be eliminated?

2011-03-02 Thread Steven D'Aprano
On Wed, 02 Mar 2011 08:20:56 -0800, Steven Howe wrote:

> Back at NCR, they stressed the axiom '90% of the time is spent fixing
> 10% of the code'.

It's not an axiom, it's a platitude. Nor is it based on any objective 
evidence I've ever seen.


> How true that axiom is. Never more so then when faced with a programming
> language fix like PEP 4000. 

Do you realise that "PEP 4000" was Tom Zych being sarcastic? There is no 
PEP 4000:

http://www.python.org/dev/peps/


> Fortunately for me, I never trusted python's
> complex, or should I say 'overloaded' Boolean usage.

That's your loss. Just because you choose to not trust something which 
works deterministically and reliably, doesn't mean the rest of us 
shouldn't.


> If I want to know if a string or list dictionary is empty: if ( len(x)
> == 0 ).

Apart from the unnecessary length and the pointless reliance on an 
implementation detail, can you please explain how the above differs from 
`if not x:`? 

For starters, how about giving an example of a built-in string, list or 
dictionary where `if len(x) == 0` and `if x` give different results?



> If an item is None: if ( type(x) == types.NoneType ):

Good grief, now that truly is astoundingly unpythonic code!

`if x is None` is the right way to do it. It is also *guaranteed* to be 
correct, rather than being subject to failure-modes like this:

>>> import types
>>> types.NoneType = int  # monkey-patch the module
>>> x = 42
>>> if type(x) == types.NoneType:
... print "And now your world comes crashing down in flames!"
...
And now your world comes crashing down in flames!


No rogue libraries or functions can override the `is` operator or the 
None singleton. I think it is sad that you've been writing code which is 
*less* safe, in the mistaken belief that it was more safe. Perhaps you 
should stop writing C in Python, and learn to write Python.


> nothing
> worse then compiler errors, accept runtime errors.

"I find it amusing when novice programmers believe their main job is 
preventing programs from crashing. ... More experienced programmers 
realize that correct code is great, code that crashes could use 
improvement, but incorrect code that doesn’t crash is a horrible 
nightmare."
-- Chris Smith 
http://cdsmith.wordpress.com/2011/01/09/an-old-article-i-wrote/




-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-03-02 Thread Gregory Ewing

Terry Reedy wrote:

PyGui seems to be purely a gui package, but it appear to be aimed only 
at 2.x with no interest in 3.x.


I'm working on 3.x conversion right now and should have
something ready soon.

--
Greg
--
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-03-02 Thread Gregory Ewing

Octavian Rasnita wrote:

How complete is this GUI lib compared with others that can be used in 
Python apps?


It has most of the basic things you would want. There are one
or two gaps, and I'm working on filling them.


"Get the library and its documentation included in the core Python
distribution, so that truly cross-platform GUI applications may be written
that will run on any Python installation, anywhere."


I'm not sure at this point whether stdlib inclusion is really
a desirable goal or not. In any case, it's a very long-term issue.
The first priority is to develop it to the point where it's
a viable alternative to Tkinter.

--
Greg
--
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-03-02 Thread Corey Richardson
On 03/02/2011 07:40 PM, Gregory Ewing wrote:
> Octavian Rasnita wrote:
> 
>> How complete is this GUI lib compared with others that can be used in 
>> Python apps?
> 
> It has most of the basic things you would want. There are one
> or two gaps, and I'm working on filling them.

What are those gaps?
-- 
Corey Richardson
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Checking against NULL will be eliminated?

2011-03-02 Thread Steven D'Aprano
On Wed, 02 Mar 2011 23:46:31 +, Steven D'Aprano wrote:

> For starters, how about giving an example of a built-in string, list or
> dictionary where `if len(x) == 0` and `if x` give different results?

Er, how embarrassment... of course I mean either len(x) != 0, or not x, 
take your pick.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Checking against NULL will be eliminated?

2011-03-02 Thread Tom Zych
Steven D'Aprano wrote:
> Do you realise that "PEP 4000" was Tom Zych being sarcastic? There is no 
> PEP 4000:

Eh, well, maybe 10% sarcastic, 90% facetious. Wasn't trying to give
Carl a hard time.

-- 
Tom Zych / freethin...@pobox.com
Q: I'm having problems with my Windows software. Will you help me?
A: Yes. Go to a DOS prompt and type "format c:". Any problems you are
   experiencing will cease within a few minutes. -- Hacker Howto
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: arbitrary precision linear algebra

2011-03-02 Thread Ben123
On Mar 2, 4:48 pm, Nobody  wrote:
> On Wed, 02 Mar 2011 06:42:22 -0800, Ben123 wrote:
> > Hello. I have a written Python program which currently uses numpy to
> > perform linear algebra operations. Specifically, I do matrix*matrix,
> > matrix*vector, numpy.linalg.inv(matrix), and linalg.eig(matrix)
> > operations. Now I am interested in allowing arbitrary precision. I
> > have tried gmpy, bigfloat, mpmath, and decimal but I have been unable
> > to easily implement any with my current program. I suspect I have to
> > change some commands but I am unsure what.
>
> numpy is implemented in C, and is limited to the language's primitive
> types. It provides a "float96" type which I would guess is actually a
> "long double" (80 bits on x86). You can't extend numpy's precision by
> using a separate arbitary-precision library.

Hello. To clarify, I don't need numpy explicitly. I'm looking for an
arbitrary precision library which can also do linear algebra
operations: matrix*matrix, matrix*vector, matrix inverse, and
eigenvalues of matrix.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: arbitrary precision linear algebra

2011-03-02 Thread Ben123
On Mar 2, 1:34 pm, geremy condra  wrote:
> On Wed, Mar 2, 2011 at 10:47 AM, Ben123  wrote:
> > On Mar 2, 12:22 pm, geremy condra  wrote:
> >> On Wed, Mar 2, 2011 at 10:21 AM, geremy condra  wrote:
> >> > On Wed, Mar 2, 2011 at 6:42 AM, Ben123  wrote:
> >> >> Hello. I have a written Python program which currently uses numpy to
> >> >> perform linear algebra operations. Specifically, I do matrix*matrix,
> >> >> matrix*vector, numpy.linalg.inv(matrix), and linalg.eig(matrix)
> >> >> operations. Now I am interested in allowing arbitrary precision. I
> >> >> have tried gmpy, bigfloat, mpmath, and decimal but I have been unable
> >> >> to easily implement any with my current program. I suspect I have to
> >> >> change some commands but I am unsure what.
>
> >> >> My question is which of the arbitrary precision implementations will
> >> >> most easily handle linear algebra? I don't care about speed, just ease
> >> >> of use. Online tutorials for arbitrary precision linear algebra
> >> >> operations would be useful.
>
> >> >> For example, it looks like mpmath can handle matrix operations
> >> >>http://fredrik-j.blogspot.com/search?q=matrix
> >> >> but I was unable to find a clear tutorial. The tutorials for most of
> >> >> the arbitrary precision implementations demonstrate simple scalar
> >> >> examples.
>
> >> >> Thanks in advance
>
> >> > Have you looked at Sage[0]? I don't know for a fact, but you should be
> >> > able to define a matrix over RealField(precision_in_bits) and then
> >> > take the eigenvalue of it. I don't know if it will actually produce
> >> > the precision you need though.
>
> >> > Geremy Condra
>
> >> Apologies, forgot the links:
>
> >>http://www.sagemath.org/doc/constructions/linear_algebra.htmlhttp://w...
>
> >> Geremy Condra
>
> > I'm not sufficiently familiar with Sage, but from
> >http://www.sagemath.org/doc/constructions/linear_algebra.html
>
> > "currently Sage does not implement multiprecision numerical
> > eigenvalues/eigenvectors"
>
> > I'll ask on the Sage forums about this. In the mean time, I'm still
> > trying to get arbitrary precision linear algebra in Python
>
> I'd suggest you read that slightly more carefully. It's speaking
> specifically of RR and CC, ie, double-width reals and complex values.
> Using RealField and ComplexField- the arbitrary precision real and
> complex fields- seems to be working. Using the earlier example:
>
> sage: M1 = Matrix(RealField(1000), [[0, 2], [1, 0]])
> sage: M2 = Matrix(RR, [[0, 2], [1, 0]])
> sage: M1.eigenvalues()
> [1.414213562373095048801688724209698078569671875376948073176679737990732478 
> 462107038850387534327641572735013846230912297024924836055850737212644121497 
> 099935831413222665927505592755799950501152782060571470109559971605970274534 
> 596862014728517418640889198609552329230484308714321450839762603627995251407 
> 99,
> -1.414213562373095048801688724209698078569671875376948073176679737990732478 
> 462107038850387534327641572735013846230912297024924836055850737212644121497 
> 099935831413222665927505592755799950501152782060571470109559971605970274534 
> 596862014728517418640889198609552329230484308714321450839762603627995251407 
> 99]
> sage: M2.eigenvalues()
> [1.41421356237310, -1.41421356237310]
>
> Converting the first of the latter values to an element of
> RealField(1000) yields much what I would expect from higher precision
> arithmetic:
>
>  R = RealField(1000)
> sage: x = M1.eigenvalues()[0]
> sage: y = R(M2.eigenvalues()[0])
> sage: x
> 1.4142135623730950488016887242096980785696718753769480731766797379907324784 
> 621070388503875343276415727350138462309122970249248360558507372126441214970 
> 999358314132226659275055927557999505011527820605714701095599716059702745345 
> 968620147285174186408891986095523292304843087143214508397626036279952514079 9
> sage: y
> 1.41421356237309514547462185873882845044136047363281250 
> 000 
> 000 
> 000 0
>
> So, while I don't know for a fact that it's using the precision you
> need, it certainly does seem to be using high precision arithmetic
> here. Furthermore, repeating it for various precisions seems to
> increase the difference, as would be expected from better
> approximations, and the number of digits in the result is consistent
> with the interpretation that it is using the specified precision.
>
> All of this to say that it seems to be doing what you want it to do.
>
> Geremy Condra

Hello. I was able to install Sage 4.6.1 and get your example to work.
I will update this thread once I get my program to work with Sage.
-- 
http://mail.python.org/mailman/listinfo/python-list


having both dynamic and static variables

2011-03-02 Thread Yingjie Lan
Hi everyone,

Variables in Python are resolved dynamically at runtime, which comes at a 
performance cost. However, a lot of times we don't need that feature. Variables 
can be determined at compile time, which should boost up speed. Therefore, I 
wonder if it is a good idea to have static variables as well. So at compile 
time, a variable is determined to be either static  or dynamic (the reference 
of 
a static varialbe is determined at compile time -- the namespace implementation 
will consist of two parts, a tuple for static variables and a dict for dynamic 
ones). The resolution can be done at the second pass of compilation. By 
default, 
variables are considered static. A variables is determined dynamic when: 1. it 
is declared dynamic; 2. it is not defined locally and the nearest namespace has 
it declared dynamic. A static variable can't be deleted, so a deleted variable 
must be a dynamic one: we can either enforce that the variable must be 
explicitly declared or allow a del statement to implicitly declare a dynamic 
variable.

Any thoughts?

Yingjie



  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: having both dynamic and static variables

2011-03-02 Thread Steven D'Aprano
On Wed, 02 Mar 2011 19:45:16 -0800, Yingjie Lan wrote:

> Hi everyone,
> 
> Variables in Python are resolved dynamically at runtime, which comes at
> a performance cost. However, a lot of times we don't need that feature.
> Variables can be determined at compile time, which should boost up
> speed.
[...]

This is a very promising approach taken by a number of projects.

Cython and Pyrex are compilers that take Python-like code with static 
type declarations and use it to produce compiled C code.

PyPy is an implementation of Python with a JIT compiler that aims to 
eventually rival C for speed; it's currently about twice the speed of 
CPython for many tasks. It was based on the earlier project, Psyco. 
Neither Psyco nor PyPy require type declarations, the optimized path is 
taken at runtime according to the type of the data. In principle, the use 
of runtime data can enable the compiler to generate code which is 
significantly faster than would be generated at compile time.

Finally, Python 3 introduced type annotations, which are currently a 
feature looking for a reason.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Presentation: Offline (iPhone) Web Apps - Thurs 7pm in Lindon @ CORDA

2011-03-02 Thread AJ ONeal
Sorry for spamming you all... or not actually. I'm glad.


We're going to have an awesome meeting tomorrow at CORDA with two
presentations about something all your people using web frameworks are
hopefully interested in:

Offline Web Apps and IndexDB

AND

Offline Web Apps on iPhone / Android / MIDs


Bring a laptop and an Android, iPhone, iPad, whatever, and let's have an
awesome meeting tomorrow!

7pm - 9pm
CORDA Technologies, Inc.
350 South 400 West, Suite 100
Lindon, UT 84042

AJ ONeal
(317) 426-6525
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: having both dynamic and static variables

2011-03-02 Thread Yingjie Lan
- Original Message 

From: Steven D'Aprano 
To: python-list@python.org
Sent: Thu, March 3, 2011 1:27:01 PM
Subject: Re: having both dynamic and static variables

On Wed, 02 Mar 2011 19:45:16 -0800, Yingjie Lan wrote:

> Hi everyone,
> 
> Variables in Python are resolved dynamically at runtime, which comes at
> a performance cost. However, a lot of times we don't need that feature.
> Variables can be determined at compile time, which should boost up
> speed.

:This is a very promising approach taken by a number of projects.

Thanks, that's good to know -- so people are doing this already!

:Finally, Python 3 introduced type annotations, which are currently a 
:feature looking for a reason.

I have a use for that feature -- I have a project that help build the 
scaffold for people to extend CPython. See http://expy.sf.net/
It is only good for Python 2 at this moment.

Yingjie



  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: WxPython versus Tkinter.

2011-03-02 Thread Gregory Ewing

Corey Richardson wrote:


What are those gaps?


That depends on what you consider to be essential.
Things I would like to add include:

* Combo box
* Group box
* Tab panel (aka "notebook")
* Table view
* Tree view
* Rich text editor

--
Greg
--
http://mail.python.org/mailman/listinfo/python-list


2to3 and maketrans

2011-03-02 Thread Gregory Ewing

What is the recommended way to write code for 2.7 using
maketrans() on text strings in such a way that it will
convert correctly using 2to3?

There seems to be two versions of maketrans in 3.x, one
for text and one for bytes. Code that references
string.maketrans ends up with the one for bytes, which
is not what I want. But I can't write str.maketrans,
because that doesn't exist in 2.x.

So what am I supposed to do?

--
Greg
--
http://mail.python.org/mailman/listinfo/python-list


Re: Playing WAV file with Python

2011-03-02 Thread VGNU Linux
On Wed, Mar 2, 2011 at 1:17 PM, VGNU Linux  wrote:

> Hi All,
> How can I play WAV file in python without OS(like Linux/Windows/MAC) on a
> device ?
> On Google I found lot of different solution but related to OS's like
> winsound, ossaudiodev etc which are not useful.
> Thanks in advance.
>
> Regards,
> VGNU
>

Hi All,
Can anyone please give me any idea on this ?

Regards,
VGNU
-- 
http://mail.python.org/mailman/listinfo/python-list


Python escape usage in django templates by GAE

2011-03-02 Thread Niklasro
Hi
I got problems with escape displaying like junk when upgrading from
django 0.96 to 1.2 with google app engine.
The code is

 # let user choose authenticator
for p in openIdProviders:
p_name = p.split('.')[0] # take "AOL" from "AOL.com"
p_url = p.lower()# "AOL.com" -> "aol.com"
loginmsg = loginmsg + '%s ' % ( #'','')
   users.create_login_url(federated_identity=p_url),
p_name)
loginmsg = loginmsg + '%s' %
('login',_("Log in"))

And the output is strange. View source show this:

Add03 Mar

Log inGoogle Yahoo MySpace AOL Log in



Can you make ad advice how to proceed? Many thanks,
Niklas Rosenrantz
-- 
http://mail.python.org/mailman/listinfo/python-list