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 te

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) Sorry,

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
mechanism provides enough integration between windows. I tried this (Ubuntu 18.4) and Alt-Tab cycles between terminal and browser but I can't make it cycle from one terminal to another. How do you do that? Alex ___ Tutor maillist - Tutor@pytho

[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 wa

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 myClass(ob

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 t

Re: [Tutor] import failure

2019-02-23 Thread Alex Kleider
When changed to the latter, the program runs as I expected. Thanks to both of you for your guidance. Alex ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] import failure

2019-02-22 Thread Alex Kleider
the following rather puzzling results (explanation below): (p2) alex@one:$ pwd /home/alex/Proj/G/gdata-python-client (p2) alex@one:$ ls buildINSTALL.txt pydocs samples src contacts_example.py Makefile README.txt set_python_path.sh

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 head

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
py 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

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 wit

[Tutor] python -m pip install vs pip install

2018-09-10 Thread Alex Kleider
p36 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
quot;first"] = raw_input("") inputs["second"] = raw_input("") for key in inputs.keys(): print inputs[key] Then from the command line: alex@x301n4:~$ python dummy.py << HERE first input second input HERE On my system[2] the result is: second input fir

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 statement

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 pointed to to help me o

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 lo

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 set

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 is

Re: [Tutor] [Cryptography-dev] Import Error.

2017-07-23 Thread Alex Gaynor
Hi Deepen, Without any more information, it looks like you didn't install cryptography into your virtualenv. How did you install twisted? Alex On Sun, Jul 23, 2017 at 12:24 PM, Deepen Patel wrote: > Hi, > > I got error like Import error. > > Traceback (most recent

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: al

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
ntions that apply to class names. ...and thanks again for explaining. Alex ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

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 help

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
further by demonstrating how to break an app into 3 tiers - data, logic and UI - which is industry best practice, but usually overkill for small projects.] Thanks, Alan, for the guidance. As it happens, I have a copy of your Python Projects" book- time to get it off the shelf and have a clos

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 program

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 yo

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.o

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: https://mail.python.org/mailman/listinfo/tutor

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 Mi

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:

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 prob

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 range(abs(exp

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 power(base

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, exponent):

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 assignment

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 Burman.

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 pi_swi

Re: [Tutor] Asking about pi_switch

2017-03-02 Thread Alex Kleider
nversation going off line for the non Python bits. Alex ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

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 try the following: py3:

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

2017-02-11 Thread Alex Kleider
II decimal digits 0-9. For example: >>> s '௧꘢୩' >>> int(s) 123 >>> print(*(unicodedata.name(c) for c in s), sep='\n') TAMIL DIGIT ONE VAI DIGIT TWO ORIYA DIGIT THREE ??? alex@X301n3:~$ python3 Python 3.4.3 (defaul

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 exp

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 follow

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 case.

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

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

2016-11-27 Thread Alex Kleider
opping. I would be interested in knowing your browser of choice- obviously not Safari! Alex ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

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 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. .. http://bobby-tables.com/

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

2016-10-27 Thread Alex Kleider
ing gets interpreted by the shell. I promise! Thanks again. Alex _ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor ___ T

[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: file_o

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] python coding problem

2016-09-26 Thread Alex Hall
t are > confidential and intended solely for the use of the individual or entity to > whom they are addressed. If you have received this email in error please > notify the sender. > ___ > Tutor maillist - Tuto

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: http://www.catb.org/es

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 f

Re: [Tutor] project directory structure

2016-08-28 Thread Alex Kleider
On 2016-08-27 15:23, c...@zip.com.au wrote: On 27Aug2016 09:06, Alex Kleider wrote: On 2016-08-26 21:58, Ben Finney wrote: Alex Kleider 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

Re: [Tutor] project directory structure

2016-08-27 Thread Alex Kleider
On 2016-08-26 21:58, Ben Finney wrote: Alex Kleider 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 the OS that *whichever* ‘python

Re: [Tutor] project directory structure

2016-08-25 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. Instead

[Tutor] project directory structure

2016-08-25 Thread Alex Kleider
#!../venv/bin/python3 which uses a relative path so the choice I make will determine if I use the above or #!../../venv/bin/python3 Any advice would be appreciated. Alex ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription opti

Re: [Tutor] decorators -- treat me like i'm 6.. what are they.. why are they?

2016-07-06 Thread Alex Hall
On Wed, Jul 6, 2016 at 4:56 PM, Alex Hall wrote: > > > On Wed, Jul 6, 2016 at 3:35 PM, bruce wrote: > >> Hi. >> >> Saw the decorator thread earlier.. didn't want to pollute it. I know, I >> could google! >> >> But, what are decorators, why

Re: [Tutor] decorators -- treat me like i'm 6.. what are they.. why are they?

2016-07-06 Thread Alex Hall
> Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > -- Alex Hall Automatic Distributors, IT department ah...@autodist.com ___ T

Re: [Tutor] Subclassing logging.Handler?

2016-07-06 Thread Alex Hall
On Wed, Jul 6, 2016 at 1:01 PM, Alex Hall wrote: > Regarding this project: I've gone ahead and tried a variant of it. I > wanted to log to an HTML file, since those are much easier to look at with > a screen reader and so I could get used to the concepts involved. Here's >

Re: [Tutor] Subclassing logging.Handler?

2016-07-06 Thread Alex Hall
se(self): self.stream.write(""" """) super(ADTimedRotatingLogFileHandler, self).close() On Wed, Jul 6, 2016 at 8:32 AM, Alex Hall wrote: > Hey list, > Another day, another Python experiment. I'm wondering what methods I'd > have t

[Tutor] Subclassing logging.Handler?

2016-07-06 Thread Alex Hall
ve to worry about? To be clear, I'm not asking about logging to a database, only what to do to make a Handler subclass capable of logging through whatever mechanisms I want. Thanks. -- Alex Hall Automatic Distributors, IT department ah...@autodist.com

Re: [Tutor] isinstance versus 'is'?

2016-07-06 Thread Alex Hall
asking if the value is the literal None object. It seems it's the way None is handled, not an exception in the way 'is' works. Anyway, thanks for the explanations. > On Jul 5, 2016, at 20:54, Steven D'Aprano wrote: > > On Tue, Jul 05, 2016 at 03:05:45PM -0400, Alex Hall

[Tutor] isinstance versus 'is'?

2016-07-05 Thread Alex Hall
t;> a is int False What happened there? Don't these do the same thing? I thought I could use them interchangeably? -- Alex Hall Automatic Distributors, IT department ah...@autodist.com ___ Tutor maillist - Tutor@python.org To unsubscribe or ch

Re: [Tutor] Writing decorators?

2016-07-05 Thread Alex Hall
e empty, given that anywhere else doing so would return the function object rather than call it. Yet, if arguments are passed, you include them like you would anywhere else. Or am I misunderstanding it? > > Sent from my Fonepad > > Alex Hall wrote: > > Okay, I think I follow. So a decor

[Tutor] Writing decorators?

2016-07-05 Thread Alex Hall
r and helpful? Thanks for any links and/or explanations. -- Alex Hall Automatic Distributors, IT department ah...@autodist.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] iterators

2016-07-04 Thread Alex Hall
I believe the problem is what the error says: you're passing an int. When you give it two values, you're giving it a tuple, like (1, 2). That's a list type object in Python, and the 'in' keyword has to operate on lists. Therefore, it works. When you give it one value, though, you're giving it a

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: https://mail.python.org/mailman/list

[Tutor] For-else... Any other handy constructs hiding in Python?

2016-06-24 Thread Alex Hall
statements like this? Python has a lot of really cool shortcuts and features, like get/hasattr, the yield keyword, or comprehensions. I always like finding more to add to the toolbox. -- Alex Hall Automatic Distributors, IT department ah...@autodist.com

Re: [Tutor] Best way to use excepthook here?

2016-06-24 Thread Alex Hall
bs I need tries to transform, say, non-existent dictionary values into 0 or some other constant. On Fri, Jun 24, 2016 at 12:28 AM, Peter Otten <__pete...@web.de> wrote: > Alex Hall wrote: > > > Hey all, > > How would I go about sharing a reassignment of excepthook, w

[Tutor] Best way to use excepthook here?

2016-06-23 Thread Alex Hall
hing to make sure each job logs exceptions, and does it correctly, no matter who else is running at the same time? Thanks. -- Alex Hall Automatic Distributors, IT department ah...@autodist.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Urgent: unicode problems writing CSV file

2016-06-08 Thread Alex Hall
Thanks for all the responses, everyone, what you all said makes sense. I also understand what you mean by the tone of an "urgent" message coming across as demanding. On Wed, Jun 8, 2016 at 1:19 PM, Tim Golden wrote: > On 08/06/2016 14:54, Alex Hall wrote: > > All, > >

Re: [Tutor] Urgent: unicode problems writing CSV file

2016-06-08 Thread Alex Hall
ully sure why or how. csvWriter.writerow([info.encode("utf8") if type(info)is unicode else info for info in resultInfo]) where resultInfo is an array holding the values from a row of database query results, in the order I want them in. On Wed, Jun 8, 2016 at 1:08 PM, Peter Otten <__pete...@

[Tutor] Urgent: unicode problems writing CSV file

2016-06-08 Thread Alex Hall
I've tried str(info).encode("utf8") str(info).decode(utf8") unicode(info, "utf8") csvFile = open("myFile.csv", "wb", encoding="utf-8") #invalid keyword argument What else can I do? As I said, I really have to get this working soon, but I&

Re: [Tutor] Practice Exercises for Beginner ?

2016-06-03 Thread Alex Hall
Make something. :) I know it's pretty open-ended, but just think of an application you want to make, and try to make it in Python. Stick to command line at first, but then try WX or another GUI library. The more times you get stuck, the more you learn and the more you'll know for next time. Make

Re: [Tutor] Semantic Error: Trying to access elements of list and append to empty list with for loop

2016-06-02 Thread Alex Hall
n the attached screenshot > [image: Inline image 2] > > whereas I want only one list containing strings not nested lists. > > Any help would be appreciated. > > *Warm regards,* > > *Olaoluwa O. Thomas,* > *+2347068392705* > ___

Re: [Tutor] OrderedDict?

2016-06-02 Thread Alex Hall
Thanks. I've never used that module before, and didn't realize it's not imported by default, which must be why my first tries failed. I've got it working now. > On Jun 1, 2016, at 18:45, Alan Gauld via Tutor wrote: > > On 01/06/16 16:36, Alex Hall wrote:

[Tutor] OrderedDict?

2016-06-01 Thread Alex Hall
plus some home-grown suggestions on how to implement this, but so far that's it. Although I thought this was in 2.7, it doesn't appear on the Data Structures page at all. What am I missing? Thanks. -- Alex Hall Automatic Distributors, IT

Re: [Tutor] Study Tips

2016-05-30 Thread Alex Kleider
mentioned by Bob. I assume the Python 3 version has the same merits. Best wishes, Alex ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Logging exceptions, but getting stderr output instead

2016-05-25 Thread Alex Hall
, so wanted to check that those are indeed the recommended ways. On Wed, May 25, 2016 at 3:37 PM, Alan Gauld via Tutor wrote: > On 25/05/16 19:11, Alex Hall wrote: > > > As a quick aside, is there an easy way to halt script execution for some > > exceptions? Right now, catchi

Re: [Tutor] Logging exceptions, but getting stderr output instead

2016-05-25 Thread Alex Hall
n Wed, May 25, 2016 at 2:11 PM, Alex Hall wrote: > Hello again list, > I didn't expect to be back so soon. :) I'm trying to log my new script, > and logger.info() works fine. However, logger.exception() doesn't; I see > the exception print to stderr, and it never appea

[Tutor] Logging exceptions, but getting stderr output instead

2016-05-25 Thread Alex Hall
ution continues, but I sometimes want to log the problem and then abort the script, as the error means it shouldn't continue. Thanks. -- Alex Hall Automatic Distributors, IT department ah...@autodist.com ___ Tutor maillist - Tutor@python.or

[Tutor] Baffling problem with a list of objects sharing a property

2016-05-25 Thread Alex Hall
for i in range(len(tests)): print tests[i] tests[i].paths.append("a") print tests[i] If anyone can explain what's happening, I'd very much appreciate it. I'm on Windows 7, Python 2.7.11. Thanks. -- Alex Hall Automatic Distributors, IT department ah...@autodist.

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

2016-04-30 Thread Alex Kleider
#x27;]) It works on my system: Ubuntu 14.04LTS (venv)alex@X301:~$ python Python 3.4.3 (default, Oct 14 2015, 20:33:09) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "license" for more information. import subprocess ls_output= subprocess.

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

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

2016-03-02 Thread Alex Kleider
old vim can also be had on the Redmond OS but I've no experience there. Alex ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

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, Iterable

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
" I've successfully implemented mock.patch parameters but don't understand how to implement the parameters for the assertEqual call as it pertains to my particular situation. My current code sort of does the job but determinating success or failure is not really automated. It'

  1   2   3   4   5   6   >