Re: Mutable global state and threads

2017-01-03 Thread Chris Angelico
On Wed, Jan 4, 2017 at 5:41 PM, Kev Dwyer wrote: > Hello List, > > I came across some threading code in Some Other place recently and wanted to > sanity-check my assumptions. > > The code (below) creates a number of threads; each thread takes the last > (index -1) value from a global list of integ

Re: Choosing a Python IDE. what is your Pythonish recommendation? I do not know what to choose.

2017-01-03 Thread Antonio Caminero Garcia
On Tuesday, January 3, 2017 at 4:12:34 PM UTC-8, Dietmar Schwertberger wrote: > On 02.01.2017 12:38, Antonio Caminero Garcia wrote: > You did not try Wing IDE? It looks less like a spacecraft. Maybe you > like it. > Maybe the difference is that Wing is from Python people while the ones > you list

Mutable global state and threads

2017-01-03 Thread Kev Dwyer
Hello List, I came across some threading code in Some Other place recently and wanted to sanity-check my assumptions. The code (below) creates a number of threads; each thread takes the last (index -1) value from a global list of integers, increments it by one and appends the new value to the

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Larry Hudson via Python-list
On 01/03/2017 04:27 PM, Callum Robinson wrote: On Wednesday, January 4, 2017 at 1:17:11 PM UTC+13, Chris Angelico wrote: On Wed, Jan 4, 2017 at 11:03 AM, Erik wrote: I doubt it's getting that far (I can see at least one syntax error in the code pasted). True true. In any case, the point is t

Re: Clickable hyperlinks

2017-01-03 Thread Dan Sommers
On Wed, 04 Jan 2017 16:40:00 +1100, Steven D'Aprano wrote: > On Wednesday 04 January 2017 15:46, Deborah Swanson wrote: > >> Steven D'Aprano wrote, on January 03, 2017 8:04 PM > [...] >>> Of course you have to put quotes around them to enter them in >>> your source code. >>> We don't expect this

Re: Simulating int arithmetic with wrap-around

2017-01-03 Thread Gregory Ewing
Paul Rubin wrote: My first thought is towards the struct module, especially if you want to handle a bunch of such integers at the same time. Or maybe the array module or some combination. Or possibly numpy. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Choosing a Python IDE. what is your Pythonish recommendation? I do not know what to choose.

2017-01-03 Thread Rustom Mody
On Wednesday, January 4, 2017 at 5:42:34 AM UTC+5:30, Dietmar Schwertberger wrote: > On 02.01.2017 12:38, Antonio Caminero Garcia wrote: > > The thing with the from-the-scratch full featured IDEs (Eclipse, IntelliJ, > > Pycharm) is that they look like a space craft dashboard and that > > unwarra

RE: Clickable hyperlinks

2017-01-03 Thread Steven D'Aprano
On Wednesday 04 January 2017 15:46, Deborah Swanson wrote: > Steven D'Aprano wrote, on January 03, 2017 8:04 PM [...] >> Of course you have to put quotes around them to enter them in >> your source code. >> We don't expect this to work: >> >> print(Hello World!) >> >> >> you have to use a s

Re: Clickable hyperlinks

2017-01-03 Thread boB Stepp
On Tue, Jan 3, 2017 at 10:46 PM, Deborah Swanson wrote: > > > I didn't try printing them before, but I just did. Got: > > >>> print([Example](http://www.example.com) > > SyntaxError: invalid syntax (arrow pointing at the colon) As Steve had said, you need to put everything inside quotes. Also,

RE: Clickable hyperlinks

2017-01-03 Thread Deborah Swanson
Steven D'Aprano wrote, on January 03, 2017 8:04 PM > > On Wednesday 04 January 2017 14:04, Deborah Swanson wrote: > > > Steve D'Aprano wrote, on January 03, 2017 4:56 PM > [...] > >> Python can't force the console to treat something as a clickable > >> link, if the console has no capacity for cl

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Erik
On 04/01/17 03:25, Steven D'Aprano wrote: On Wednesday 04 January 2017 12:25, Callum Robinson wrote: Hey man thanks, the sad thing is i have no idea why i put that in. I must be having a terrible day. Don't worry about it. The difference between a beginner and an expert is *not* that experts

Re: Clickable hyperlinks

2017-01-03 Thread Michael Torrie
On 01/03/2017 08:46 PM, Deborah Swanson wrote: > Actually it is, or at least it doesn't happen in all email readers. > Mine, for instance, never breaks up threads. Mine doesn't either, which illustrates the issue. This message, for example appears under a long thread that started out life as "men

RE: Clickable hyperlinks

2017-01-03 Thread Steven D'Aprano
On Wednesday 04 January 2017 14:04, Deborah Swanson wrote: > Steve D'Aprano wrote, on January 03, 2017 4:56 PM [...] >> Python can't force the console to treat something as a >> clickable link, if the console has no capacity for clickable >> links. Nor can Python predict what format the console us

Re: Choosing a Python IDE. what is your Pythonish recommendation? I do not know what to choose.

2017-01-03 Thread Steven D'Aprano
On Wednesday 04 January 2017 12:10, Cameron Simpson wrote: > On 03Jan2017 12:57, Steve D'Aprano wrote: >>I dislike the Unix-style Vim/Emacs text editors, I prefer a traditional >>GUI-based editor. So my "IDE" is: >>- Firefox, for doing searches and looking up documentation; >>- an GUI programmer'

Re: Clickable hyperlinks

2017-01-03 Thread Michael Torrie
On 01/03/2017 08:28 PM, Deborah Swanson wrote: > I think you're making this too complicated. I meant a console in a GUI > application. Ahh. Well, a "console in a GUI application" is whatever you make it[1]. There's no single "GUI console" hence my confusion and the confusion expressed by the other

RE: Clickable hyperlinks

2017-01-03 Thread Deborah Swanson
David wrote, on January 03, 2017 6:36 PM > > On 4 January 2017 at 11:50, Deborah Swanson > wrote: > > Erik wrote, on January 03, 2017 3:30 PM > >> > >> When you start a new topic on the list, could you please > write a new > >> message rather than replying to an existing message and > changin

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Steven D'Aprano
On Wednesday 04 January 2017 12:25, Callum Robinson wrote: > Hey man thanks, the sad thing is i have no idea why i put that in. I must be > having a terrible day. Don't worry about it. The difference between a beginner and an expert is *not* that experts make fewer mistakes, but that experts kno

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Steven D'Aprano
On Wednesday 04 January 2017 13:24, Callum Robinson wrote: > On Wednesday, January 4, 2017 at 3:05:48 PM UTC+13, MRAB wrote: >> On 2017-01-04 01:37, Callum Robinson wrote: >> > On Wednesday, January 4, 2017 at 12:49:28 PM UTC+13, Callum Robinson >> > wrote: >> >> Im doing a new task from my teache

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Erik
On 04/01/17 02:47, Callum Robinson wrote: On Wednesday, January 4, 2017 at 3:35:53 PM UTC+13, Erik wrote: I did it and this is what it states when i run it hello. I have thought of a number between 1 and 100. Can you guess it? 5 Low Sorry , you are too high. Try again. Does this mean the number

RE: Clickable hyperlinks

2017-01-03 Thread Deborah Swanson
Steve D'Aprano wrote, on January 03, 2017 4:56 PM > On Wed, 4 Jan 2017 10:32 am, Deborah Swanson wrote: > > > > The GUI consoles I have are in Pycharm, the IDLE that comes with > > Anaconda, and Spyder. PyCharm and IDLE both ask for internet access > > when I open them, so they're capable of o

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Callum Robinson
On Wednesday, January 4, 2017 at 3:35:53 PM UTC+13, Erik wrote: > On 04/01/17 02:24, Callum Robinson wrote: > > On Wednesday, January 4, 2017 at 3:05:48 PM UTC+13, MRAB wrote: > >> What values can 'is_same' return? > >> > >> Which of those values are you checking for in the loop? > > > > I'm sorry

RE: Screwing Up looping in Generator

2017-01-03 Thread Deborah Swanson
Erik wrote, on January 03, 2017 5:26 PM > Hi, > > On 04/01/17 01:12, Deborah Swanson wrote: > > The main reason you might want to catch the StopIteration > exception is > > to do something else before your code simply stops running. If all > > you're doing is run a generator til it's out of gas

Re: Clickable hyperlinks

2017-01-03 Thread David
On 4 January 2017 at 11:50, Deborah Swanson wrote: > Erik wrote, on January 03, 2017 3:30 PM >> >> When you start a new topic on the list, could you please write a new >> message rather than replying to an existing message and changing the >> title/subject? >> > Certainly. I've been on many other

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Erik
On 04/01/17 02:24, Callum Robinson wrote: On Wednesday, January 4, 2017 at 3:05:48 PM UTC+13, MRAB wrote: What values can 'is_same' return? Which of those values are you checking for in the loop? I'm sorry but i do not completely understand what you are stating You need to think about the s

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Callum Robinson
On Wednesday, January 4, 2017 at 3:05:48 PM UTC+13, MRAB wrote: > On 2017-01-04 01:37, Callum Robinson wrote: > > On Wednesday, January 4, 2017 at 12:49:28 PM UTC+13, Callum Robinson wrote: > >> Im doing a new task from my teacher but i can't seem to find what is wrong > >> with this code. Can any

RE: Screwing Up looping in Generator

2017-01-03 Thread Deborah Swanson
Sayth Renshaw wrote, on January 03, 2017 5:55 PM > > On Wednesday, 4 January 2017 12:36:10 UTC+11, Sayth Renshaw wrote: > > So can I call the generator twice and receive the same file > twice in 2 > > for loops? > > > > Once to get the files name and the second to process? > > > > for file i

Re: Screwing Up looping in Generator

2017-01-03 Thread Sayth Renshaw
Untested as i wrote this in notepad at work but, if i first use the generator to create a set of filenames and then iterate it then call the generator anew to process file may work? Good idea or better available? def get_list_of_names(generator_arg): name_set = set() for name in generat

RE: Screwing Up looping in Generator

2017-01-03 Thread Deborah Swanson
Sayth Renshaw wrote, on January 03, 2017 5:36 PM > > So can I call the generator twice and receive the same file > twice in 2 for loops? > > Once to get the files name and the second to process? > > for file in rootobs: > base = os.path.basename(file.name) > write_to = os.pat

Re: How Best to Coerce Python Objects to Integers?

2017-01-03 Thread Erik
On 04/01/17 01:10, Steve D'Aprano wrote: On Wed, 4 Jan 2017 11:22 am, Erik wrote: What he *should* have done is just validated his input strings before presenting the string to int() - i.e., process the input with knowledge that is specific to the problem domain before calling the general-purpos

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread MRAB
On 2017-01-04 01:37, Callum Robinson wrote: On Wednesday, January 4, 2017 at 12:49:28 PM UTC+13, Callum Robinson wrote: Im doing a new task from my teacher but i can't seem to find what is wrong with this code. Can anyone help? #mynumber.py # this game uses a home made function import random

RE: Screwing Up looping in Generator

2017-01-03 Thread Deborah Swanson
Chris Angelico wrote, on January 03, 2017 3:35 PM > > On Wed, Jan 4, 2017 at 10:05 AM, Deborah Swanson > wrote: > > Ok, I learned how to use generators in Python 2.7.8, which may be > > different from Python 3 for generators. But I learned from MIT's > > online introduction to python course, a

Re: Choosing a Python IDE. what is your Pythonish recommendation? I do not know what to choose.

2017-01-03 Thread Cameron Simpson
On 03Jan2017 12:57, Steve D'Aprano wrote: I dislike the Unix-style Vim/Emacs text editors, I prefer a traditional GUI-based editor. So my "IDE" is: - Firefox, for doing searches and looking up documentation; - an GUI programmer's editor, preferably one with a tab-based interface, such as geany

Re: Screwing Up looping in Generator

2017-01-03 Thread Sayth Renshaw
On Wednesday, 4 January 2017 12:36:10 UTC+11, Sayth Renshaw wrote: > So can I call the generator twice and receive the same file twice in 2 for > loops? > > Once to get the files name and the second to process? > > for file in rootobs: > base = os.path.basename(file.name) > w

Re: trouble with cmd.Cmd and prompting

2017-01-03 Thread Cameron Simpson
On 03Jan2017 16:57, Peter Otten <__pete...@web.de> wrote: Cameron Simpson wrote: On 03Jan2017 00:14, Dennis Lee Bieber wrote: On Tue, 3 Jan 2017 11:33:15 +1100, Cameron Simpson declaimed the following: I'm using cmd.Cmd to write a little FTP-like command line to interface to a storage system

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Callum Robinson
On Wednesday, January 4, 2017 at 12:49:28 PM UTC+13, Callum Robinson wrote: > Im doing a new task from my teacher but i can't seem to find what is wrong > with this code. Can anyone help? > > #mynumber.py > # this game uses a home made function > import random > > #think of a number > computer_n

Re: Screwing Up looping in Generator

2017-01-03 Thread Sayth Renshaw
So can I call the generator twice and receive the same file twice in 2 for loops? Once to get the files name and the second to process? for file in rootobs: base = os.path.basename(file.name) write_to = os.path.join("output", os.path.splitext(base)[0] + ".csv") with o

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Callum Robinson
On Wednesday, January 4, 2017 at 2:16:08 PM UTC+13, Steve D'Aprano wrote: > On Wed, 4 Jan 2017 12:04 pm, Callum Robinson wrote: > > > Traceback (most recent call last): > > File "D:/Python/random.py", line 6, in > > computer_number = number.randint(1, 100) > > NameError: name 'number' is no

Re: Screwing Up looping in Generator

2017-01-03 Thread Erik
Hi, On 04/01/17 01:12, Deborah Swanson wrote: The main reason you might want to catch the StopIteration exception is to do something else before your code simply stops running. If all you're doing is run a generator til it's out of gas, and that's all you want it to do, then there's no need to c

Re: Clickable hyperlinks

2017-01-03 Thread Michael Torrie
On 01/03/2017 04:32 PM, Deborah Swanson wrote: > The GUI consoles I have are in Pycharm, the IDLE that comes with > Anaconda, and Spyder. PyCharm and IDLE both ask for internet access when > I open them, so they're capable of opening links, but whether that means > their output space is capable of

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Steve D'Aprano
On Wed, 4 Jan 2017 12:04 pm, Callum Robinson wrote: > Traceback (most recent call last): > File "D:/Python/random.py", line 6, in > computer_number = number.randint(1, 100) > NameError: name 'number' is not defined That's exactly what we need to see! The full traceback, thank you! You're

Re: How Best to Coerce Python Objects to Integers?

2017-01-03 Thread Steve D'Aprano
On Wed, 4 Jan 2017 11:22 am, Erik wrote: > On 03/01/17 22:47, Chris Angelico wrote: >> On Wed, Jan 4, 2017 at 9:42 AM, Ethan Furman wrote: >>> Aside from calling "except Exception" a "naked except" >> >> If you read the comments, you'll see that he originally had an actual >> bare except clause,

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Callum Robinson
On Wednesday, January 4, 2017 at 1:45:22 PM UTC+13, Erik wrote: > Hi Callum, > > On 04/01/17 00:30, Callum Robinson wrote: > > I feel like im missing something so blatantly obvious. > > That's because you are ;). I don't want to come across as patronising, > but I want you to see it for yourself

RE: Screwing Up looping in Generator

2017-01-03 Thread Deborah Swanson
Erik wrote, on January 03, 2017 3:53 PM > > On 03/01/17 23:05, Deborah Swanson wrote: > > And yes, we usually used for loops for generators, unless you don't > > know when the generator will be exhausted. As in this case, > where the > > number of files the generator can provide is unknown. The

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Steve D'Aprano
On Wed, 4 Jan 2017 11:16 am, Callum Robinson wrote: > My apologizes but i'm quite new and would need instructions to what > information you need me to get. Do you know how to copy and paste from the terminal window? Somewhere on the screen you see something like: x = 23 + ) ^

RE: Screwing Up looping in Generator

2017-01-03 Thread Deborah Swanson
Erik wrote, on January 03, 2017 3:45 PM > > Hi, > > On 03/01/17 22:14, Deborah Swanson wrote: > > ...you have to create the generator object first and use it to call > > the next function. And I really don't think you can use a > generator as > > your range in a for loop. So I'd use a 'while T

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Terry Reedy
On 1/3/2017 7:02 PM, Callum Robinson wrote: When i check the code it comes up with invalid syntax and my writing line gets re directed here def is_same(target, number: if target == number: result="win" elif target > number: result="low" else:

RE: Clickable hyperlinks

2017-01-03 Thread Steve D'Aprano
On Wed, 4 Jan 2017 10:32 am, Deborah Swanson wrote: > The GUI consoles I have are in Pycharm, the IDLE that comes with > Anaconda, and Spyder. PyCharm and IDLE both ask for internet access when > I open them, so they're capable of opening links, but whether that means > their output space is capa

RE: Clickable hyperlinks

2017-01-03 Thread Deborah Swanson
Erik wrote, on January 03, 2017 3:30 PM > To: python-list@python.org > Subject: Re: Clickable hyperlinks > > Hi. > > On 03/01/17 19:46, Deborah Swanson wrote: > > Excel has a formula: > > When you start a new topic on the list, could you please write a new > message rather than replying to an e

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Erik
On 04/01/17 00:32, Callum Robinson wrote: I forgot a bloody bracket xD Cool, you got it ;) It's the sort of thing your brain will see instantly once you've done it a few times :D and now theirs a new error ill try to figure this out on my own. You need to look back to Chris's original rep

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Erik
Hi Callum, On 04/01/17 00:30, Callum Robinson wrote: I feel like im missing something so blatantly obvious. That's because you are ;). I don't want to come across as patronising, but I want you to see it for yourself, so, here's a function definition similar to yours that doesn't have the sa

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Callum Robinson
On Wednesday, January 4, 2017 at 1:26:26 PM UTC+13, Erik wrote: > Hi Callum, > > On 04/01/17 00:02, Callum Robinson wrote: > > When i check the code it comes up with invalid syntax and my writing > line gets re directed here > > > > def is_same(target, number: > > if target == number:

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Callum Robinson
On Wednesday, January 4, 2017 at 1:26:26 PM UTC+13, Erik wrote: > Hi Callum, > > On 04/01/17 00:02, Callum Robinson wrote: > > When i check the code it comes up with invalid syntax and my writing > line gets re directed here > > > > def is_same(target, number: > > if target == number:

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Callum Robinson
On Wednesday, January 4, 2017 at 1:17:11 PM UTC+13, Chris Angelico wrote: > On Wed, Jan 4, 2017 at 11:03 AM, Erik wrote: > > I doubt it's getting that far (I can see at least one syntax error in the > > code pasted). > > True true. In any case, the point is to copy and paste the error > message.

Re: How Best to Coerce Python Objects to Integers?

2017-01-03 Thread Steve D'Aprano
On Wed, 4 Jan 2017 10:09 am, Ethan Furman wrote: > And, of course, whether or not "except Exception" is too broad depends on > the use-case. I'm having trouble thinking of *any* use-case where this would be useful. His intention, it seems, is to write a function which simply cannot fail, presumab

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Erik
Hi Callum, On 04/01/17 00:02, Callum Robinson wrote: > When i check the code it comes up with invalid syntax and my writing line gets re directed here > > def is_same(target, number: > if target == number: > result="win" > elif target > number: > result="

Re: How Best to Coerce Python Objects to Integers?

2017-01-03 Thread Erik
On 03/01/17 22:47, Chris Angelico wrote: On Wed, Jan 4, 2017 at 9:42 AM, Ethan Furman wrote: Aside from calling "except Exception" a "naked except" If you read the comments, you'll see that he originally had an actual bare except clause, but then improved the code somewhat in response to a re

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Callum Robinson
On Wednesday, January 4, 2017 at 1:03:18 PM UTC+13, Erik wrote: > On 03/01/17 23:56, Chris Angelico wrote: > > On Wed, Jan 4, 2017 at 10:49 AM, wrote: > >> #think of a number > >> computer_number = number.randint(1,100) > > > > What's wrong is that you aren't showing us the exception you get on >

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Chris Angelico
On Wed, Jan 4, 2017 at 11:03 AM, Erik wrote: > I doubt it's getting that far (I can see at least one syntax error in the > code pasted). True true. In any case, the point is to copy and paste the error message. Callum, please, copy and paste it. ChrisA -- https://mail.python.org/mailman/listinf

Re: Choosing a Python IDE. what is your Pythonish recommendation? I do not know what to choose.

2017-01-03 Thread Dietmar Schwertberger
On 02.01.2017 12:38, Antonio Caminero Garcia wrote: The thing with the from-the-scratch full featured IDEs (Eclipse, IntelliJ, Pycharm) is that they look like a space craft dashboard and that unwarranted resources consumption and the unnecessary icons. You did not try Wing IDE? It looks less li

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Callum Robinson
When i check the code it comes up with invalid syntax and my writing line gets re directed here def is_same(target, number: if target == number: result="win" elif target > number: result="low" else: result="high" return result --

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Erik
On 03/01/17 23:56, Chris Angelico wrote: On Wed, Jan 4, 2017 at 10:49 AM, wrote: #think of a number computer_number = number.randint(1,100) What's wrong is that you aren't showing us the exception you get on this line. *Copy and paste* that exception - the whole thing. It's very helpful. I

Re: How Best to Coerce Python Objects to Integers?

2017-01-03 Thread Chris Angelico
On Wed, Jan 4, 2017 at 10:39 AM, Steve D'Aprano wrote: > The problem here is not so much the use of try...except but the *intention* > that "Anything whatsoever should be coerced to int". If you have something > like: > > left_margin = int_or_else(ftp_server) > > that's surely a programming error

Re: Hey, I'm new to python so don't judge.

2017-01-03 Thread Chris Angelico
On Wed, Jan 4, 2017 at 10:49 AM, wrote: > Im doing a new task from my teacher but i can't seem to find what is wrong > with this code. Can anyone help? > > #mynumber.py > # this game uses a home made function > import random > > #think of a number > computer_number = number.randint(1,100) What'

Re: Screwing Up looping in Generator

2017-01-03 Thread Erik
On 03/01/17 23:05, Deborah Swanson wrote: And yes, we usually used for loops for generators, unless you don't know when the generator will be exhausted. As in this case, where the number of files the generator can provide is unknown. Then we used the while True, break on StopIteration method. O

Hey, I'm new to python so don't judge.

2017-01-03 Thread cr2001
Im doing a new task from my teacher but i can't seem to find what is wrong with this code. Can anyone help? #mynumber.py # this game uses a home made function import random #think of a number computer_number = number.randint(1,100) #create the function is_same() def is_same(target, number:

Re: Screwing Up looping in Generator

2017-01-03 Thread Erik
Hi, On 03/01/17 22:14, Deborah Swanson wrote: ...you have to create the generator object first and use it to call the next function. And I really don't think you can use a generator as your range in a for loop. So I'd use a 'while True', and break out of the loop when you hit the StopIteration e

Re: How Best to Coerce Python Objects to Integers?

2017-01-03 Thread Steve D'Aprano
On Wed, 4 Jan 2017 09:47 am, Chris Angelico wrote: > On Wed, Jan 4, 2017 at 9:42 AM, Ethan Furman wrote: >> Aside from calling "except Exception" a "naked except" > > If you read the comments, you'll see that he originally had an actual > bare except clause, but then improved the code somewhat i

Re: Screwing Up looping in Generator

2017-01-03 Thread Chris Angelico
On Wed, Jan 4, 2017 at 10:05 AM, Deborah Swanson wrote: > Ok, I learned how to use generators in Python 2.7.8, which may be > different from Python 3 for generators. But I learned from MIT's online > introduction to python course, and they certainly seem to know python > well. So what is the corre

Re: Cleaning up conditionals

2017-01-03 Thread Paul Rubin
"Deborah Swanson" writes: > I'm still wondering if these 4 lines can be collapsed to one or two > lines. In the trade that's what we call a "code smell", a sign that code (even if it works) should probably be re-thought after taking a step back to understand what it is really trying to do. What

RE: Clickable hyperlinks

2017-01-03 Thread Deborah Swanson
Grant Edwards wrote, on January 03, 2017 3:13 PM > > On 2017-01-03, Deborah Swanson wrote: > > > I'm sorry, I should have said a GUI console because I > wouldn't expect > > a text-based console to produce clickable links. > > What's a "GUI console"? > > -- > Grant Edwards gran

Re: Clickable hyperlinks

2017-01-03 Thread Erik
Hi. On 03/01/17 19:46, Deborah Swanson wrote: Excel has a formula: When you start a new topic on the list, could you please write a new message rather than replying to an existing message and changing the title/subject? For those reading the list in a threaded email client, this message is

Re: Simulating int arithmetic with wrap-around

2017-01-03 Thread Paul Rubin
Steve D'Aprano writes: > Again, assume both operands are in range for an N-bit signed integer. What's > a good way to efficiently, or at least not too inefficiently, do the > calculations in Python? My first thought is towards the struct module, especially if you want to handle a bunch of such in

RE: Screwing Up looping in Generator

2017-01-03 Thread Deborah Swanson
-Original Message- From: Matt Wheeler [mailto:m...@funkyhat.org] Sent: Tuesday, January 03, 2017 1:47 PM To: pyt...@deborahswanson.net; Sayth Renshaw; python-list@python.org Subject: Re: Screwing Up looping in Generator On Tue, 3 Jan 2017 at 20:17 Deborah Swanson wrote: > What's the

Re: Clickable hyperlinks

2017-01-03 Thread Grant Edwards
On 2017-01-03, Deborah Swanson wrote: > I'm sorry, I should have said a GUI console because I wouldn't expect a > text-based console to produce clickable links. What's a "GUI console"? -- Grant Edwards grant.b.edwardsYow! I want you to MEMORIZE

Re: How Best to Coerce Python Objects to Integers?

2017-01-03 Thread Ethan Furman
On 01/03/2017 02:47 PM, Chris Angelico wrote: On Wed, Jan 4, 2017 at 9:42 AM, Ethan Furman wrote: Aside from calling "except Exception" a "naked except" If you read the comments, you'll see that he originally had an actual bare except clause, but then improved the code somewhat in response t

RE: Screwing Up looping in Generator

2017-01-03 Thread Deborah Swanson
Chris Angelico wrote, on January 03, 2017 2:31 PM > > On Wed, Jan 4, 2017 at 8:19 AM, Deborah Swanson > wrote: > > while True: > > try: > > file = files.next() > > except StopIteration: > > break > > Small side point: Try to avoid calling a generator object's > .next() method direc

Re: How Best to Coerce Python Objects to Integers?

2017-01-03 Thread Chris Angelico
On Wed, Jan 4, 2017 at 9:42 AM, Ethan Furman wrote: > Aside from calling "except Exception" a "naked except" If you read the comments, you'll see that he originally had an actual bare except clause, but then improved the code somewhat in response to a recommendation that SystemExit etc not be cau

Re: How Best to Coerce Python Objects to Integers?

2017-01-03 Thread Ethan Furman
On 01/03/2017 01:41 PM, breamore...@gmail.com wrote: Hi all, I'd suggest that this [1] is not one of the greatest articles ever written about Python exception handling. Other opinions are welcome. Aside from calling "except Exception" a "naked except" I think it's decent. He walks through

Re: How Best to Coerce Python Objects to Integers?

2017-01-03 Thread Chris Angelico
On Wed, Jan 4, 2017 at 8:41 AM, wrote: > Hi all, I'd suggest that this > http://blog.pyspoken.com/2017/01/02/how-best-to-coerce-python-objects-to-integers/ > is not one of the greatest articles ever written about Python exception > handling. Other opinions are welcome. > """ So there you hav

Re: Clickable hyperlinks

2017-01-03 Thread Tim Chase
On 2017-01-03 11:46, Deborah Swanson wrote: > Excel has a formula: > > =HYPERLINK(url,description) > > that will put a clickable link into a cell. > > Does python have an equivalent function? Probably the most common > use for it would be output to the console, similar to a print > statement, bu

Re: Screwing Up looping in Generator

2017-01-03 Thread Chris Angelico
On Wed, Jan 4, 2017 at 8:19 AM, Deborah Swanson wrote: > while True: > try: > file = files.next() > except StopIteration: > break Small side point: Try to avoid calling a generator object's .next() method directly. Normally, when you _do_ want to do this, you should be calling next(fi

RE: Screwing Up looping in Generator

2017-01-03 Thread Deborah Swanson
Terry Reedy > > On 1/3/2017 3:53 PM, Deborah Swanson wrote: > > >> I think you're expecting > >> > >>for file in rootobs > >> > >> to get the next yield for you from rootobs, but unless someone > >> corrects me, I don't think you can expect a 'for' statement to do > >> that. You need to hav

How Best to Coerce Python Objects to Integers?

2017-01-03 Thread breamoreboy
Hi all, I'd suggest that this http://blog.pyspoken.com/2017/01/02/how-best-to-coerce-python-objects-to-integers/ is not one of the greatest articles ever written about Python exception handling. Other opinions are welcome. Kindest regards. Mark Lawrence. -- https://mail.python.org/mailman/li

Re: Screwing Up looping in Generator

2017-01-03 Thread Terry Reedy
On 1/3/2017 3:53 PM, Deborah Swanson wrote: I think you're expecting for file in rootobs to get the next yield for you from rootobs, but unless someone corrects me, I don't think you can expect a 'for' statement to do that. You need to have a 'next' statement inside your for loop to ge

Re: Screwing Up looping in Generator

2017-01-03 Thread Matt Wheeler
On Tue, 3 Jan 2017 at 21:46 Matt Wheeler wrote: > range() is not part of the for syntax at all, it's completely separate, it > simply returns an iterator which the for loop can use, like any other. > *iterable -- -- Matt Wheeler http://funkyh.at -- https://mail.python.org/mailman/listinfo/pyt

Re: pip install -r requirements.txt fails with Python 3.6 on Windows 10

2017-01-03 Thread Terry Reedy
On 1/3/2017 3:07 PM, Uri Even-Chen wrote: What are the reasons to upgrade Python to 3.6? The same as for any new version: New features -- see What's New in 3.6. New bug fixes. New performance improvements. Reasons against: The effort to make sure all dependencies are available for 3.6* Possib

RE: Re: Clickable hyperlinks

2017-01-03 Thread Dan Strohl via Python-list
Keeping mind how this all works... Python is providing the data, the console/terminal/app handles how that data is displayed. There is no specification for text output to be hyperlinked (that I know about at least), so while some apps may handle specific coding to tell them that "this text s

Re: Screwing Up looping in Generator

2017-01-03 Thread Matt Wheeler
On Tue, 3 Jan 2017 at 20:17 Deborah Swanson wrote: > > What's the code for your generator? And I don't see where you > > call 'next'. > > I think you're expecting > > for file in rootobs > > to get the next yield for you from rootobs, but unless someone corrects > me, I don't think you ca

RE: Clickable hyperlinks

2017-01-03 Thread Dan Strohl via Python-list
The best bet (unless you know that you are outputting to a specific place, like html or excel) is to always include the "https://"; or "http://"; since most of the consoles / terminals that support clickable links are parsing them based on "seeing" the initial "http://";. If your output just lo

RE: Re: Clickable hyperlinks

2017-01-03 Thread Deborah Swanson
Devin Jeanpierre wrote, on January 03, 2017 12:57 PM >Sadly, no. :( Consoles (and stdout) are just text, not hypertext. The way to >make an URL clickable is to use a terminal that makes URLs clickable, and >print the URL: > > >print("%s: %s" % (description, url)) > > > > >-- Devin I'm sorry,

RE: Screwing Up looping in Generator

2017-01-03 Thread Deborah Swanson
> > > Sayth Renshaw wrote, on January 03, 2017 6:54 AM > > > > > > > > Hi > > > > > > > > This is simple, but its getting me confused. > > > > > > > > I have a csv writer that opens a file and loops each line of the > > > > file for each file and then closes, writing one file. > > > > > > > >

Re: pip install -r requirements.txt fails with Python 3.6 on Windows 10

2017-01-03 Thread breamoreboy
On Tuesday, January 3, 2017 at 8:08:37 PM UTC, Uri Even-Chen wrote: > Thank you, I'll consider to update our requirements to latest versions of > all packages. Last time I checked in 22th December 2016 and all our > requirements were the latest versions. In the meantime we can keep using > Python 3

Re: Clickable hyperlinks

2017-01-03 Thread Devin Jeanpierre
Sadly, no. :( Consoles (and stdout) are just text, not hypertext. The way to make an URL clickable is to use a terminal that makes URLs clickable, and print the URL: print("%s: %s" % (description, url)) -- Devin On Tue, Jan 3, 2017 at 11:46 AM, Deborah Swanson wrote: > Excel has a formula: >

RE: Screwing Up looping in Generator

2017-01-03 Thread Deborah Swanson
> > Sayth Renshaw wrote, on January 03, 2017 6:54 AM > > > > > > Hi > > > > > > This is simple, but its getting me confused. > > > > > > I have a csv writer that opens a file and loops each line of the > > > file for each file and then closes, writing one file. > > > > > > I want to alter the

Clickable hyperlinks

2017-01-03 Thread Deborah Swanson
Excel has a formula: =HYPERLINK(url,description) that will put a clickable link into a cell. Does python have an equivalent function? Probably the most common use for it would be output to the console, similar to a print statement, but clickable. -- https://mail.python.org/mailman/listinfo/pyt

RE: Screwing Up looping in Generator

2017-01-03 Thread Deborah Swanson
> Sayth Renshaw wrote, on January 03, 2017 6:54 AM > > > > Hi > > > > This is simple, but its getting me confused. > > > > I have a csv writer that opens a file and loops each line of > > the file for each file and then closes, writing one file. > > > > I want to alter the behaviour to be a wri

Re: pip install -r requirements.txt fails with Python 3.6 on Windows 10

2017-01-03 Thread Uri Even-Chen
Thank you, I'll consider to update our requirements to latest versions of all packages. Last time I checked in 22th December 2016 and all our requirements were the latest versions. In the meantime we can keep using Python 3.5. By the way, Travis CI tests passed with the same requirements and Python

RE: Screwing Up looping in Generator

2017-01-03 Thread Deborah Swanson
Sayth Renshaw wrote, on January 03, 2017 6:54 AM > > Hi > > This is simple, but its getting me confused. > > I have a csv writer that opens a file and loops each line of > the file for each file and then closes, writing one file. > > I want to alter the behaviour to be a written file for each

RE: Numpy error

2017-01-03 Thread Deborah Swanson
> ImportError: > /home/conrado/Canopy/appdata/canopy-1.5.5.3123.rh5-x86_64/lib/ > libgfortran.so.3: > version `GFORTRAN_1.4' not found (required by /lib64/liblapack.so.3) Looks like you need to install the 'GFORTRAN_1.4' plugin into Canopy. I don't know where you'll find it, but Canopy's main we

Re: Choosing a Python IDE. what is your Pythonish recommendation? I do not know what to choose.

2017-01-03 Thread Tim Johnson
* Antonio Caminero Garcia [170102 20:56]: > Guys really thank you for your answers. Basically now I am more > emphasizing in learning in depth a tool and get stick to it so I > can get a fast workflow. Eventually I will learn Vim and its > python developing setup, I know people who have been progr

  1   2   >