Re: I am fed up with Python GUI toolkits...

2011-07-23 Thread Dan Stromberg
On Wed, Jul 20, 2011 at 12:20 AM, Stefan Behnel wrote: > Steven D'Aprano, 20.07.2011 06:28: > > Python has a GIL. >>> >> >> Except for Jython, IronPython and PyPy. >> > > PyPy has a GIL, too. There's been talk of removing PyPy's GIL using transactional memory though. -- http://mail.python.org

Re: I am fed up with Python GUI toolkits...

2011-07-23 Thread Chris Angelico
On Sun, Jul 24, 2011 at 1:56 PM, Cameron Simpson wrote: > And then you have the cross platform nirvana. Except for the browsers' > various differences and bugs etc etc... > The "platform" ceases to be Windows/Linux/Mac, ceases to be Qt/GTK/Tk, and instead becomes Webkit/Gecko/Trident. It's still

Re: Convert '165.0' to int

2011-07-23 Thread Dan Stromberg
On Sat, Jul 23, 2011 at 8:53 PM, Billy Mays wrote: > I'll probably get flak for this, but damn the torpedoes: > > def my_int(num): >import re >try: >m = re.match('^(-?[0-9]+)(.0)?$', num) >return int(m.group(1)) >except AttributeError: >#raise your own error, o

Re: I am fed up with Python GUI toolkits...

2011-07-23 Thread Cameron Simpson
On 23Jul2011 22:21, Gregory Ewing wrote: | Tim Roberts wrote: | >Gregory Ewing wrote: | >>sturlamolden wrote: | >>>Or should modern deskop apps be written with something completely | >>>different, such as HTML5? | >> | >>I hope not! HTML is great for web pages, but not | >>everything should be a

Re: Convert '165.0' to int

2011-07-23 Thread Billy Mays
On 7/23/2011 2:28 PM, rantingrick wrote: On Jul 23, 1:53 am, Frank Millman wrote: -- The problem with that is that it will silently ignore any non-zero digits after the point. Of course int(float(x)) does the same, which I had overlooked. ---

Re: Strings show as brackets with a 'u'.

2011-07-23 Thread Thomas Jollans
On 24/07/11 02:52, Dan Stromberg wrote: > > It's probably a list containing a single unicode string. > > You can pull the first element from the list with n[0]. > > To print a unicode string in 2.x without the u stuff: > > print u'174'.encode('ISO-8859-1') just >>> print u'174' will do. Encod

Re: Strings show as brackets with a 'u'.

2011-07-23 Thread Chris Angelico
On Sun, Jul 24, 2011 at 10:33 AM, goldtech wrote: > >  I'm using using Idle on winXP, activestate 2.7. Is there a way to > suppress this and just show 174  in the shell ? > A script reading data and assigns 174 to n via some regex. Links on > this appreciated - I've tried to understand unicode bef

Re: Strings show as brackets with a 'u'.

2011-07-23 Thread Dan Stromberg
It's probably a list containing a single unicode string. You can pull the first element from the list with n[0]. To print a unicode string in 2.x without the u stuff: print u'174'.encode('ISO-8859-1') On Sat, Jul 23, 2011 at 5:33 PM, goldtech wrote: > > Hi, > > >>> n > [u'174'] > >>> > > Prob

Re: Strings show as brackets with a 'u'.

2011-07-23 Thread rantingrick
On Jul 23, 7:33 pm, goldtech wrote: > > >>> n > [u'174'] > > Probably newbie question but not sure how suppress the brackets and > the 'u' ? I assume pyhon is telling me it's a unicode string in the n > variable. Try type(n) and see what happens. Then report back. :) -- http://mail.python.org/ma

Strings show as brackets with a 'u'.

2011-07-23 Thread goldtech
Hi, >>> n [u'174'] >>> Probably newbie question but not sure how suppress the brackets and the 'u' ? I assume pyhon is telling me it's a unicode string in the n variable. I'm using using Idle on winXP, activestate 2.7. Is there a way to suppress this and just show 174 in the shell ? A script

Re: Is there a way to customise math.sqrt(x) for some x?

2011-07-23 Thread rantingrick
On Jul 16, 3:35 am, Steven D'Aprano wrote: > I have a custom object that customises the usual maths functions and > operators, such as addition, multiplication, math.ceil etc. > > Is there a way to also customise math.sqrt? I don't think there is, but I > may have missed something. Hmm, this ques

ANN: python-ldap 2.4.3

2011-07-23 Thread Michael Ströder
Find a new release of python-ldap: http://pypi.python.org/pypi/python-ldap/2.4.3 python-ldap provides an object-oriented API to access LDAP directory servers from Python programs. It mainly wraps the OpenLDAP 2.x libs for that purpose. Additionally it contains modules for other LDAP-related stu

Re: Convert '165.0' to int

2011-07-23 Thread rantingrick
On Jul 23, 1:53 am, Frank Millman wrote: >-- > The problem with that is that it will silently ignore any non-zero > digits after the point. Of course int(float(x)) does the same, which I > had overlooked. >---

Re: Is there a way to customise math.sqrt(x) for some x?

2011-07-23 Thread John Nagle
On 7/16/2011 2:14 AM, Chris Angelico wrote: On Sat, Jul 16, 2011 at 6:35 PM, Steven D'Aprano wrote: I have a custom object that customises the usual maths functions and operators, such as addition, multiplication, math.ceil etc. Is there a way to also customise math.sqrt? I don't think there

Re: Convert '165.0' to int

2011-07-23 Thread Chris Angelico
On Sun, Jul 24, 2011 at 1:12 AM, Billy Mays wrote: > On 7/23/2011 3:42 AM, Chris Angelico wrote: >> >> int(s.rstrip('0').rstrip('.')) >> > > Also, it will (in?)correct parse strings such as: > > '16500' > > to 165. Yes, it will, but is that an issue to the OP? Programming

Re: Convert '165.0' to int

2011-07-23 Thread Billy Mays
On 7/23/2011 3:42 AM, Chris Angelico wrote: int(s.rstrip('0').rstrip('.')) Also, it will (in?)correct parse strings such as: '16500' to 165. -- Bill -- http://mail.python.org/mailman/listinfo/python-list

Re: I am fed up with Python GUI toolkits...

2011-07-23 Thread Gregory Ewing
Tim Roberts wrote: Gregory Ewing wrote: sturlamolden wrote: Or should modern deskop apps be written with something completely different, such as HTML5? I hope not! HTML is great for web pages, but not everything should be a web page. I don't think your glibness is justified. There is a

Re: Convert '165.0' to int

2011-07-23 Thread Frank Millman
On Jul 23, 10:23 am, Steven D'Aprano wrote: > Frank Millman wrote: > > To recap, the original problem is that it would appear that some third- > > party systems, when serialising int's into a string format, add a .0 > > to the end of the string. I am trying to get back to the original int > > safe

Re: Convert '165.0' to int

2011-07-23 Thread Frank Millman
On Jul 23, 9:42 am, Chris Angelico wrote: > On Sat, Jul 23, 2011 at 4:53 PM, Frank Millman wrote: > > The problem with that is that it will silently ignore any non-zero > > digits after the point. Of course int(float(x)) does the same, which I > > had overlooked. > > If you know that there will a

PyCon Australia 2011: Registration Deadlines

2011-07-23 Thread Ryan Kelly
Hi Everyone, Registrations for PyCon Australia 2011 are closing soon! The conference is now less than a month away, so we need to start finalising numbers for shirts, catering and the venue itself. If you're planning to attend, please register now so you don't miss out. PyCon Australia is A

Re: Convert '165.0' to int

2011-07-23 Thread Steven D'Aprano
Frank Millman wrote: > To recap, the original problem is that it would appear that some third- > party systems, when serialising int's into a string format, add a .0 > to the end of the string. I am trying to get back to the original int > safely. > > The ideal solution is the one I sketched out

Re: Convert '165.0' to int

2011-07-23 Thread Chris Angelico
On Sat, Jul 23, 2011 at 4:53 PM, Frank Millman wrote: > The problem with that is that it will silently ignore any non-zero > digits after the point. Of course int(float(x)) does the same, which I > had overlooked. If you know that there will always be a trailing point, you can trim off any traili