Re: [Tutor] Name for this type of class?

2019-08-03 Thread Alex Kleider
On 2019-08-03 10:16, Mats Wichmann wrote: . It also comes up here: file_count line_count byte_count row_count batch_count job_count error_count warning_count why not "files", "lines", "bytes"... the plural form already tells you it's a counter. To me "files", "lines", "bytes" implies

Re: [Tutor] Name for this type of class?

2019-08-02 Thread Alex Kleider
On 2019-08-02 16:47, Malcolm Greene wrote: They same naming is one of the two biggest challenges when it comes to software. Or one of three if you count the "off-by-one" joke :) Anyways, I'm looking for help coming up for the proper name for a class that collects the following type of telemetry

Re: [Tutor] Follow-up on my removing elements from lists question.

2019-06-15 Thread Alex Kleider
On 2019-06-15 02:35, mhysnm1...@gmail.com wrote: This is a follow-up on my previous question for removing elements. Below is the code I am currently using. I am removing the elements at the end of the outer loop. The data structure goes along this: [ ['123123',[2019-2-18', 'transaction

Re: [Tutor] Setting Command Line Arguments in IDLE

2019-05-26 Thread Alex Kleider
On 2019-05-25 18:55, Richard Damon wrote: Is there any way to define the working directory for the program, or will it always be the directory the script is in (it will be typically run using the PATH, so not the same directory as the script)? import os cwd = os.getcwd() os.chdir(path)

Re: [Tutor] Looking for some direction

2019-05-16 Thread Alex Kleider
On 2019-05-16 03:35, Oscar Benjamin wrote: On Thu, 16 May 2019 at 04:30, Alex Kleider wrote: On 2019-05-12 00:59, Alan Gauld via Tutor wrote: > On 12/05/2019 00:24, David L Neil wrote: > > Alt-Tab and the X cut 'n paste mechanism provides > enough integration between windo

Re: [Tutor] Looking for some direction

2019-05-15 Thread Alex Kleider
On 2019-05-12 00:59, Alan Gauld via Tutor wrote: On 12/05/2019 00:24, David L Neil wrote: "3 consoles": what is the purpose of each? (my first reaction stemmed from many editors including a built-in console) One for vim, One for the Python interpreter One for an OS shell used for

[Tutor] changed to: gratitude to mentors

2019-04-27 Thread Alex Kleider
On 2019-04-26 17:22, David wrote: I've been reading here for years, and I take this opportunity to give my sincere thanks to everyone who shares their knowledge here. My experience and my sentiment as well. A hearty "hear, hear." ___ Tutor maillist

Re: [Tutor] Merge a dictionary into a string

2019-03-16 Thread Alex Kleider
On 2019-03-16 10:39, Valerio Pachera wrote: Consider this: import collections d = OrderedDict(a='hallo', b='world') I wish to get a single string like this: 'a "hallo" b "world"' Notice I wish the double quote to be part of the string. In other words I want to wrap the value of a and b. I

Re: [Tutor] Only appending one object to list, when I am expecting more than 1

2019-02-27 Thread Alex Kleider
On 2019-02-27 05:25, AdamC wrote: That's great - bug found. Thanks. However the next question is, how do I create an instance of a class with variable parameters (i.e. with dateAdded already computed and stored, or with dateAdded created for the first time)? Might this work? class

Re: [Tutor] Why does using "window.addchr()" to place a character at the lower right corner raise an exception?

2019-02-27 Thread Alex Kleider
On 2019-02-27 17:48, boB Stepp wrote: Under https://docs.python.org/3/library/curses.html#window-objects in the curses docs, it states: window.addch(ch[, attr]) window.addch(y, x, ch[, attr]) [...] Note Writing outside the window, subwindow, or pad raises a curses.error. Attempting to write

Re: [Tutor] import failure

2019-02-23 Thread Alex Kleider
On 2019-02-22 09:48, Mats Wichmann wrote: pip installs are specific to the interpreter, you're probably getting a mismatch there. Rule one: install this way: python -m pip install sheepdip that way you're sure the pip matches the python and things go in the expected place. Rule 2: you

[Tutor] import failure

2019-02-22 Thread Alex Kleider
e shows that it in fact can import the module in question. Ran the interpreter again just to be sure that the function is available and indeed it is. I don't understand how this could be possible. Any suggestions as to what the problem might be or how to investigate further would be very muc

Re: [Tutor] Help Please

2019-02-20 Thread Alex Kleider
On 2019-02-20 06:30, Mario Ontiveros wrote: Hello, I am new to python and have been stuck on this for a while. What I am trying to do is to remove rows with void, disconnected, and error on lines. The code I have does that, the only problem is that it removes my header because void is in

Re: [Tutor] Borrowing restricted code

2018-12-06 Thread Alex Kleider
On 2018-12-05 16:45, Steven D'Aprano wrote: On Wed, Dec 05, 2018 at 11:22:35AM -0500, Avi Gross wrote: Those following this thread might like to google "code V2"- the book by Laurence Lessig is relevant to many if not all of the disagreements. It's also a very interesting read (and free.)

[Tutor] books (for postage)

2018-10-27 Thread Alex Kleider
to send them on for what ever it costs to mail. I could mail from either the US (94924 area code) or from Canada (V9L 6T2)- which ever works out cheapest (which may depend on the destination although in general I believe costs are cheaper in the States.) -- Alex Kleider (sent from my current gizmo

Re: [Tutor] When are "__init__.py" files needed and not needed in a project?

2018-10-20 Thread Alex Kleider
On 2018-10-20 14:52, boB Stepp wrote: > In case it helps, my current project structure is: > > ~/Projects > data/ > docs/ > tests/ > .git/ > main.py > .gitignore I'm curious to know where under the above structure you keep your code files? (...or is all your code

[Tutor] python -m pip install vs pip install

2018-09-10 Thread Alex Kleider
Should I modify these notes? What should I do if/when I'm looking to use the next version (3.7 and beyond?) Will things be completely different if/when I finally decide to move up to Ubuntu 18.04? Thanks, Alex -- Alex Kleider (sent from my current gizmo) _

Re: [Tutor] Python Script Testing

2018-03-15 Thread Alex Kleider
On 2018-03-15 09:56, Preeti Saxena wrote: Hi, I am new to python. I am trying to test my program, like a coursera submission, which takes run time arguments using "raw_input()". Is there a way I can write all the input data into a file and pass it from command line to the script? 1. I have

Re: [Tutor] Does Python and its standard libraries use semantic versioning?

2018-02-10 Thread Alex Kleider
On 2018-02-10 01:07, Alan Gauld via Tutor wrote: On 10/02/18 05:44, boB Stepp wrote: I have been reading the interesting web page "Semantic Versioning This link may be of interest to those following this thread: http://nvie.com/posts/a-successful-git-branching-model/

Re: [Tutor] can someone explain the reason for error

2018-02-07 Thread Alex Kleider
On 2018-02-07 03:58, vinod bhaskaran wrote: Hi, I am a beginner level programmer and in one assignment the question given is:to remove ',' from a list after getting a comma separated input from console. I gave the below (most print statements are for reference except the last print

Re: [Tutor] Data Structures printing and Python Package creation

2018-02-03 Thread Alex Kleider
On 2018-02-03 11:20, Bob Gailer wrote: On Feb 3, 2018 2:09 PM, "Daniel Bosah" wrote: I'm in a research group for school, and my first task is to learn how to make a Python package and to learn how to print out all types of data structures. Are there resources I can be

Re: [Tutor] When do you know you're ready to start applying for jobs?

2017-12-14 Thread Alex Kleider
On 2017-12-14 16:21, Alan Gauld via Tutor wrote: On 14/12/17 20:30, Matthew Ngaha wrote: direction on where I can learn about the principles of system design. Also why isn't this taught in beginner tutorials, or is it an advanced concept? It's advanced compared to programming, but there are

Re: [Tutor] sibling import

2017-10-13 Thread Alex Kleider
On 2017-10-12 15:58, Mats Wichmann wrote: On 10/12/2017 05:15 AM, Atar new wrote: Hi Team, Here is my problem. I want to use sibling import but it is not working . I know taht if we add the directory in sys.path ,it will work. But I have to package the whole application and will create a

Re: [Tutor] easygui

2017-08-28 Thread Alex Kleider
On 2017-08-27 07:18, Mats Wichmann wrote: or perhaps less intuitively, stick a first line in it to tell the system to have Python run it, so your script looks like this (there are possible variants on that magic first line, but this one should work whichever your platform is, as long as it

Re: [Tutor] new to python

2017-07-23 Thread Alex Kleider
On 2017-07-23 01:06, Anish Tambe wrote: for line in file: This line is not required as the you have opened your file to 'f'. 'file' is a built-in class. Type - help(file) on the interpreter to know more about it. This appears to be true in python2x but not in python3: alex@X301n3:~$ python3

Re: [Tutor] Fahrenheit to Celsius Conversion another problem and Programming Paradigm

2017-06-14 Thread Alex Kleider
On 2017-06-14 12:22, Mats Wichmann wrote: Of course if you do any serious argument handling, it's better to use something like optparse (and earlier argparse) module so you're not reinventing a wheel which has been massively worked on already. At the suggestion of a posting on this list some

Re: [Tutor] Problem with if statements and else statements

2017-05-29 Thread Alex Kleider
On 2017-05-29 16:08, Cameron Simpson wrote: snip BTW, in Python we tend to use named like "Fred" for classes (or factories), and "fred" for regular variables. And "FRED" for things that would be constants in other languages. Eg: MAX_THINGS = 16 class Foo: def FooBah(x): return

Re: [Tutor] Problem with if statements and else statements

2017-05-28 Thread Alex Kleider
On 2017-05-28 13:13, Mats Wichmann wrote: FWIW, if checking for multiples, you could also write: if Month in ['January', '1']: Would if Month in {'January', '1'}: be even better? (regarding efficiency perhaps? Trivial point, I know, but just wondering.)

Re: [Tutor] Collecting output from Python scripts executed via Cron

2017-05-19 Thread Alex Kleider
On 2017-05-18 18:48, Leo Silver wrote: I have written a several Python scripts to collect data from external sources (an email account and an sftp site). In development I run the scripts from IDLE or the command line and can view the output of various print statements in the scripts which

Re: [Tutor] copy/paste/move files

2017-05-17 Thread Alex Kleider
On 2017-05-17 12:09, Michael C wrote: Hi all, How do I move files to a designated folder or copy/paste? The first hit when I googled "how to move a file using python" was http://stackoverflow.com/questions/8858008/how-to-move-a-file-in-python which in turn suggests the use of: os.rename() or

Re: [Tutor] How do we create a GUI to run a simple calculation program in Python?

2017-04-15 Thread Alex Kleider
On 2017-04-15 01:04, Alan Gauld via Tutor wrote: Finally, if you can find a copy of my recent book "Python Projects" there is a rolling project within that which demonstrates how the same logic code can be used to build a CLI, a GUI and a Web app. [ In fact it goes even further by

Re: [Tutor] How do we create a GUI to run a simple calculation program in Python?

2017-04-14 Thread Alex Kleider
On 2017-04-04 12:12, Alan Gauld via Tutor wrote: On 04/04/17 17:55, Lisa Hasler Waters wrote: A middle school student of mine created a program to calculate simple and compound interest. He built it in PyCharm EDU using a Mac running 10.11.6. He would like to create a GUI to run this

Re: [Tutor] Count for loops

2017-04-08 Thread Alex Kleider
On 2017-04-08 05:49, Rafael Knuth wrote: Dear Sama, thank you so much for your explanation and sorry to bother you on the same subject again. I learn the most by taking code apart line by line, putting it together, taking apart again, modifying it slightly ... which is exactly what I did with

Re: [Tutor] Asking about Run python script at Startup

2017-04-04 Thread Alex Kleider
On 2017-04-02 21:34, Quang nguyen wrote: Hi guys, I do not know how to run my python 3 script after my PI2 finished startup. Have you looked here? : http://raspberrypi.stackexchange.com/questions/8734/execute-script-on-start-up ___ Tutor maillist

Re: [Tutor] Validating String contains IP address

2017-04-01 Thread Alex Kleider
On 2017-03-31 18:01, Mats Wichmann wrote: On 03/31/2017 06:44 PM, Alex Kleider wrote: On 2017-03-31 16:35, Ed Manning wrote: What's the best way to validate a string contains a IP address Sent from my iPad ___ Tutor maillist - Tutor@python.org

Re: [Tutor] Validating String contains IP address

2017-03-31 Thread Alex Kleider
On 2017-03-31 16:35, Ed Manning wrote: What's the best way to validate a string contains a IP address Sent from my iPad ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] reading files in Python 3

2017-03-31 Thread Alex Kleider
On 2017-03-30 13:45, Mats Wichmann wrote: Yeah, fun. You need to escape the \ that the idiot MS-DOS people chose for the file path separator. I also believe that the "MS-DOS people" are making a poor choice but to call them idiots is perhaps a bit strong. Remember that for many the use of

Re: [Tutor] Lists of duplicates

2017-03-09 Thread Alex Kleider
On 2017-03-09 06:07, Steven D'Aprano wrote: On Wed, Mar 08, 2017 at 08:29:19PM -0800, Alex Kleider wrote: Things like this can usually be broken down into their component parts but I've been unsuccessful doing so: def f(lst): res = {} for item in lst: method_res

Re: [Tutor] Lists of duplicates

2017-03-08 Thread Alex Kleider
On 2017-03-08 21:14, boB Stepp wrote: Alex, I think you can break this down as follows: py3: res = {} py3: def key_item_to_res(item): ... res.setdefault(item, []).append(item) ... py3: key_item_to_res(3) py3: res {3: [3]} py3: key_item_to_res(3) py3: res {3: [3, 3]} py3: key_item_to_res(2)

Re: [Tutor] Lists of duplicates

2017-03-08 Thread Alex Kleider
On 2017-03-08 17:03, Alan Gauld via Tutor wrote: On 08/03/17 19:56, Sri Kavi wrote: It’s about making a function that returns a list of lists, with each list being all of the elements that are the same as another element in the original list. This is one of those problems where there is

Re: [Tutor] Calculate 4**9 without using **

2017-03-06 Thread Alex Kleider
On 2017-03-05 23:52, Sri Kavi wrote: This version deals with both negative and non-negative exponents in a single loop. I like this. def power(base, exponent): """ Returns base**exponent. """ if exponent == 0: return 1 else: result = 1 for _ in

Re: [Tutor] Calculate 4**9 without using **

2017-03-05 Thread Alex Kleider
On 2017-03-04 19:06, Sri Kavi wrote: I'm sorry I confused you all. I was trying to reply to Tasha Burman, but I was in digest mode and I didn't know how to turn it off. So far I've been just a lurker here. I also don't know if it's a school assignment. Here's how I would do it. def

Re: [Tutor] Calculate 4**9 without using **

2017-03-05 Thread Alex Kleider
On 2017-03-05 01:42, Sri Kavi wrote: I’ve improved it a bit to meet the following conditions: 1. type(base) == int and exponent == 0 2. base == 0 < exponent 3. (base > 0 or base < 0) and exponent > 0 4. base > 0 > exponent 5. base < 0 > exponent 6. base == 0 > exponent def power(base,

Re: [Tutor] Calculate 4**9 without using **

2017-03-05 Thread Alex Kleider
On 2017-03-05 02:24, Peter Otten wrote: Sri Kavi wrote: Like I just said in my other message, I was trying to reply to Tasha Burman, but I was in digest mode and I didn't know how to change my subscription options in order to reply to individual messages. I also don't know if it's an

Re: [Tutor] Calculate 4**9 without using **

2017-03-04 Thread Alex Kleider
On 2017-03-04 08:17, Sri Kavi wrote: I'm a beginner learning to program with Python. I'm trying to explain a solution in plain English. Please correct me if I'm wrong. Create a function that takes base and exponent as arguments. Is seems that you are facing the same problem as Tasha

Re: [Tutor] Asking about pi_switch

2017-03-02 Thread Alex Kleider
On 02/03/17 22:20, Quang nguyen wrote: Right now, I need to use pi_switch in order to send data through RF system by Pi2. Until now, I installed everything it need from an article on the internet. Those things are python-dev, libboost-python-dev, python-pip, and I used pip to install

Re: [Tutor] Asking about pi_switch

2017-03-02 Thread Alex Kleider
On 2017-03-02 14:20, Quang nguyen wrote: Hi, Right now, I need to use pi_switch in order to send data through RF system by Pi2. Until now, I installed everything it need from an article on the internet. Those things are python-dev, libboost-python-dev, python-pip, and I used pip to install

Re: [Tutor] How to access an instance variable of a superclass from an instance of the subclass?

2017-02-22 Thread Alex Kleider
On 2017-02-22 20:53, boB Stepp wrote: On Wed, Feb 22, 2017 at 10:25 PM, boB Stepp wrote: I am trying to wrap my head around the mechanics of inheritance in Python 3. I thought that all attributes of a superclass were accessible to an instance of a subclass. But when I

Re: [Tutor] Python-list thread: int vs. float

2017-02-11 Thread Alex Kleider
On 2017-02-11 00:36, eryk sun wrote: On Sat, Feb 11, 2017 at 8:06 AM, Steven D'Aprano wrote: Valid digits for integers include 0 through 9 in decimal Note that Python 3 uses the Unicode database to determine the decimal value of characters, if any. It's not limited to

Re: [Tutor] Test for type(object) == ???

2017-02-10 Thread Alex Kleider
On 2017-02-10 17:34, boB Stepp wrote: I was playing around with type() tonight. . I've also "played around" with this subject- Here's a source: http://stackoverflow.com/questions/152580/whats-the-canonical-way-to-check-for-type-in-python ... and a successful experiment:

Re: [Tutor] Error when trying to use classes

2017-02-07 Thread Alex Kleider
On 2017-02-07 07:34, Rafael Skovron wrote: I'm trying to learn how to use Classes but I keep getting NameErrors no matter what code I put into the script. Any ideas why? Assuming the code you've edited using vim is in a file mymodule.py And after invoking the interpreter you issue the

Re: [Tutor] Basic Tutorial for Python

2017-02-06 Thread Alex Kleider
On 2017-02-06 08:13, Hüseyin Ertuğrul wrote: Hello all, I am a system engineer and I want to learn python language. I don't know any program language and I need tutorial for beginner or for dummies. By the way I want to see basic example codes for practice. What is your suggestion for that

Re: [Tutor] help :making window

2016-12-31 Thread Alex Kleider
On 2016-12-31 09:35, Joel Goldstick wrote: Semicolon (;) isn't used in python as a statement separator alex@X301n3:/mnt$ python3 Python 3.4.3 (default, Nov 17 2016, 01:11:57) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "license" for more information. gee = "really";

Re: [Tutor] how to move an executable into path

2016-11-27 Thread Alex Kleider
On 2016-11-27 16:26, Steven D'Aprano wrote: snip.. I fully admit some snark about Firefox. snip.. I've been using Firefox on Ubuntu for years and haven't recognized any difficulties although I don't use it for much other than email, searching, and occasionally shopping. I would be

Re: [Tutor] run local script on a remote machine

2016-10-27 Thread Alex Kleider
On 2016-10-27 00:22, Cameron Simpson wrote: On 26Oct2016 10:44, Alex Kleider <aklei...@sonic.net> wrote: command = ( "ssh -p22 alex@10.10.10.10 python3 -u - one two three < {}" .format(script)) ret = subprocess.call(shlex.split(command)) This is not fine. ..

Re: [Tutor] run local script on a remote machine

2016-10-27 Thread Alex Kleider
On 2016-10-27 00:57, Wolfgang Maier wrote: The structure of the command you are trying to execute would require you to set the "shell" argument of subprocess.call to True. Specifically, the "<" redirection operator is shell functionality. Thank you Wolfgang. Simply eliminating the call to

[Tutor] run local script on a remote machine

2016-10-26 Thread Alex Kleider
I've got three files as follows: 1: #!/usr/bin/env python3 # # file: experiment.py # # A simple python program that takes parameters. import sys info = sys.argv[1:] print(info) with open("/home/alex/junk.txt", 'w') as file_object: for item in info:

Re: [Tutor] Python help

2016-10-16 Thread Alex Kleider
On 2016-10-15 15:48, Nicholas Hopkins wrote: Hello Please tell me what is wrong with my code and how I can put an if else statement inside of another if else statement This is my code: path = input('Which path number will you take?') if path == '1': print('You took the first path')

Re: [Tutor] Error: 'IndexedVar' object is not callable

2016-09-09 Thread Alex Kleider
On 2016-09-09 18:13, Steven D'Aprano wrote: Please read this article first for how you can improve the chances of getting good answers to your questions: http://sscce.org/ In addition to the link Seven provides above, I've also found the following to be worth perusing:

Re: [Tutor] Error: 'IndexedVar' object is not callable

2016-09-09 Thread Alex Kleider
On 2016-09-09 11:50, Pooja Bhalode wrote: Hi everyone, I was getting this error which read ' 'IndexedVar' object is not callable ' for a variable type. You haven't provided much information but it seems to me you are calling IndexedVar as though it were a function but it probably isn't a

Re: [Tutor] project directory structure

2016-08-27 Thread Alex Kleider
On 2016-08-26 21:58, Ben Finney wrote: Alex Kleider <aklei...@sonic.net> writes: Am I to assume that if I have activated a virtualenv, then the following shebang #!/usr/bin/env python will use the python specified in the venv/bin/? Yes, the purpose of that shebang is to tell

Re: [Tutor] project directory structure

2016-08-26 Thread Alex Kleider
On 2016-08-25 21:27, Ben Finney wrote: That's exactly the wrong thing to do. Your shebang line should *not* assume a custom location of the Python interpreter. It's the responsibility of the operating system or virtualenv to provide the Python interpreter command in a standard place.

[Tutor] project directory structure

2016-08-25 Thread Alex Kleider
I'm still struggling with what is the best way to set up a project directory. All the sources I've read seem to agree that one should have a top level project directory under which one might expect to find the following: COPYING.txt # or LICENSE.txt README.rst setup.py and if the

Re: [Tutor] OT: Recommendations for a Linux distribution to dual-boot with Win7-64 bit

2016-06-28 Thread Alex Kleider
On 2016-06-28 11:46, David Rock wrote: Here’s my take on a lot of this (it’s similar to what’s been said already, so this is more of a general philosophy of distros). Very interesting reading for which I thank you. I'd be interested in knowing if you'd make a distinction between 'the latest

Re: [Tutor] OT: Recommendations for a Linux distribution to dual-boot with Win7-64 bit

2016-06-28 Thread Alex Kleider
On 2016-06-27 20:48, Steven D'Aprano wrote: Also Debian. Not Ubuntu. Can you elaborate why you specifically exclude Ubuntu? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] Study Tips

2016-05-30 Thread Alex Kleider
On 2016-05-30 12:02, boB Stepp wrote: ... Are you totally new to programming in *any* language? If yes, you have much more to learn than *just* a programming language. I am going to assume that you are very new to programming in general. Forgive me if I am mistaken! But if you are, then some

Re: [Tutor] "List" object is not callable

2016-04-30 Thread Alex Kleider
On 2016-04-30 11:51, Jason N. via Tutor wrote: Hello, I found this simple script online but when I execute it I get the following error: "TypeError: 'list' object is not callable" Here is the code sample:import subprocess ls_output= subprocess.check_output(['dir']) It works on my system:

Re: [Tutor] Detect the folder of a file

2016-04-26 Thread Alex Kleider
On 2016-04-26 16:16, Oliver Bestwalter wrote: sys.executable '/home/obestwalter/.pyenv/versions/3.4.4/envs/tmp/bin/python3.4' Not sure if this helps but perhaps: alex@X301:~/Py$ which python /usr/bin/python alex@X301:~/Py$ . venv/bin/activate (venv)alex@X301:~/Py$ which python

[Tutor] Object-Oriented Analysis by Peter Coad & Edward Yourdon

2016-03-23 Thread Alex Kleider
The above cited book was mentioned in a recent thread (by Alan I think.) I acquired the book but it isn't at all what I expected and I've no use for it. If he or anyone else would like it, I'm happy to send it along. Just let me know an address[1] to which to send it. Cheers, Alex [1] I'm happy

Re: [Tutor] Recommendations for best tool to write/run Python

2016-03-02 Thread Alex Kleider
I've not noticed anyone mention vimtutor which might be helpful. On a Mac or Linux system, from the command line simply type "vimtutor" and with in 1/2 to 1 hour you'll know enough to use vim _and_ be in a position to decide if it's the editor for you. I've been told vim can also be had on the

Re: [Tutor] Enumerate vs DictReader object manipulation:

2016-02-04 Thread Alex Kleider
On 2016-02-04 01:46, Oscar Benjamin wrote: You can see an explanation of the different collection terminology here: https://docs.python.org/2/library/collections.html#collections-abstract-base-classes A dict is a Mapping and a set is a Set. Both also comes under the categories Sized,

Re: [Tutor] Enumerate vs DictReader object manipulation:

2016-02-03 Thread Alex Kleider
On 2016-02-03 13:24, Ben Finney wrote: You have discovered the difference between an iterable (an object you can iterate over with ‘for’), versus a sequence (an object whose items remain in place and can be iterated many times). Every sequence is an iterable, but not vice versa. File objects

[Tutor] mock

2016-01-22 Thread Alex Kleider
Some weeks (perhaps months) ago, I posted a question about testing and got many responses but had trouble grasping the concepts so I settled on the suggestion that I thought would be the easiest to implement (using unittest.mock.) Here it is- """ from Peter Otten: I find Ben's example

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

2016-01-17 Thread Alex Kleider
On 2016-01-17 02:18, Cameron Simpson wrote: On 16Jan2016 22:42, Alex Kleider <aklei...@sonic.net> wrote: On 2016-01-16 18:02, Cameron Simpson wrote: much like writing a function "def f(x, y=None)"; None is a sentinel value - specially recognised as nor in the normal domai

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

2016-01-17 Thread Alex Kleider
it to advantage as you describe. Another "Ah, Ha!" experience. Alex On 2016-01-17 13:48, Cameron Simpson wrote: On 17Jan2016 10:49, Alex Kleider <aklei...@sonic.net> wrote: Can you please clarify the last bit: "specially recognised as nor in the normal domain for that value.&

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

2016-01-16 Thread Alex Kleider
On 2016-01-16 16:08, Alan Gauld wrote: On 16/01/16 23:56, Alan Gauld wrote: On 16/01/16 22:39, boB Stepp wrote: So in this model of understanding negative list indexing, should it be: mylist = [ 100, 200, 300, 400, 500 ] ^^^^^ ^ -5 -4 -3 -2 -1

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

2016-01-16 Thread Alex Kleider
On 2016-01-16 18:02, Cameron Simpson wrote: On 16Jan2016 18:43, boB Stepp wrote: This led me to try: mylist[:None] [100, 200, 300, 400, 500] So, in effect, None is acting as a place holder for that final position in slices. Also, I would never have thought to be

Re: [Tutor] Organizing files

2016-01-11 Thread Alex Kleider
On 2016-01-11 04:51, Rene Werner wrote: Hello list, right now I am working on a couple of programming-related challenges. The challenges are sorted into problem sets, where each set contains a number of problems. Because a lot of these problems rely on code that is often the same, I have

Re: [Tutor] method, type?

2016-01-07 Thread Alex Kleider
Thank you to all who contributed to this thread. It has helped me immensely and I enjoyed some of the spirited discussion. Some of my notes follow (in case corrections are in order:-) my_notes = """ @staticmethod def s_method(param_but_no_self_or_cls): # An ordinary

[Tutor] method, type?

2016-01-05 Thread Alex Kleider
e them. get_line_item works as I wanted but it's clearly not the usual type of method and I don't know how to categorize it. It's an instance creator- is there a better term? Is this 'Pythonic' code? """ as_always = """Thanks, Alex Kleider""" ~ _

Re: [Tutor] method, type?

2016-01-05 Thread Alex Kleider
Hoping this helps rather than confuses, Cameron Simpson It is no more confusing than what I had already read about static and class methods. I guess I was hoping for an easy explanation but such a thing probably doesn't exist. I'll have to slog through the explanation.

Re: [Tutor] Using python 3 on Ubuntu 14.04

2015-12-23 Thread Alex Kleider
On 2015-12-23 14:58, Jim Byrnes wrote: I am in the process of moving from unbutu 12.04 to 14.04. I was doing some testing and got this: jfb@Jims-1404:~$ cd MyProgs jfb@Jims-1404:~/MyProgs$ cd passwords jfb@Jims-1404:~/MyProgs/passwords$ python3 passwords.py Traceback (most recent call last):

Re: [Tutor] interface

2015-12-20 Thread Alex Kleider
On 2015-12-20 06:11, Alan Gauld wrote: On 20/12/15 02:21, Alex Kleider wrote: First I've heard of Tix! A potentially useful set of extra widgets on top of Tkinter. Unfortunately the Tkinter port of the original Tcl/Tk TIX package is incomplete and only reliable for about half the extended

Re: [Tutor] interface

2015-12-19 Thread Alex Kleider
On 2015-12-18 17:22, Alan Gauld wrote: FWIW My recent book Python Projects includes coverage of both ttk and Tix as well as core tkinter. But it's only designed to be a taster, it's not a complete reference. It's more about the general approach to putting a UI on an app than about any specific

Re: [Tutor] interface

2015-12-18 Thread Alex Kleider
On 2015-12-16 17:42, boB Stepp wrote: On Mon, Dec 14, 2015 at 10:08 PM, Alex Kleider <aklei...@sonic.net> wrote: Thank you, gentlemen (Alan, Ben, Mark,) for your advice. The consensus seems to be in favour of tkinter so I'll head in that direction. If you are into books, "Program

Re: [Tutor] interface

2015-12-18 Thread Alex Kleider
On 2015-12-18 14:13, Mark Lawrence wrote: On 18/12/2015 18:38, Alex Kleider wrote: Another issue about which I'd like to hear comments has to do with how the imports are done. Roseman indicates that from tkinter import * from tkinter import ttk is the generally accepted way of doing

Re: [Tutor] interface

2015-12-14 Thread Alex Kleider
Thank you, gentlemen (Alan, Ben, Mark,) for your advice. The consensus seems to be in favour of tkinter so I'll head in that direction. Cheers, Alex ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

[Tutor] interface

2015-12-14 Thread Alex Kleider
So far all my python programming has been done using print for output and (raw)input whenever user input is required. I'd like to learn how to provide a graphical interface. There are several choices with pros and cons to each but an alternative more general approach might be to use a web

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Alex Kleider
On 2015-10-28 09:37, Peter Otten wrote: Vusa Moyo wrote: I've written a script to remove vowels from a string/sentence. the while loop I'm using below is to take care of duplicate vowels found in a sentence, ie anti_vowel('The cow moos louder than the frog') It works, but obviously its

Re: [Tutor] Messy - Very Messy string manipulation.

2015-10-28 Thread Alex Kleider
On 2015-10-28 08:09, Vusa Moyo wrote: Hi Guys, I've written a script to remove vowels from a string/sentence. the while loop I'm using below is to take care of duplicate vowels found in a sentence, ie anti_vowel('The cow moos louder than the frog') It works, but obviously its messy and

Re: [Tutor] Create complex dictionary :p:

2015-10-22 Thread Alex Kleider
On 2015-10-22 14:50, Thomas C. Hicks wrote: On 10/23/2015 05:19 AM, jarod_v6--- via Tutor wrote: Hi!!I would like to prepare a dictionary with complex structure: complex = {name ="value",surname="po",age=poi) What is the most pythonic way to build a dictionary of dictionary?thanks for any

Re: [Tutor] Working collaboratively

2015-10-20 Thread Alex Kleider
On 2015-10-19 15:18, Emile van Sebille wrote: On 10/19/2015 3:04 PM, Alex Kleider wrote: On 2015-10-19 13:08, Emile van Sebille wrote: This looks like the list of identified issues: https://bitbucket.org/pypa/pypi/issues Browse through and see if anything looks interesting/doable

Re: [Tutor] Working collaboratively

2015-10-20 Thread Alex Kleider
On 2015-10-20 01:02, Alan Gauld wrote: On 20/10/15 07:33, Alex Kleider wrote: Look closely at what the return value is called in each case. And see how it compares to the names in the signature. OOPS! Should have run over them with diff _before_ posting rather than after. Sorry about

Re: [Tutor] Working collaboratively (was: accessing modules found throughout a package?)

2015-10-19 Thread Alex Kleider
On 2015-10-19 12:37, Ben Finney wrote: Alex Kleider <aklei...@sonic.net> writes: I'm a long way from distributing packages! You can keep working at your own pace, and that's good. But even better, I would strongly recommend that you work with other people early and frequently. Progr

Re: [Tutor] accessing modules found throughout a package?

2015-10-19 Thread Alex Kleider
On 2015-10-18 18:01, Steven D'Aprano wrote: On Sun, Oct 18, 2015 at 08:07:07AM -0700, Alex Kleider wrote: On 2015-10-17 19:49, Steven D'Aprano wrote: >which will work from your package's callers, and from within the >package >itself provided the top level directory can be found within

Re: [Tutor] Working collaboratively

2015-10-19 Thread Alex Kleider
On 2015-10-19 13:08, Emile van Sebille wrote: This looks like the list of identified issues: https://bitbucket.org/pypa/pypi/issues Browse through and see if anything looks interesting/doable. On 2015-10-19 13:34, Mark Lawrence wrote: How about

Re: [Tutor] accessing modules found throughout a package?

2015-10-18 Thread Alex Kleider
On 2015-10-18 08:07, Alex Kleider wrote: On 2015-10-17 19:49, Steven D'Aprano wrote: which will work from your package's callers, and from within the package itself provided the top level directory can be found within Python's path. Within the package you can also use relative imports, see

Re: [Tutor] accessing modules found throughout a package?

2015-10-18 Thread Alex Kleider
On 2015-10-17 19:49, Steven D'Aprano wrote: which will work from your package's callers, and from within the package itself provided the top level directory can be found within Python's path. Within the package you can also use relative imports, see the docs for more detail. How does one

Re: [Tutor] accessing modules found throughout a package?

2015-10-18 Thread Alex Kleider
On 2015-10-18 10:26, Alan Gauld wrote: On 18/10/15 16:33, Alex Kleider wrote: How does one arrange so "the top level directory _can_ be found within Python's path."? Is the answer to include the following at the beginning of each file? if not 'path/to/top/level/package

Re: [Tutor] how to unittest cli input

2015-10-15 Thread Alex Kleider
On 2015-10-14 11:29, Danny Yoo wrote: ## def make_ask(f, l, p): d = {'Enter your first name: ' : f, 'Enter your last name: ' : l, 'Your mobile phone #: ' : p} return d.get ## This is an example of a 'closure' is it not?

  1   2   3   >