Re: Python example source code

2014-01-13 Thread Koray YILMAZ
On Sunday, January 12, 2014 4:37:18 PM UTC+2, ngangsia akumbo wrote: > where can i find example source code by topic? > > Any help please Hi, Take a look at https://github.com/dabeaz/python-cookbook. I am using "NapCat" mobile application to read codes. -Koray -- https://mail.python.org/mailm

Re: Code review?

2014-01-13 Thread Chris Angelico
On Tue, Jan 14, 2014 at 6:22 PM, Bob Martin wrote: > Does any Linux distro ship with Python 3? I haven't seen one. On most Debian-based distros, you can simply 'apt-get install python3', and you'll get some 3.x version (in Debian Squeeze, that's 3.1, Debian Wheezy packages 3.2; Ubuntu since Rari

Re: Code review?

2014-01-13 Thread Bayram Güçlü
On 14-01-2014 11:22, Bob Martin wrote: in 714500 20140113 233415 Chris Angelico wrote: On Tue, Jan 14, 2014 at 7:43 AM, Steven D'Aprano wrote: On Tue, 14 Jan 2014 03:40:25 +1100, Chris Angelico wrote: Incidentally, is there a reason you're using Python 2.6? You should be able to

Re: Code review?

2014-01-13 Thread Bob Martin
in 714500 20140113 233415 Chris Angelico wrote: >On Tue, Jan 14, 2014 at 7:43 AM, Steven D'Aprano wrote: >> On Tue, 14 Jan 2014 03:40:25 +1100, Chris Angelico wrote: >> >>> Incidentally, is there a reason you're using Python 2.6? You should be >>> able

Re: Tkinter GUI Error

2014-01-13 Thread Chris Angelico
On Tue, Jan 14, 2014 at 5:49 AM, wrote: > entry = entry1var.get() > if entry == num1: > elif entry > num1: > elif entry < num1: > > num1 =str(random.randint(10,99)) > num2 =str(random.randint(10,99)) > num3 =str(random.randint(10,99)) > mastercode = num1+num2+num3 Be careful of c

Re: Tkinter GUI Error

2014-01-13 Thread Rick Johnson
On Monday, January 13, 2014 12:49:07 PM UTC-6, Lewis Wood wrote: > labelent1 = Label(main, text="Correct!",fg="green").grid(row = 0, column = 3) > > [snip] > > UnboundLocalError: local variable 'labelent1' referenced before assignment Observe the following interactive session and prepare to be e

Re: Code review?

2014-01-13 Thread Chris Angelico
On Tue, Jan 14, 2014 at 7:43 AM, Steven D'Aprano wrote: > On Tue, 14 Jan 2014 03:40:25 +1100, Chris Angelico wrote: > >> Incidentally, is there a reason you're using Python 2.6? You should be >> able to upgrade at least to 2.7, and Flask ought to work fine on 3.3 >> (the current stable Python). If

Mistake or Troll (was Re: 'Straße' ('Strasse') and Python 2)

2014-01-13 Thread Terry Reedy
On 1/13/2014 4:54 AM, wxjmfa...@gmail.com wrote: I'm afraid I'm understanding Python (on this aspect very well). Really? Do you belong to this group of people who are naively writing wrong Python code (usually not properly working) during more than a decade? To me, the important question i

Re: plotting slows down

2014-01-13 Thread Terry Reedy
On 1/13/2014 12:45 PM, Chris Angelico wrote: On Tue, Jan 14, 2014 at 4:39 AM, Ian Kelly wrote: On Mon, Jan 13, 2014 at 6:26 AM, Dave Angel wrote: Next, please repost any source code with indentation preserved. Your message shows it all flushed to the left margin, probably due to posting

Re: proposal: bring nonlocal to py2.x

2014-01-13 Thread Terry Reedy
On 1/13/2014 9:47 AM, Neal Becker wrote: py3 includes a fairly compelling feature: nonlocal keywork [keyword] But backward compatibility is lost. I am not sure what your particular point is. Every new feature, in any release, if used, makes code not compatible with earlier releases that do

Re: efficient way to process data

2014-01-13 Thread Petite Abeille
On Jan 13, 2014, at 7:42 PM, Mark Lawrence wrote: > I've not followed this thread closely but would this help > http://pandas.pydata.org/ ? When and if you get back to it, that is!!! I doubt it. The mean overhead by far would be to shuffle pointless data between the server & client. Best to

Re: Code review?

2014-01-13 Thread Steven D'Aprano
On Tue, 14 Jan 2014 03:40:25 +1100, Chris Angelico wrote: > Incidentally, is there a reason you're using Python 2.6? You should be > able to upgrade at least to 2.7, and Flask ought to work fine on 3.3 > (the current stable Python). If it's the beginning of your project, and > you have nothing bin

Re:plotting slows down

2014-01-13 Thread Steven D'Aprano
On Mon, 13 Jan 2014 08:26:11 -0500, Dave Angel wrote: > norman.elli...@gmail.com Wrote in message: >> [code] >> #!/usr/bin/python >> from graphics import * > > First things first. what operating system are you using, and > where did you get the mysterious graphics. py? Thanks for telling us >

Re: L[:]

2014-01-13 Thread Terry Reedy
On 1/13/2014 4:00 AM, Laszlo Nagy wrote: Unless L is aliased, this is silly code. There is another use case. If you intend to modify a list within a for loop that goes over the same list, then you need to iterate over a copy. And this cannot be called an "alias" because it has no name: for i

Re: efficient way to process data

2014-01-13 Thread Larry Martell
On Mon, Jan 13, 2014 at 1:32 PM, Chris Angelico wrote: > On Tue, Jan 14, 2014 at 5:27 AM, Larry Martell > wrote: >> Thanks. Unfortunately this has been made a low priority task and I've >> been put on to something else (I hate when they do that). > > Ugh, I know that feeling all too well! Right

Re: Tkinter GUI Error

2014-01-13 Thread Peter Otten
fluttershy...@gmail.com wrote: > Inside the function is where I am having the problem, I am trying to get > it to delete the label so that it may then replace it with a shorter text. > Here is the full code: > def check1(): > entry = entry1var.get() > if entry == num1: > labelent1

Re: Tkinter GUI Error

2014-01-13 Thread Lewis Wood
When I try to use the labelent1.configure, it greets me with an error: AttributeError: 'NoneType' object has no attribute 'configure' I changed the labelent's to global. Don't suppose you know why? Also how would I go about using an object for the entire window. I am still a Novice at Tkinter and

Re: Tkinter GUI Error

2014-01-13 Thread Christian Gollwitzer
Am 13.01.14 19:49, schrieb fluttershy...@gmail.com: Inside the function is where I am having the problem, I am trying to get it to delete the label so that it may then replace it with a shorter text. Here is the full code: from tkinter import * import random main = Tk() main.title("Crack th

Re: Tkinter GUI Error

2014-01-13 Thread Lewis Wood
Forgot to mention I am using Python 3.3.3 -- https://mail.python.org/mailman/listinfo/python-list

Tkinter GUI Error

2014-01-13 Thread fluttershy363
Inside the function is where I am having the problem, I am trying to get it to delete the label so that it may then replace it with a shorter text. Here is the full code: from tkinter import * import random main = Tk() main.title("Crack the Code") def check1(): entry = entry1var.get()

Re: Problem writing some strings (UnicodeEncodeError)

2014-01-13 Thread Paulo da Silva
Em 13-01-2014 17:29, Peter Otten escreveu: > Paulo da Silva wrote: > >> Em 13-01-2014 08:58, Peter Otten escreveu: > > I looked around in the stdlib and found shlex.quote(). It uses ' instead of > " which simplifies things, and special-cases only ': > print(shlex.quote("alpha'beta")) > 'a

Re: 'Straße' ('Strasse') and Python 2

2014-01-13 Thread Thomas Rachel
Am 13.01.2014 10:54 schrieb wxjmfa...@gmail.com: Not at all. I'm afraid I'm understanding Python (on this aspect very well). IBTD. Do you belong to this group of people who are naively writing wrong Python code (usually not properly working) during more than a decade? Why should I be? 'ß

Re: efficient way to process data

2014-01-13 Thread Mark Lawrence
On 13/01/2014 18:27, Larry Martell wrote: On Mon, Jan 13, 2014 at 1:09 AM, Chris Angelico wrote: On Mon, Jan 13, 2014 at 2:35 PM, Larry Martell wrote: Thanks for the reply. I'm going to take a stab at removing the group by and doing it all in python. It doesn't look too hard, but I don't know

Re: efficient way to process data

2014-01-13 Thread Mark Lawrence
On 13/01/2014 18:32, Chris Angelico wrote: On Tue, Jan 14, 2014 at 5:27 AM, Larry Martell wrote: Thanks. Unfortunately this has been made a low priority task and I've been put on to something else (I hate when they do that). Ugh, I know that feeling all too well! Life's better when you're une

Re: plotting slows down

2014-01-13 Thread Norman Elliott
On Monday, 13 January 2014 18:05:52 UTC, Dave Angel wrote: > Chris Angelico Wrote in message: > Well Ian's suggestion has really done the job. Now each iteration takes just 0.14 seconds now. changed to: [code] win = GraphWin("My Circle", xpos, ypos, autoflush=False) [/code] and added [code]

Re: efficient way to process data

2014-01-13 Thread Chris Angelico
On Tue, Jan 14, 2014 at 5:27 AM, Larry Martell wrote: > Thanks. Unfortunately this has been made a low priority task and I've > been put on to something else (I hate when they do that). Ugh, I know that feeling all too well! Life's better when you're unemployed, and you can choose the interesting

Re: efficient way to process data

2014-01-13 Thread Larry Martell
On Mon, Jan 13, 2014 at 1:09 AM, Chris Angelico wrote: > On Mon, Jan 13, 2014 at 2:35 PM, Larry Martell > wrote: >> Thanks for the reply. I'm going to take a stab at removing the group >> by and doing it all in python. It doesn't look too hard, but I don't >> know how it will perform. > > Well,

Re: plotting slows down

2014-01-13 Thread Ian Kelly
On Mon, Jan 13, 2014 at 1:15 AM, wrote: > First let me say I have not done much python programming! > I am running Python 2.7.3. > I am trying to use python as a front end to a simple oscilloscope. > Ultimately I intend to use it with my micropython board. > > At the moment I am just developing i

Re: plotting slows down

2014-01-13 Thread Dave Angel
Chris Angelico Wrote in message: > On Tue, Jan 14, 2014 at 4:39 AM, Ian Kelly wrote: >> On Mon, Jan 13, 2014 at 6:26 AM, Dave Angel wrote: >>> Next, please repost any source code with indentation preserved. >>> Your message shows it all flushed to the left margin, probably >>> due to posting

Re: plotting slows down

2014-01-13 Thread Chris Angelico
On Tue, Jan 14, 2014 at 4:39 AM, Ian Kelly wrote: > On Mon, Jan 13, 2014 at 6:26 AM, Dave Angel wrote: >> Next, please repost any source code with indentation preserved. >> Your message shows it all flushed to the left margin, probably >> due to posting in html mode. Use text mode here. > > Th

Re: plotting slows down

2014-01-13 Thread Ian Kelly
On Mon, Jan 13, 2014 at 6:26 AM, Dave Angel wrote: > Next, please repost any source code with indentation preserved. > Your message shows it all flushed to the left margin, probably > due to posting in html mode. Use text mode here. That's odd, the message that I got includes proper indentatio

Re: Problem writing some strings (UnicodeEncodeError)

2014-01-13 Thread Peter Otten
Paulo da Silva wrote: > Em 13-01-2014 08:58, Peter Otten escreveu: >> Peter Otten wrote: >> >>> Paulo da Silva wrote: >>> Em 12-01-2014 20:29, Peter Otten escreveu: > Paulo da Silva wrote: > >>> but I have not tried it myself. Also, some bytes may need to be >>> escaped, eith

Re: 'Straße' ('Strasse') and Python 2

2014-01-13 Thread Mark Lawrence
On 13/01/2014 16:24, wxjmfa...@gmail.com wrote: You are right. It's on Windows. It is only showing how Python can be a holy mess. Regarding unicode Python 2 was a holy mess, fixed in Python 3. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our la

Re: How to get Mac address of ethernet port?

2014-01-13 Thread Chris Angelico
On Tue, Jan 14, 2014 at 2:42 AM, William Ray Wing wrote: > The one I've used is to spawn a subprocess and run the "ifconfig" command > with no arguments (which doesn't require any special privileges). Very small caveat: On some systems, running ifconfig doesn't require privileges, but it's not i

Re: How to get Mac address of ethernet port?

2014-01-13 Thread William Ray Wing
On Jan 11, 2014, at 11:34 AM, Michael Torrie wrote: > On 01/11/2014 07:35 AM, Andriy Kornatskyy wrote: >> Sam, >> >> How about this? >> >> from uuid import getnode as get_mac >> '%012x' % get_mac() > > This seems to work if you have only one ethernet adapter. Most > computers have two (wired

Re: Code review?

2014-01-13 Thread Chris Angelico
On Tue, Jan 14, 2014 at 3:29 AM, Adam wrote: > Hey all. New to the list. I’m working on a web app with 2.6 and Flask. I’m > still relatively new to python. Is there a chance to get a code review from > anyone? I really want someone to just tear up my code and tell me how to > increase my e

Code review?

2014-01-13 Thread Adam
Hey all. New to the list. I’m working on a web app with 2.6 and Flask. I’m still relatively new to python. Is there a chance to get a code review from anyone? I really want someone to just tear up my code and tell me how to increase my efficiency and what I’m doing wrong (and how to upload

Re: 'Straße' ('Strasse') and Python 2

2014-01-13 Thread wxjmfauth
Le lundi 13 janvier 2014 11:57:28 UTC+1, Chris Angelico a écrit : > On Mon, Jan 13, 2014 at 9:38 PM, Steven D'Aprano > > wrote: > > > I think you are using "from __future__ import unicode_literals". > > > Otherwise, that cannot happen in Python 2.x. > > > > > > > Alas, not true. > > > >

Re: Problem writing some strings (UnicodeEncodeError)

2014-01-13 Thread Paulo da Silva
Em 13-01-2014 08:58, Peter Otten escreveu: > Peter Otten wrote: > >> Paulo da Silva wrote: >> >>> Em 12-01-2014 20:29, Peter Otten escreveu: Paulo da Silva wrote: >> but I have not tried it myself. Also, some bytes may need to be >> escaped, either to be understood by the shell,

Re: 'Straße' ('Strasse') and Python 2

2014-01-13 Thread Michael Torrie
On 01/13/2014 02:54 AM, wxjmfa...@gmail.com wrote: > Not at all. I'm afraid I'm understanding Python (on this > aspect very well). Are you sure about that? Seems to me you're still confused as to the difference between unicode and encodings. > > Do you belong to this group of people who are nai

Re: proposal: bring nonlocal to py2.x

2014-01-13 Thread Chris Angelico
On Tue, Jan 14, 2014 at 2:24 AM, Mark Lawrence wrote: > But it could theoretically happen if Neal wants it so badly that he raises > an issue on the bug tracker against Python 2.7, finds all the relevant > source code in Python 3, back ports it, modifies all the relevant docs and > unit tests, the

Re: proposal: bring nonlocal to py2.x

2014-01-13 Thread Mark Lawrence
On 13/01/2014 15:28, Chris Angelico wrote: On Tue, Jan 14, 2014 at 2:24 AM, Mark Lawrence wrote: But it could theoretically happen if Neal wants it so badly that he raises an issue on the bug tracker against Python 2.7, finds all the relevant source code in Python 3, back ports it, modifies all

Re: proposal: bring nonlocal to py2.x

2014-01-13 Thread Mark Lawrence
On 13/01/2014 15:12, Giampaolo Rodola' wrote: On Mon, Jan 13, 2014 at 3:47 PM, Neal Becker mailto:ndbeck...@gmail.com>> wrote: py3 includes a fairly compelling feature: nonlocal keywork But backward compatibility is lost. It would be very helpful if this was available on py2.x. It

Re: proposal: bring nonlocal to py2.x

2014-01-13 Thread Chris Angelico
On Tue, Jan 14, 2014 at 1:47 AM, Neal Becker wrote: > py3 includes a fairly compelling feature: nonlocal keywork > But backward compatibility is lost. It would be very helpful > if this was available on py2.x. Python 2.x is no longer being developed. It won't be gaining features like this. Use t

Re: proposal: bring nonlocal to py2.x

2014-01-13 Thread Giampaolo Rodola'
On Mon, Jan 13, 2014 at 3:47 PM, Neal Becker wrote: > py3 includes a fairly compelling feature: nonlocal keywork > But backward compatibility is lost. It would be very helpful > if this was available on py2.x. > > -- > https://mail.python.org/mailman/listinfo/python-list > It's not gonna happe

proposal: bring nonlocal to py2.x

2014-01-13 Thread Neal Becker
py3 includes a fairly compelling feature: nonlocal keywork But backward compatibility is lost. It would be very helpful if this was available on py2.x. -- https://mail.python.org/mailman/listinfo/python-list

Re: plotting slows down

2014-01-13 Thread Norman Elliott
I am running ubuntu 12.04 with all updates installed. I got the graphics here: http://mcsp.wartburg.edu/zelle/python/graphics/graphics/index.html I cannot see how to change from html to text mode in chromium or within the group. I read the link about double spacing so I will watch out for it. -

Re: plotting slows down

2014-01-13 Thread Norman Elliott
On Monday, 13 January 2014 08:15:08 UTC, Norman Elliott wrote: > First let me say I have not done much python programming! > > I am running Python 2.7.3. > > I am trying to use python as a front end to a simple oscilloscope. > > Ultimately I intend to use it with my micropython board. > > >

Re:plotting slows down

2014-01-13 Thread Dave Angel
norman.elli...@gmail.com Wrote in message: > First let me say I have not done much python programming! > I am running Python 2.7.3. > I am trying to use python as a front end to a simple oscilloscope. > Ultimately I intend to use it with my micropython board. > > At the moment I am just developin

Re: 'Straße' ('Strasse') and Python 2

2014-01-13 Thread Chris Angelico
On Mon, Jan 13, 2014 at 9:38 PM, Steven D'Aprano wrote: > I think you are using "from __future__ import unicode_literals". > Otherwise, that cannot happen in Python 2.x. > Alas, not true. >>> sys.version '2.7.4 (default, Apr 6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)]' >>> sys.maxunicode 6553

Re: 'Straße' ('Strasse') and Python 2

2014-01-13 Thread Steven D'Aprano
On Mon, 13 Jan 2014 01:54:21 -0800, wxjmfauth wrote: sys.version > '2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]' assert 'Straße'[4] == 'ß' assert u'Straße'[4] == u'ß' I think you are using "from __future__ import unicode_literals". Otherwise, that cannot hap

Re: 'Straße' ('Strasse') and Python 2

2014-01-13 Thread Chris Angelico
On Mon, Jan 13, 2014 at 8:54 PM, wrote: > This assertions are correct (byte string and unicode). > sys.version > '2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]' assert 'Straße'[4] == 'ß' assert u'Straße'[4] == u'ß' > > jmf > > PS Nothing to do with Py2/Py3

Re: Module depositary

2014-01-13 Thread Chris Angelico
On Mon, Jan 13, 2014 at 9:05 PM, Sean Murphy wrote: > Hi All. > > I am aware that active state python has a commercial module depositary which > you can get modules from. Under PERL you had CPAN. Is there anything like > this for Python? Check out the Python Package Index: https://pypi.python.

Module depositary

2014-01-13 Thread Sean Murphy
Hi All. I am aware that active state python has a commercial module depositary which you can get modules from. Under PERL you had CPAN. Is there anything like this for Python? Sean -- https://mail.python.org/mailman/listinfo/python-list

Re: 'Straße' ('Strasse') and Python 2

2014-01-13 Thread wxjmfauth
Le lundi 13 janvier 2014 09:27:46 UTC+1, Thomas Rachel a écrit : > Am 12.01.2014 08:50 schrieb wxjmfa...@gmail.com: > > sys.version > > > 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] > > s = 'Stra�e' > > assert len(s) == 6 > > assert s[5] == 'e' > >

Re: L[:]

2014-01-13 Thread Laszlo Nagy
Unless L is aliased, this is silly code. There is another use case. If you intend to modify a list within a for loop that goes over the same list, then you need to iterate over a copy. And this cannot be called an "alias" because it has no name: for idx,item in enumerate(L[:]): # do somet

Re: Problem writing some strings (UnicodeEncodeError)

2014-01-13 Thread Peter Otten
Peter Otten wrote: > Paulo da Silva wrote: > >> Em 12-01-2014 20:29, Peter Otten escreveu: >>> Paulo da Silva wrote: >>> > but I have not tried it myself. Also, some bytes may need to be > escaped, either to be understood by the shell, or to address security > concerns: > >>

Re: Problem writing some strings (UnicodeEncodeError)

2014-01-13 Thread Peter Otten
Paulo da Silva wrote: > Em 12-01-2014 20:29, Peter Otten escreveu: >> Paulo da Silva wrote: >> but I have not tried it myself. Also, some bytes may need to be escaped, either to be understood by the shell, or to address security concerns: >>> >>> Since I am puting the file nam

Re: 'Straße' ('Strasse') and Python 2

2014-01-13 Thread Thomas Rachel
Am 12.01.2014 08:50 schrieb wxjmfa...@gmail.com: sys.version 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] s = 'Straße' assert len(s) == 6 assert s[5] == 'e' Wow. You just found one of the major differences between Python 2 and 3. Your assertins are just wrong, as s = '

plotting slows down

2014-01-13 Thread norman . elliott
First let me say I have not done much python programming! I am running Python 2.7.3. I am trying to use python as a front end to a simple oscilloscope. Ultimately I intend to use it with my micropython board. At the moment I am just developing it. All it does is use a module I found called graphi