Re: Looking for UNICODE to ASCII Conversioni Example Code

2013-10-19 Thread Chris Angelico
On Sun, Oct 20, 2013 at 1:26 PM, Ben Finney wrote: > Roy Smith writes: > >> In article , >> Chris Angelico wrote: >> >> > > Heck, I can't even really move off 2.6 because we use Amazon's EMR >> > > service, which is stuck on 2.6. >> > >> > Hrm. 2.6 is now in source-only security-only support, a

Re: Looking for UNICODE to ASCII Conversioni Example Code

2013-10-19 Thread Ben Finney
Roy Smith writes: > In article , > Chris Angelico wrote: > > > > Heck, I can't even really move off 2.6 because we use Amazon's EMR > > > service, which is stuck on 2.6. > > > > Hrm. 2.6 is now in source-only security-only support, and that's > > about to end (there's a 2.6.9 in the pipeline,

Re: Looking for UNICODE to ASCII Conversioni Example Code

2013-10-19 Thread Roy Smith
In article , Chris Angelico wrote: > > Heck, I can't even really move off 2.6 because we use Amazon's EMR > > service, which is stuck on 2.6. > > Hrm. 2.6 is now in source-only security-only support, and that's about > to end (there's a 2.6.9 in the pipeline, and that's that). It's about > time

Re: Looking for UNICODE to ASCII Conversioni Example Code

2013-10-19 Thread Chris Angelico
On Sun, Oct 20, 2013 at 12:52 PM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> Or are you saying that that particular error code path did NOT handle >> non-ASCII characters? > > Exactly. The fundamental error was caught, and then we raised another > UnicodeEncodeError generating

Re: Looking for UNICODE to ASCII Conversioni Example Code

2013-10-19 Thread Roy Smith
In article , Chris Angelico wrote: > On Sun, Oct 20, 2013 at 3:49 AM, Roy Smith wrote: > > So, yesterday, I tracked down an uncaught exception stack in our logs to a > > user whose username included the unicode character 'SMILING FACE WITH > > SUNGLASSES' (U+1F60E). It turns out, that's perf

Re: skipping __init__ and using exploiting a class member instead

2013-10-19 Thread Ned Batchelder
On 10/19/13 8:42 PM, Peter Cacioppi wrote: To be clear, my original post had a goof. So my original, de-goofed, idiom was class Foo (object) : _lazy = None def foo(self, x) : self._lazy = self._lazy or self.get_something(x) def get_something(self, x) : # doesn'

Re: skipping __init__ and using exploiting a class member instead

2013-10-19 Thread Peter Cacioppi
To be clear, my original post had a goof. So my original, de-goofed, idiom was class Foo (object) : _lazy = None def foo(self, x) : self._lazy = self._lazy or self.get_something(x) def get_something(self, x) : # doesn't really matter, so long as it returns truthy res

Re: skipping __init__ and using exploiting a class member instead

2013-10-19 Thread Peter Cacioppi
Yes, I see the light now. My idiom works, but Steven has shown me the droids I am looking for. Thanks! -- https://mail.python.org/mailman/listinfo/python-list

Re: converting letters to numbers

2013-10-19 Thread Tim Roberts
Steven D'Aprano wrote: >On Sun, 13 Oct 2013 20:13:32 -0700, Tim Roberts wrote: > >> def add(c1, c2): >> % Decode >>... >Python uses # for comments, not %, as I'm sure you know. What language >were you thinking off when you wrote the above? Psssht, I know better than that. I've been readin

Re: Changing the terminal title bar with Python

2013-10-19 Thread Tim Roberts
Steven D'Aprano wrote: > >You might find this useful, or just for fun, but on POSIX systems (Linux, >Unix, Apple Mac, but not Windows) you can change the title of the >terminal window from Python. Just for completeness, this is also possible in Windows, assuming you have installed py32win, whi

Re: Screenshots in Mac OS X

2013-10-19 Thread Pratik Mehta
Hey Ned, Thanks for reverting. I am looking for the similar functionality. Thanks for sharing that link. Could you pls help me out with the Python Code? Thanks. :) -- https://mail.python.org/mailman/listinfo/python-list

Screenshots in Mac OS X

2013-10-19 Thread Pratik Mehta
Hi Guys, Good Morning! How are you all doing? I am in need of your help. I am stuck in a problem. I want to write my own Screenshot Taking program in Python for Mac OS X. Example : Whenever Command + Shift + 3 is pressed ==> whatever is there on the screen, should be grabbed / captured, and s

Re: Error Testing

2013-10-19 Thread Chris Angelico
On Sun, Oct 20, 2013 at 9:46 AM, Ned Deily wrote: > In article > , > Chris Angelico wrote: >> Pascal tried to create a new operator, := to be read "becomes", to >> deal with the whole equality-vs-assignment issue. > > Um, Pascal was just following the lead of ALGOL 60, roughly a decade earlier.

Error running "make install" on CentOS 6.4 (64bit)

2013-10-19 Thread jh113355
changing mode of /usr/local/lib/python2.7/lib-dynload/ to 755 running install_scripts copying build/scripts-2.7/idle -> /usr/local/bin copying build/scripts-2.7/2to3 -> /usr/local/bin error: /usr/local/bin/2to3: No such file or directory make: *** [sharedinstall] Error 1 [root@afdice-pc0v1 Python-2

Re: Error Testing

2013-10-19 Thread Ned Deily
In article , Chris Angelico wrote: > Pascal tried to create a new operator, := to be read "becomes", to > deal with the whole equality-vs-assignment issue. Um, Pascal was just following the lead of ALGOL 60, roughly a decade earlier. -- Ned Deily, n...@acm.org -- https://mail.python.org/m

Re: Screenshots in Mac OS X

2013-10-19 Thread Ned Deily
In article <22861e2f-50f2-4d74-9024-53caec557...@googlegroups.com>, Pratik Mehta wrote: > I want to write my own Screenshot Taking program in Python for Mac OS X. > > Example : Whenever Command + Shift + 3 is pressed ==> whatever is there on > the screen, should be grabbed / captured, and shoul

Re: Screenshots in Mac OS X

2013-10-19 Thread Chris Angelico
On Sun, Oct 20, 2013 at 9:12 AM, Pratik Mehta wrote: > Command + Shift + 5 ==> This one is a little bit tricky which I am looking > for. This shortcut doesn't exist. I want to create one of my own, where it > would grab the entire webpage's screenshot which I am currently working on, > and stor

Re: skipping __init__ and using exploiting a class member instead

2013-10-19 Thread Steven D'Aprano
On Sat, 19 Oct 2013 14:44:55 -0700, Peter Cacioppi wrote: > Is the following considered poor Python form? > > class Foo (object) : > _lazy = None > def foo(self, x) : > _lazy = _lazy or self.get_something(x) > def get_something(self, x) : > # doesn't really matter > >

Re: Error Testing

2013-10-19 Thread Chris Angelico
On Sun, Oct 20, 2013 at 3:22 AM, rusi wrote: > The problem is that python is an imperative language and uses the '=' sign > for assignment. In math of course '=' stands for equality. Pascal tried to create a new operator, := to be read "becomes", to deal with the whole equality-vs-assignment is

Re: Error Testing

2013-10-19 Thread Chris Angelico
On Sun, Oct 20, 2013 at 6:50 AM, Terry Reedy wrote: > On 10/19/2013 2:08 PM, David Robinow wrote: >> >> On Sat, Oct 19, 2013 at 9:01 AM, Chris Angelico wrote: >> >>> You can try all these out in the interactive interpreter (you probably >>> have IDLE installed, which on Windows is rather nicer to

Re: skipping __init__ and using exploiting a class member instead

2013-10-19 Thread Robert Kern
On 2013-10-19 22:55, Ned Batchelder wrote: On 10/19/13 5:44 PM, Peter Cacioppi wrote: Is the following considered poor Python form? class Foo (object) : _lazy = None def foo(self, x) : _lazy = _lazy or self.get_something(x) def get_something(self, x) : # doesn't

Re: What's wrong with Windows Command Prompt (was Re: Error Testing)

2013-10-19 Thread Chris Angelico
On Sun, Oct 20, 2013 at 7:35 AM, Terry Reedy wrote: > Idle can recall previous input two different ways, by cursor or key. One can > use the mouse to select where to edit. CP requires use of arrow keys to move > the cursor around. Idle recall input *statements*. CP recalls input *lines*. > Previou

Screenshots in Mac OS X

2013-10-19 Thread Pratik Mehta
Hi Guys, Good Morning! How are you all doing? I am in need of your help. I am stuck in a problem. I want to write my own Screenshot Taking program in Python for Mac OS X. Example : Whenever Command + Shift + 3 is pressed ==> whatever is there on the screen, should be grabbed / captured, and s

Re: skipping __init__ and using exploiting a class member instead

2013-10-19 Thread Peter Cacioppi
On Saturday, October 19, 2013 2:44:55 PM UTC-7, Peter Cacioppi wrote: > Is the following considered poor Python form? > > > > class Foo (object) : > > _lazy = None > > def foo(self, x) : > > _lazy = _lazy or self.get_something(x) > > def get_something(self, x) : > >

Re: Looking for UNICODE to ASCII Conversioni Example Code

2013-10-19 Thread Chris Angelico
On Sun, Oct 20, 2013 at 3:49 AM, Roy Smith wrote: > So, yesterday, I tracked down an uncaught exception stack in our logs to a > user whose username included the unicode character 'SMILING FACE WITH > SUNGLASSES' (U+1F60E). It turns out, that's perfectly fine as a user name, > except that in o

Re: skipping __init__ and using exploiting a class member instead

2013-10-19 Thread Ned Batchelder
On 10/19/13 5:44 PM, Peter Cacioppi wrote: Is the following considered poor Python form? class Foo (object) : _lazy = None def foo(self, x) : _lazy = _lazy or self.get_something(x) def get_something(self, x) : # doesn't really matter I like this idiom for certai

skipping __init__ and using exploiting a class member instead

2013-10-19 Thread Peter Cacioppi
Is the following considered poor Python form? class Foo (object) : _lazy = None def foo(self, x) : _lazy = _lazy or self.get_something(x) def get_something(self, x) : # doesn't really matter I like this idiom for certain situations, just wondering if it will raise the

What's wrong with Windows Command Prompt (was Re: Error Testing)

2013-10-19 Thread Terry Reedy
On 10/19/2013 2:31 PM, Tim Chase wrote: On 2013-10-19 14:08, David Robinow wrote: On Sat, Oct 19, 2013 at 9:01 AM, Chris Angelico wrote: You can try all these out in the interactive interpreter (you probably have IDLE installed, which on Windows is rather nicer to work with than the default int

Re: Error Testing

2013-10-19 Thread Terry Reedy
On 10/19/2013 2:08 PM, David Robinow wrote: On Sat, Oct 19, 2013 at 9:01 AM, Chris Angelico wrote: You can try all these out in the interactive interpreter (you probably have IDLE installed, which on Windows is rather nicer to work with than the default interactive mode). IDLE is cross-plat

Re: Error Testing

2013-10-19 Thread Tim Chase
On 2013-10-19 14:08, David Robinow wrote: > On Sat, Oct 19, 2013 at 9:01 AM, Chris Angelico wrote: >> You can try all these out in the interactive interpreter (you >> probably have IDLE installed, which on Windows is rather nicer to >> work with than the default interactive mode). > > IDLE is cr

Re: Error Testing

2013-10-19 Thread David Robinow
On Sat, Oct 19, 2013 at 9:01 AM, Chris Angelico wrote: > You can try all these out in the interactive interpreter (you probably > have IDLE installed, which on Windows is rather nicer to work with > than the default interactive mode). IDLE is cross-platform. Could you explain why you say "on Wi

Re: Looking for UNICODE to ASCII Conversioni Example Code

2013-10-19 Thread Roy Smith
On Saturday, October 19, 2013 12:16:02 PM UTC-4, Steven D'Aprano wrote: > Another reasonable use for accent-stripping is searches. If I'm searching > for music by the Blue Öyster Cult, it would be good to see results for > Blue Oyster Cult as well. Tell me about it (I work at Songza; music sear

Re: Error Testing

2013-10-19 Thread rusi
On Saturday, October 19, 2013 7:04:30 PM UTC+5:30, Scott Novinger wrote: > > My plan is to create several different programs that perform specific > Algebraic > operations. My boys are learning Algebra 2 and I thought it might be a fun > way > to help us all learn Algebra and programming toge

Re: Looking for UNICODE to ASCII Conversioni Example Code

2013-10-19 Thread Steven D'Aprano
On Sat, 19 Oct 2013 11:14:30 -0300, Zero Piraeus wrote: > : > > On Sat, Oct 19, 2013 at 09:19:12AM +, Steven D'Aprano wrote: >> Make no mistake, this sort of simple-minded stripping of accents and >> diacritics is an extremely ham-fisted thing to do. [...] > Joking aside, there is a legitimat

Re: Looking for UNICODE to ASCII Conversioni Example Code

2013-10-19 Thread rusi
On Saturday, October 19, 2013 8:40:37 PM UTC+5:30, Roy Smith wrote: > Zero Piraeus wrote: > > > For example, a miscreant may create the username 'míguel' in order to > > pose as another user 'miguel', relying on other users inattentiveness. > > Asciifying is one way of reducing the risk of that.

Re: ANN: matplotlib 1.3.1

2013-10-19 Thread Piet van Oostrum
Ned Deily writes: > In article , > Piet van Oostrum wrote: >> I tried to install it from source, on Mac OS X 10.6.8, with Python >> 3.3.2, and Tck/Tk 8.5 installed as Frameworks, but I get an error during >> compilation. It seems it doesn't find the Tcl/TK framework. >> >> >> building 'matplo

Re: Weird problem with UDP and gevent

2013-10-19 Thread Grant Edwards
On 2013-10-18, James Harris wrote: > "Roy Smith" wrote in message > news:l3riea$82$1...@panix2.panix.com... >> I'm running: >> >> Ubuntu Precise >> Python 2.7.3 >> django 1.4.5 >> gunicorn 0.17.4 >> gevent 1.0dev (rc3) >> >> I haven't been able to pin this down exactly, but it looks like if I >>

Re: Looking for UNICODE to ASCII Conversioni Example Code

2013-10-19 Thread Roy Smith
In article , Zero Piraeus wrote: > For example, a miscreant may create the username 'míguel' in order to > pose as another user 'miguel', relying on other users inattentiveness. > Asciifying is one way of reducing the risk of that. Determining if two strings are "almost the same" is not easy.

Re: Looking for UNICODE to ASCII Conversioni Example Code

2013-10-19 Thread Zero Piraeus
: On Sat, Oct 19, 2013 at 09:19:12AM +, Steven D'Aprano wrote: > Make no mistake, this sort of simple-minded stripping of accents and > diacritics is an extremely ham-fisted thing to do. I used to live on a street called Calle Colón, so I'm aware of the dangers of stripping diacritics: http

Re: Error Testing

2013-10-19 Thread Chris Angelico
On Sun, Oct 20, 2013 at 12:34 AM, Scott Novinger wrote: > I read the link on Handling Exceptions. The first bit of code worked for my > purposes. I was able to reduce my number of lines of code significantly and > my program works! Thank you all for your help solving this problem! As you get a

Re: Error Testing

2013-10-19 Thread Scott Novinger
On Saturday, October 19, 2013 8:37:01 AM UTC-4, Mark Lawrence wrote: > On 19/10/2013 13:23, Scott Novinger wrote: > > > Hello. > > > > > > I've written a program for my kids to calculate arc length. I want to > > include some error testing for value types entered that are something other > >

Re: Error Testing

2013-10-19 Thread Mark Lawrence
On 19/10/2013 13:57, Roy Smith wrote: On 10/19/13 8:23 AM, Scott Novinger wrote: My goal is to make sure that the value entered for the radius is an integer value. In article , Ned Batchelder wrote: First, radius is the result of input(), so it is always a string, never an int. input()

Re: Error Testing

2013-10-19 Thread Roy Smith
In article , Ned Batchelder wrote: > On 10/19/13 8:57 AM, Roy Smith wrote: > > On 10/19/13 8:23 AM, Scott Novinger wrote: > >>> My goal is to make sure that the value entered for the radius is an > >>> integer > >>> value. > > In article , > > Ned Batchelder wrote: > > > >> First, radius is

Re: Error Testing

2013-10-19 Thread Ned Batchelder
On 10/19/13 8:57 AM, Roy Smith wrote: On 10/19/13 8:23 AM, Scott Novinger wrote: My goal is to make sure that the value entered for the radius is an integer value. In article , Ned Batchelder wrote: First, radius is the result of input(), so it is always a string, never an int. input() re

Re: Error Testing

2013-10-19 Thread Chris Angelico
On Sat, Oct 19, 2013 at 11:57 PM, Roy Smith wrote: > On 10/19/13 8:23 AM, Scott Novinger wrote: >> > My goal is to make sure that the value entered for the radius is an integer >> > value. > > In article , > Ned Batchelder wrote: > >> First, radius is the result of input(), so it is >> always a

Re: Error Testing

2013-10-19 Thread Chris Angelico
On Sat, Oct 19, 2013 at 11:23 PM, Scott Novinger wrote: > # Create the variable for radius, "radius". > print('Please enter the circle radius and press ENTER:') > radius = input() > > # Check to make sure the entered value is an integer. > if type(radius) != type(int): >

Re: Error Testing

2013-10-19 Thread Roy Smith
On 10/19/13 8:23 AM, Scott Novinger wrote: > > My goal is to make sure that the value entered for the radius is an integer > > value. In article , Ned Batchelder wrote: > First, radius is the result of input(), so it is > always a string, never an int. input() returns ints or floats for valu

Re: Looking for UNICODE to ASCII Conversioni Example Code

2013-10-19 Thread caldwellinva
Zero/Stephen ... thank you for your replies ... they were both very helpful, both in addressing the immediate issue and for getting a better understanding of the context of the conversion. Greatly appreciate your taking the time for such good solutions. -- https://mail.python.org/mailman/listin

Re: Error Testing

2013-10-19 Thread Ned Batchelder
On 10/19/13 8:23 AM, Scott Novinger wrote: Hello. I've written a program for my kids to calculate arc length. I want to include some error testing for value types entered that are something other than integer values. My goal is to make sure that the value entered for the radius is an integer

Re: Error Testing

2013-10-19 Thread Mark Lawrence
On 19/10/2013 13:23, Scott Novinger wrote: Hello. I've written a program for my kids to calculate arc length. I want to include some error testing for value types entered that are something other than integer values. My goal is to make sure that the value entered for the radius is an integer

Re: Looking for UNICODE to ASCII Conversioni Example Code

2013-10-19 Thread Roy Smith
In article , caldwelli...@gmail.com wrote: > I am looking for an example of a UNICODE to ASCII conversion example that > will remove diacritics from characters (and leave the characters, i.e., Klüft > to Kluft) as well as handle the conversion of other characters, like große to > grosse. http

Error Testing

2013-10-19 Thread Scott Novinger
Hello. I've written a program for my kids to calculate arc length. I want to include some error testing for value types entered that are something other than integer values. My goal is to make sure that the value entered for the radius is an integer value. How could I rewrite this code to ma

Re: Python was designed (was Re: Multi-threading in Python vs Java)

2013-10-19 Thread Chris Angelico
On Sat, Oct 19, 2013 at 8:57 PM, Steven D'Aprano wrote: > On Wed, 16 Oct 2013 23:49:02 -0700, Peter Cacioppi wrote: > >> I don't know if I want to step into the flames here, > > Go on, be bold! You learn a lot by making bold claims and having them > shot down. Yes, it's a very effective technique

Re: Python was designed (was Re: Multi-threading in Python vs Java)

2013-10-19 Thread Steven D'Aprano
On Wed, 16 Oct 2013 23:49:02 -0700, Peter Cacioppi wrote: > I don't know if I want to step into the flames here, Go on, be bold! You learn a lot by making bold claims and having them shot down. Or at least, I did. Now I know everything, so I can afford to be humble. *wink* > but my > unders

Re: Looking for UNICODE to ASCII Conversioni Example Code

2013-10-19 Thread Steven D'Aprano
On Fri, 18 Oct 2013 13:45:53 -0700, caldwellinva wrote: > Hi! > > I am looking for an example of a UNICODE to ASCII conversion example > that will remove diacritics from characters (and leave the characters, > i.e., Klüft to Kluft) as well as handle the conversion of other > characters, like groß