[Tutor] Naming conventions

2015-04-28 Thread Mitesh H. Budhabhatti
Hello Friends, Can you please suggest good naming conventions/guidelines to following while writing Python code? Thanks. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tuto

[Tutor] Trouble Downloading 3.2 tutorial

2015-04-28 Thread O'Shea, Connor
Greetings. I have been experiencing difficulty getting my computer to download the 3.2 python program. My computer has Windows 8 software. What do you suggest I do to address this problem? ___ Tutor maillist - Tutor@python.org To unsubscribe or change s

Re: [Tutor] Naming conventions

2015-04-28 Thread Mark Lawrence
On 28/04/2015 08:31, Mitesh H. Budhabhatti wrote: Hello Friends, Can you please suggest good naming conventions/guidelines to following while writing Python code? Thanks. PEP 8 - Style Guide for Python Code at https://www.python.org/dev/peps/pep-0008/ -- My fellow Pythonistas, ask not wha

Re: [Tutor] Trouble Downloading 3.2 tutorial

2015-04-28 Thread Alan Gauld
On 28/04/15 00:08, O'Shea, Connor wrote: Greetings. I have been experiencing difficulty getting my computer to download the 3.2 python program. My computer has Windows 8 software. What do you suggest I do to address this problem? You don't say what kind of "trouble" nor which distribution of P

Re: [Tutor] pip install M2crypto

2015-04-28 Thread Alan Gauld
On 28/04/15 03:14, Juanald Reagan wrote: Good Evening, I am trying to install the M2crypto package via pip and receive an error. Python version is 2.7.4, any ideas on how to fix the SWIG error? Do you have SWIG installed? It should be in your repo. unable to execute swig: No such fi

[Tutor] How to output dictionary data to CSV file

2015-04-28 Thread Paradox
I have some data structured like this: {'B002':'NRP 2014','B003':'HBB 2015'} Basically account numbers and project names, each account number has a project name. I represent it in a dictionary because that seemed the best way to keep the account numbers and project names together. I want to

Re: [Tutor] How to output dictionary data to CSV file

2015-04-28 Thread Paradox
How rude of me, I neglected to note I am using Python 3.4.3. On 04/28/2015 04:51 PM, Paradox wrote: I have some data structured like this: {'B002':'NRP 2014','B003':'HBB 2015'} Basically account numbers and project names, each account number has a project name. I represent it in a dictionary

Re: [Tutor] How to output dictionary data to CSV file

2015-04-28 Thread Peter Otten
Paradox wrote: > I have some data structured like this: > > {'B002':'NRP 2014','B003':'HBB 2015'} > > Basically account numbers and project names, each account number has a > project name. I represent it in a dictionary because that seemed the > best way to keep the account numbers and project

Re: [Tutor] How to output dictionary data to CSV file :p:

2015-04-28 Thread Thomas C. Hicks
On 04/28/2015 05:30 PM, Peter Otten wrote: >>>data = {'B002':'NRP 2014','B003':'HBB 2015'} >>>writer = csv.writer(sys.stdout) >>>writer.writerows(data.items()) B002,NRP 2014 B003,HBB 2015 That is exactly what I was looking for! Thanks, apparently my knowledge deficit is in understanding dict

Re: [Tutor] How to output dictionary data to CSV file

2015-04-28 Thread Alan Gauld
On 28/04/15 09:51, Paradox wrote: to save that information to a file, CSV seemed the easiest format You could consider JSON too. JSON looks a lot like a Python dictionary of strings so is almost a perfect match to your data. The json module is in the standard library. -- Alan G Author of the

[Tutor] Pythonic review (descriptors)

2015-04-28 Thread Sage Hack
I'm looking for somebody willing to review parts of this code https://github.com/SageHack/cloud-buster and let me know what is not Pythonic :P I want to improve my Python coding skills but I'm not sure exactly what to study next. Right now I'm trying to use descriptors correctly and I'd like to k

Re: [Tutor] Pythonic review (descriptors)

2015-04-28 Thread Alan Gauld
On 28/04/15 10:55, Sage Hack wrote: I'm looking for somebody willing to review parts of this code https://github.com/SageHack/cloud-buster and let me know what is not Pythonic :P > https://github.com/SageHack/cloud-buster/tree/master/bust/descriptor The thing that jumps out to me is your use o

Re: [Tutor] Pythonic review (descriptors)

2015-04-28 Thread Alan Gauld
On 28/04/15 10:55, Sage Hack wrote: I'm looking for somebody willing to review parts of this code https://github.com/SageHack/cloud-buster and let me know what is not Pythonic :P https://github.com/SageHack/cloud-buster/tree/master/bust/descriptor Another point re the PageTitle class: class

Re: [Tutor] Naming conventions

2015-04-28 Thread Steven D'Aprano
On Tue, Apr 28, 2015 at 01:01:04PM +0530, Mitesh H. Budhabhatti wrote: > Hello Friends, > > Can you please suggest good naming conventions/guidelines to following > while writing Python code? Thanks. Most important rule of all: names should be descriptive and understandable, not too short or cr

[Tutor] Fwd: circular movement in pygame

2015-04-28 Thread diliup gabadamudalige
-- Forwarded message -- From: diliup gabadamudalige Date: Tue, Apr 28, 2015 at 6:22 PM Subject: circular movement in pygame To: pygame-us...@seul.org Looking at the code on this page lines 47 & 48 http://programarcadegames.com/python_examples/show_file.php?file=sprite_circle_mov

Re: [Tutor] Fwd: circular movement in pygame

2015-04-28 Thread Alan Gauld
On 28/04/15 16:38, diliup gabadamudalige wrote: -- Forwarded message -- From: diliup gabadamudalige Date: Tue, Apr 28, 2015 at 6:22 PM Subject: circular movement in pygame To: pygame-us...@seul.org It's good that you tried the python-game list for a pygame question. But if pyga

Re: [Tutor] Fwd: circular movement in pygame

2015-04-28 Thread Oscar Benjamin
On 28 April 2015 at 16:38, diliup gabadamudalige wrote: > > Looking at the code on this page lines 47 & 48 > > http://programarcadegames.com/python_examples/show_file.php?file=sprite_circle_movement.py > > is there a way to do > self.rect.x +*= some value* > self.rect.y += some value > > rather th

Re: [Tutor] Fwd: circular movement in pygame

2015-04-28 Thread Oscar Benjamin
On 28 April 2015 at 19:37, diliup gabadamudalige wrote: > > I thank all those who responded to my question > > Here is the code that I had written. > > When updating is applied to a surface object the rotation works but when it > is applied through a class to an object it goes wrong in about 3 rot

Re: [Tutor] Fwd: circular movement in pygame

2015-04-28 Thread diliup gabadamudalige
I thank all those who responded to my question Here is the code that I had written. When updating is applied to a surface object the rotation works but when it is applied through a class to an object it goes wrong in about 3 rotations. As far as I can see the code is the same. What is wrong? If y

Re: [Tutor] How to output dictionary data to CSV file :p:

2015-04-28 Thread Thomas C. Hicks
On 04/28/2015 09:43 PM, Alan Gauld wrote: You could consider JSON too. JSON looks a lot like a Python dictionary of strings so is almost a perfect match to your data. Sounds great, I'll check it out. Thanks! thomas == Thomas C. Hicks, MD, MPH Training Manager, Gan

Re: [Tutor] Fwd: circular movement in pygame

2015-04-28 Thread Dave Angel
On 04/28/2015 02:37 PM, diliup gabadamudalige wrote: I thank all those who responded to my question Here is the code that I had written. When updating is applied to a surface object the rotation works but when it is applied through a class to an object it goes wrong in about 3 rotations. As far

[Tutor] Good Taste Question: Using SQLite3 in Python

2015-04-28 Thread Jugurtha Hadjar
Hello, all.. I have a class with methods that access a database (SQLite3). I have included an excerpt showin reading and writing and would like to know if I'm doing it right. (i.e: Is it bad code and what to improve). Here are some improvements and my rationale (check my thinking): - Initial

[Tutor] Function works one time then subsequently fails

2015-04-28 Thread Jim Mooney Py3winXP
This is really puzzling me. I'm parsing a string to do some simple math operations and practice tossing functions around. My parser works on the first run, then it continually fails on the same input. """ Takes the name of a binary math operation and two numbers from input, repeatedly, and display

Re: [Tutor] Function works one time then subsequently fails

2015-04-28 Thread Cameron Simpson
On 28Apr2015 20:58, Jim Mooney Py3winXP wrote: This is really puzzling me. I'm parsing a string to do some simple math operations and practice tossing functions around. My parser works on the first run, then it continually fails on the same input. [...] numbers = [] [...] def parse_string(m

Re: [Tutor] Function works one time then subsequently fails

2015-04-28 Thread Jim Mooney Py3winXP
On 28 April 2015 at 21:27, Cameron Simpson wrote: > At a first glance numbers is a global. It is reset to [] at program start, > but never again. So you're appending to it forever. I have not investigated > further as to how that affects your program's flow. > > Cheers, > Cameron Simpson > Took

Re: [Tutor] Naming conventions

2015-04-28 Thread Mitesh H. Budhabhatti
Thank you so much Mark, Steven. This will definitely help. I really appreciate. On Tue, Apr 28, 2015 at 8:45 PM, Steven D'Aprano wrote: > On Tue, Apr 28, 2015 at 01:01:04PM +0530, Mitesh H. Budhabhatti wrote: > > Hello Friends, > > > > Can you please suggest good naming conventions/guidelines

Re: [Tutor] Function works one time then subsequently fails

2015-04-28 Thread Cameron Simpson
On 28Apr2015 22:27, Jim Mooney Py3winXP wrote: On 28 April 2015 at 21:27, Cameron Simpson wrote: At a first glance numbers is a global. It is reset to [] at program start, but never again. So you're appending to it forever. I have not investigated further as to how that affects your program's