Re: [Tutor] monkey patching question

2015-02-17 Thread Dave Angel
On 02/17/2015 04:53 PM, Albert-Jan Roskam wrote: Hi, I would like to monkey patch a function 'decode' that is defined inside a class. It is defined there because it is a logical place, next to its counterpart *method* 'encode'. I can successfully monkey patch meth1, but when I call meth2, it

Re: [Tutor] monkey patching question

2015-02-17 Thread Danny Yoo
Apologies, but the answer might be unsatisfactory. The syntactic use of decorators is confusing the situation. Let's simplify. Your question is equivalent to the following scenario: def logged(g): def wrapped(x): print call return g(x)

[Tutor] OT: Preferred email client for sending plain text programming code snippets

2015-02-17 Thread boB Stepp
Hopefully this is not a touchy subject like Emacs vs. Vim. ~(:)) My home PC uses Win7-64bit. I currently use Chrome, Gmail and have a Nexus 5 phone. The nice thing about all of this is that all of my information usually seamlessly syncs. That is nice! But I am getting increasingly frustrated with

[Tutor] Python Question: Excluding certain keywords.

2015-02-17 Thread Arnold Chung
Dear Python Tutor. First of all, thank you for your kindness in advance. I am learning python by myself and having some difficulties in a problem that I encounter. Here I attach my python file. What I am trying to do is: 1) get the data by opening the data source, which is ‘apple.son' 2)

Re: [Tutor] Python Question: Excluding certain keywords.

2015-02-17 Thread Steven D'Aprano
Hi Arnold, and welcome. On Tue, Feb 17, 2015 at 02:30:34PM -0600, Arnold Chung wrote: Dear Python Tutor. First of all, thank you for your kindness in advance. I am learning python by myself and having some difficulties in a problem that I encounter. Here I attach my python file. [...]

Re: [Tutor] Old popen turned in subprocess...[SOLVED]

2015-02-17 Thread Alan Gauld
On 18/02/15 00:23, Ken G. wrote: I wish to thanks Danny Yoo and Alan Gauld for providing information on using the new subprocess in printing on paper, Glad to help. I got my desired output printed. Not looking forward to updating my old programs. If it's a common function in your code why

[Tutor] Old popen turned in subprocess...[SOLVED]

2015-02-17 Thread Ken G.
I wish to thanks Danny Yoo and Alan Gauld for providing information on using the new subprocess in printing on paper, replacing my old popen which was deprecated since Python 2.6. After some trial and errors, I got my desired output printed. Not looking forward to updating my old programs.

Re: [Tutor] OT: Preferred email client for sending plain text programming code snippets

2015-02-17 Thread Mark Lawrence
On 17/02/2015 23:23, boB Stepp wrote: Hopefully this is not a touchy subject like Emacs vs. Vim. ~(:)) My home PC uses Win7-64bit. I currently use Chrome, Gmail and have a Nexus 5 phone. The nice thing about all of this is that all of my information usually seamlessly syncs. That is nice! But I

Re: [Tutor] OT: Preferred email client for sending plain text programming code snippets

2015-02-17 Thread Alan Gauld
On 17/02/15 23:23, boB Stepp wrote: So are there any recommendations from this group that would make things easy, would still be able to receive/send from my Gmail account, etc.? Thunderbird seems to work for me. I use it for 4 different email accounts (including both yahoo and gmail) as

Re: [Tutor] Python Question: Excluding certain keywords.

2015-02-17 Thread Dave Angel
On 02/17/2015 03:30 PM, Arnold Chung wrote: Dear Python Tutor. Welcome to the tutor list. As far as I can tell, this is your first post. And thank you for using text mail, rather than html. First of all, thank you for your kindness in advance. I am learning python by myself and having

[Tutor] text file help

2015-02-17 Thread Tihomir Zjajic
How can I get this ; kl_number = 1202, kl_number = 1403, kl_number = 1802, kl_number = 2801, kl_number = 2502, kl_number = 2303, kl_number = 2254, kl_number = 1682, kl_number = 1403 kl_number = 1304, from text file(formular doznake) . I got this on this way ; def vrs_drv(): vrs_drv =

Re: [Tutor] What are *appropriate* uses for exec() and eval() ?

2015-02-17 Thread Devin Jeanpierre
On Tue, Feb 17, 2015 at 7:31 AM, Steven D'Aprano st...@pearwood.info wrote: On Mon, Feb 16, 2015 at 07:10:21PM -0800, Devin Jeanpierre wrote: On Mon, Feb 16, 2015 at 6:15 PM, Steven D'Aprano st...@pearwood.info wrote: Here is a fork of that recipe. It uses an inner class for the new

Re: [Tutor] OT: Preferred email client for sending plain text programming code snippets

2015-02-17 Thread Ben Finney
boB Stepp robertvst...@gmail.com writes: Hopefully this is not a touchy subject like Emacs vs. Vim. ~(:)) Heh. If anyone tries to start a Vim-versus-Emacs fight, feel free to cite me as someone well experienced with both who sees no need to be tribal about either of them. My home PC uses

[Tutor] Fwd: Re: Fwd: Need help with find error

2015-02-17 Thread Danny Yoo
I do not have time to help you right now. Please continue correspondence with the main tutor mailing list. -- Forwarded message -- From: Андрей Пугачев pugachov.and...@gmail.com Date: Feb 17, 2015 9:20 PM Subject: Re: [Tutor] Fwd: Need help with find error To: Danny Yoo

Re: [Tutor] What are *appropriate* uses for exec() and eval() ?

2015-02-17 Thread Steven D'Aprano
On Mon, Feb 16, 2015 at 07:10:21PM -0800, Devin Jeanpierre wrote: On Mon, Feb 16, 2015 at 6:15 PM, Steven D'Aprano st...@pearwood.info wrote: Here is a fork of that recipe. It uses an inner class for the new namedtuple class. The only thing which needs exec is the __new__ method.

[Tutor] Fwd: Need help with find error

2015-02-17 Thread Danny Yoo
This was mailed just to me by accident. Forwarding to tutor. Apologies for not forwarding this ten days ago: I missed it. -- Forwarded message -- From: Андрей Пугачев pugachov.and...@gmail.com Date: Sat, Feb 7, 2015 at 12:27 AM Subject: Re: [Tutor] Need help with find error To:

[Tutor] Potential problem with Game Over 2.0 problem in Python Programming for the Absolute Beginner, 3rd Ed.

2015-02-17 Thread boB Stepp
I know that there have been multiple posts in the past about Michael Dawson's book, Python Programming for the Absolute Beginner, 3rd ed.. Because of this I thought I might mention something my son encountered this morning. I have finally gotten my son to start working in this book. He came to me

Re: [Tutor] Potential problem with Game Over 2.0 problem in Python Programming for the Absolute Beginner, 3rd Ed.

2015-02-17 Thread boB Stepp
On Tue, Feb 17, 2015 at 12:43 PM, Danny Yoo d...@hashcollision.org wrote: [...] Ah ha. Escape characters. I see what you mean. :P Just to add: there is a raw string literal syntax that will turn off escape sequence handling. Using a raw string literal may make it easier to type the

Re: [Tutor] mySQL and Python

2015-02-17 Thread Danny Yoo
On Tue, Feb 17, 2015 at 5:49 AM, Beatrice Perez b.perezm...@gmail.com wrote: I have only ever used php with mySQL so I need some help. What would be the best library/extension to get? If I use mySQLdb or PyMySQL would I need the connector as well? Unfortunately, I don't know. Since this is

[Tutor] mySQL and Python

2015-02-17 Thread Beatrice Perez
Hi, I am looking for tools to use mySQL and python. I saw in a question posted in Stack Overflow ( http://stackoverflow.com/questions/23376103/python-3-4-0-with-mysql-database) that mySQLdb is not compatible with python 3 but the post was 9 months ago. I haven't been able to find updated

Re: [Tutor] Potential problem with Game Over 2.0 problem in Python Programming for the Absolute Beginner, 3rd Ed.

2015-02-17 Thread Dave Angel
On 02/17/2015 02:12 PM, boB Stepp wrote: See https://docs.python.org/3.4/reference/lexical_analysis.html#string-and-bytes-literals At this point in the text he is not talking about raw literal strings. I examined the author's source and he has obviously inserted at least one space between

Re: [Tutor] Potential problem with Game Over 2.0 problem in Python Programming for the Absolute Beginner, 3rd Ed.

2015-02-17 Thread Danny Yoo
Dawson) Game Over 2.0 program in chapter two on page 17. The object of this program is to do ASCII-style art to generate a large rendition of Game Over using the following characters: _ , \ , | , and / . When my son tried to do his version, the Over portion did not print correctly. Hi boB,

Re: [Tutor] Potential problem with Game Over 2.0 problem in Python Programming for the Absolute Beginner, 3rd Ed.

2015-02-17 Thread boB Stepp
On Tue, Feb 17, 2015 at 1:47 PM, Dave Angel da...@davea.name wrote: On 02/17/2015 02:12 PM, boB Stepp wrote: See https://docs.python.org/3.4/reference/lexical_analysis.html#string-and-bytes-literals At this point in the text he is not talking about raw literal strings. I examined the

Re: [Tutor] Potential problem with Game Over 2.0 problem in Python Programming for the Absolute Beginner, 3rd Ed.

2015-02-17 Thread boB Stepp
On Tue, Feb 17, 2015 at 3:34 PM, Joel Goldstick joel.goldst...@gmail.com wrote: On Tue, Feb 17, 2015 at 4:05 PM, boB Stepp robertvst...@gmail.com wrote: On Tue, Feb 17, 2015 at 1:47 PM, Dave Angel da...@davea.name wrote: On 02/17/2015 02:12 PM, boB Stepp wrote: This seems to be the case. On a

Re: [Tutor] Potential problem with Game Over 2.0 problem in Python Programming for the Absolute Beginner, 3rd Ed.

2015-02-17 Thread boB Stepp
On Tue, Feb 17, 2015 at 3:05 PM, boB Stepp robertvst...@gmail.com wrote: This seems to be the case. On a related note, I wanted to copy and paste the author's source code, showing how he generated the large, Game Over, but my Gmail keeps collapsing the white space, making the result look like

[Tutor] Fwd: Need help with find error

2015-02-17 Thread Danny Yoo
Forwarding to tutor. Again, apologies that I didn't respond earlier. Overloaded. -- Forwarded message -- From: Андрей Пугачев pugachov.and...@gmail.com Date: Tue, Feb 17, 2015 at 11:58 AM Subject: Re: [Tutor] Need help with find error To: Danny Yoo d...@hashcollision.org

Re: [Tutor] Potential problem with Game Over 2.0 problem in Python Programming for the Absolute Beginner, 3rd Ed.

2015-02-17 Thread Joel Goldstick
On Tue, Feb 17, 2015 at 4:05 PM, boB Stepp robertvst...@gmail.com wrote: On Tue, Feb 17, 2015 at 1:47 PM, Dave Angel da...@davea.name wrote: On 02/17/2015 02:12 PM, boB Stepp wrote: See https://docs.python.org/3.4/reference/lexical_analysis.html#string-and-bytes-literals At this point in

[Tutor] monkey patching question

2015-02-17 Thread Albert-Jan Roskam
Hi, I would like to monkey patch a function 'decode' that is defined inside a class. It is defined there because it is a logical place, next to its counterpart *method* 'encode'. I can successfully monkey patch meth1, but when I call meth2, it does not use the patched decorator. How can this

[Tutor] Hey guys!

2015-02-17 Thread Levi Adissi
So I'm kind of stuck trying to program a function that returns a list of tuples. The function takes 2 lists containing circles of which it should compare list1[0] to list2[0] to see if they intersect. If they intersect or touch then I should return them on a list of tuples(in the tuple would be

Re: [Tutor] Hey guys!

2015-02-17 Thread Alan Gauld
On 17/02/15 04:22, Levi Adissi wrote: Hello. Thanks for your post. However could you please use a subject that rflects the content. Otherwise we wind up with an archive full of Hey Guys, Hello chaps, Gday mate, Bonjour etc Not very useful for searching. So I'm kind of stuck trying to

Re: [Tutor] Hey guys!

2015-02-17 Thread Dave Angel
On 02/16/2015 11:22 PM, Levi Adissi wrote: Thank you for using text email, rather than the html mail that so many newcomers use. So I'm kind of stuck trying to program a function that returns a list of tuples. The function takes 2 lists containing circles of which it should compare list1[0]