[Tutor] I want to share a source that i wrote

2016-01-15 Thread Ricardo Martínez
Hi guys, i wrote a simply MySQL interpretar with Python / Tk and I want to ask if can I share with the people in the list to discuss about the code and maybe help to the community. The source code has 200 lines and is written in a single file. P.D. please, Alan Gauld be kind with my mistakes abou

Re: [Tutor] I want to share a source that i wrote

2016-01-15 Thread Alan Gauld
On 15/01/16 01:11, Ricardo Martínez wrote: > Hi guys, i wrote a simply MySQL interpretar with Python / Tk and I want to > ask if can I share with the people in the list to discuss about the code > and maybe help to the community. > > The source code has 200 lines and is written in a single file.

[Tutor] Fwd: Re: creating a mspaint utility

2016-01-15 Thread Alan Gauld
forwarding to tutor list... please use ReplyAll when responding to the list. Forwarded Message Subject:Re: [Tutor] creating a mspaint utility Date: Fri, 15 Jan 2016 16:07:36 +1000 From: Whom Isac To: Alan Gauld Hi, Alan Gauld, in regards to the response I got

Re: [Tutor] Fwd: Re: creating a mspaint utility

2016-01-15 Thread Alan Gauld
On 15/01/16 08:34, Alan Gauld wrote: > maybe you can get the mouse positions and put them in order to draw a > line,etc. Yes, that's a valid approach to building a multi-segment line. Normally you store the points in a list somewhere. > I did not want to use global variable because I am not used

Re: [Tutor] Fwd: Re: creating a mspaint utility

2016-01-15 Thread wolfrage8...@gmail.com
Might I also recommend Kivy as the GUI. It has a nice tutorial that is actually on this subject. https://kivy.org/docs/tutorials/firstwidget.html ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.or

Re: [Tutor] Modularity

2016-01-15 Thread wolfrage8...@gmail.com
Modularity of code is difficult for sure and is kind of an art. To do it best you will have to read about and implement some of the Design Patterns. There are many but some of the ones that I have leaned towards over time are Composition over inheritance, Message Passing Interfaces, Mediator, and

[Tutor] str.strip strange result...?

2016-01-15 Thread Jignesh Sutar
#python2.7 >>> s="V01_1" >>> s.strip("_1") 'V0' Wouldn't you expect the result to be "V01" ? Cheers Jignesh ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] str.strip strange result...?

2016-01-15 Thread Peter Otten
Jignesh Sutar wrote: > #python2.7 > s="V01_1" s.strip("_1") > 'V0' > > > Wouldn't you expect the result to be "V01" ? str.strip() doesn't strip off a suffix or prefix; its first argument is interpreted as a character set, i. e. as long as s ends/starts with any of the characters "_

[Tutor] Message Passing & User Interfaces

2016-01-15 Thread wolfrage8...@gmail.com
I realize this is a higher level question; so please direct me as appropriate. I can not seem to find a good standard that is in practical use for controlling user interfaces via a message passing. Does any one have any links to such an example? I would be most grateful. Thank you.

[Tutor] Hard Drive wipe

2016-01-15 Thread Chad Perry
#The function for writing random data to the disk. def random(): print "" os.system("/sbin/fdisk -l") print "" print "Please choose a device to kill. Remember if you want to" print "wipe the whole drive and not just a partition, you can" print "remove the number appended.

[Tutor] Substitution function needed

2016-01-15 Thread Chad Perry
#The function for writing random data to the disk. def random(): print "" os.system("/sbin/fdisk -l") print "" print "Please choose a device to kill. Remember if you want to" print "wipe the whole drive and not just a partition, you can" print "remove the number appended. Exampl

[Tutor] Help!

2016-01-15 Thread Chelsea G
Hi, So what I am working on is taking a csv file and only taking 2 columns from the spreadsheet and out putting that to a text file. Then taking those two columns and organize them by product(key) and outputting the description(values) that are associated. Some products have a lot of duplicate desc

[Tutor] Help!

2016-01-15 Thread Chelsea G
Hi, So what I am working on is taking a csv file and only taking 2 columns from the spreadsheet and out putting that to a text file. Then taking those two columns and organize them by product(key) and outputting the description(values) that are associated. Some products have a lot of duplicate desc

Re: [Tutor] str.strip strange result...?

2016-01-15 Thread Mark Lawrence
On 15/01/2016 16:25, Jignesh Sutar wrote: #python2.7 s="V01_1" s.strip("_1") 'V0' Wouldn't you expect the result to be "V01" ? Cheers Jignesh No, never expect anything from a given programming language. What did you not understand about this https://docs.python.org/3/library/stdtypes.ht

Re: [Tutor] str.strip strange result...?

2016-01-15 Thread Jignesh Sutar
Gotcha and thank you for the reminder to read the documentation. Very clear, indeed. Many thanks! Cheers Jignesh On Fri, 15 Jan 2016 at 17:32, Mark Lawrence wrote: > On 15/01/2016 16:25, Jignesh Sutar wrote: > > #python2.7 > > > s="V01_1" > s.strip("_1") > > 'V0' > > > > Wouldn't you e

Re: [Tutor] Help!

2016-01-15 Thread Peter Otten
Chelsea G wrote: > What I am having issues with is the def txt_output that is where I am > trying to take the .csv off and add the .txt but keep the filename the > same. For example, having a filename "weekly_20160102.csv" and then create > a txt filename with "weekly_20160102.txt" and have all th

Re: [Tutor] Substitution function needed

2016-01-15 Thread Alan Gauld
On 15/01/16 17:07, Chad Perry wrote: > #The function for writing random data to the disk. > def random(): >os.system("/sbin/fdisk -l") >device=raw_input("Enter device: ") >count=input("How many times would you like to wipe the device? ") >raw_input("Press Enter to continue, or Ctrl

[Tutor] Is there a preference of "class MyClass:" or "class MyClass(object):" for Py3?

2016-01-15 Thread boB Stepp
Pythonic style/preference question: For strictly Python 3 code, is there any preference for class MyClass: pass versus the more explicit class MyClass(object): pass ? TIA! -- boB ___ Tutor maillist - Tutor@python.org To unsubscribe or ch

[Tutor] s.insert(i, x) explanation in docs for Python 3.4 confusing to me

2016-01-15 Thread boB Stepp
At https://docs.python.org/3.4/library/stdtypes.html#sequence-types-list-tuple-range it states: "s.insert(i, x) inserts x into s at the index given by i (same as s[i:i] = [x])" I find this confusing. First, at the interpreter, whenever I type in: >>> things [0, 'Hmm...', 3, 'WhackABunny', 6, '

Re: [Tutor] s.insert(i, x) explanation in docs for Python 3.4 confusing to me

2016-01-15 Thread Cameron Simpson
On 15Jan2016 22:20, boB Stepp wrote: At https://docs.python.org/3.4/library/stdtypes.html#sequence-types-list-tuple-range it states: "s.insert(i, x) inserts x into s at the index given by i (same as s[i:i] = [x])" I find this confusing. First, at the interpreter, whenever I type in: things

Re: [Tutor] s.insert(i, x) explanation in docs for Python 3.4 confusing to me

2016-01-15 Thread boB Stepp
On Fri, Jan 15, 2016 at 10:53 PM, Cameron Simpson wrote: > On 15Jan2016 22:20, boB Stepp wrote: >> I always get an empty list, which is actually what I was expecting, so >> I do not see how s[i:i] can ever equal [x]. > > > It isn't an equality test (==), it is an assignent. It is saying "set the

Re: [Tutor] s.insert(i, x) explanation in docs for Python 3.4 confusing to me

2016-01-15 Thread Cameron Simpson
On 15Jan2016 23:05, boB Stepp wrote: On Fri, Jan 15, 2016 at 10:53 PM, Cameron Simpson wrote: things.insert(-1, 'What the heck?!?') things [0, 'Hmm...', 3, 'WhackABunny', 6, 'What the heck?!?', '?'] "...at the index..." to me would mean that 'What the heck?!?' should become the last item in

Re: [Tutor] s.insert(i, x) explanation in docs for Python 3.4 confusing to me

2016-01-15 Thread boB Stepp
On Fri, Jan 15, 2016 at 11:32 PM, Cameron Simpson wrote: > On 15Jan2016 23:05, boB Stepp wrote: >> >> On Fri, Jan 15, 2016 at 10:53 PM, Cameron Simpson wrote: >>> >>> things.insert(-1, 'What the heck?!?') >>> things [0, 'Hmm...', 3, 'WhackABunny', 6, 'What the heck?!?'

Re: [Tutor] Is there a preference of "class MyClass:" or "class MyClass(object):" for Py3?

2016-01-15 Thread Steven D'Aprano
On Fri, Jan 15, 2016 at 09:30:57PM -0600, boB Stepp wrote: > Pythonic style/preference question: For strictly Python 3 code, is > there any preference for > > class MyClass: > pass > > versus the more explicit > > class MyClass(object): > pass > > ? For *purely* Python 3 code, where

Re: [Tutor] Is there a preference of "class MyClass:" or "class MyClass(object):" for Py3?

2016-01-15 Thread boB Stepp
On Fri, Jan 15, 2016 at 11:47 PM, Steven D'Aprano wrote: > > If there's any chance that the code might be used in Python 2, or copied > into a Python 2 module, or read by people expecting Python 2 semantics, > then you ought to be explicit about the base class. Hmm. I *try* to keep Python 3 at