RE: Single line if statement with a continue

2022-12-14 Thread avi.e.gross
Unless someone is counting lines of code for some purpose, like number of error found per thousand lines of code, many short one-liners strike me as more readable and especially if followed by a blank line so it is a bit obvious. Consider a similar issue in many languages that use curly braces and

Re: Single line if statement with a continue

2022-12-14 Thread Chris Angelico
On Thu, 15 Dec 2022 at 16:29, Thomas Passin wrote: > > PEP-8, which is Guido's style guide and generally good to follow, does > not completely discourage single-line usage like the example. It's not > clear to me how Chris's example fits into the guidelines. > > PEP-8: > "While sometimes it’s oka

Re: Single line if statement with a continue

2022-12-14 Thread Thomas Passin
PEP-8, which is Guido's style guide and generally good to follow, does not completely discourage single-line usage like the example. It's not clear to me how Chris's example fits into the guidelines. PEP-8: "While sometimes it’s okay to put an if/for/while with a small body on the same line,

Re: Single line if statement with a continue

2022-12-14 Thread dn
On 15/12/2022 07.53, Aaron P wrote: I occasionally run across something like: for idx, thing in enumerate(things): if idx == 103: continue do_something_with(thing) It seems more succinct and cleaner to use: if idx == 103: continue. Of course this would be considered an anti

Re: Single line if statement with a continue

2022-12-14 Thread Chris Angelico
On Thu, 15 Dec 2022 at 14:41, Aaron P wrote: > > I occasionally run across something like: > > for idx, thing in enumerate(things): > if idx == 103: > continue > do_something_with(thing) > > It seems more succinct and cleaner to use: > > if idx == 103: continue. > > Of course this

Re: Keeping a list of records with named fields that can be updated

2022-12-14 Thread Thomas Passin
Dictionaries and sets are your friends here. On 12/14/2022 1:50 PM, songbird wrote: I'm relatively new to python but not new to programming in general. The program domain is accounting and keeping track of stock trades and other related information (dates, cash accounts, interest, divid

Re: How to get the needed version of a dependency

2022-12-14 Thread Cecil Westerhof via Python-list
DFS writes: > On 12/14/2022 3:55 AM, Cecil Westerhof wrote: >> If I want to know the dependencies for requests I use: >> pip show requests >> And one of the lines I get is: >> Requires: certifi, charset-normalizer, idna, urllib3 >> But I want (in this case) to know with version of chars

Single line if statement with a continue

2022-12-14 Thread Aaron P
I occasionally run across something like: for idx, thing in enumerate(things): if idx == 103: continue do_something_with(thing) It seems more succinct and cleaner to use: if idx == 103: continue. Of course this would be considered an anti-pattern, and Flake8 will complain. Any

Keeping a list of records with named fields that can be updated

2022-12-14 Thread songbird
I'm relatively new to python but not new to programming in general. The program domain is accounting and keeping track of stock trades and other related information (dates, cash accounts, interest, dividends, transfers of funds, etc.) Assume that all data is CSV format. There are multi

Re: Subtracting dates to get hours and minutes

2022-12-14 Thread Thomas Passin
On 12/14/2022 12:55 AM, Gronicus@SGA.Ninja wrote: I realized it had something to do with tupilation The simple fix is to add the * into the original code. Startt = datetime.datetime(*Startt) I am not sure what "dts1 == Startt # True" does It demonstrates that the version with the "*" give

Re: How to get the needed version of a dependency

2022-12-14 Thread DFS
On 12/14/2022 3:55 AM, Cecil Westerhof wrote: If I want to know the dependencies for requests I use: pip show requests And one of the lines I get is: Requires: certifi, charset-normalizer, idna, urllib3 But I want (in this case) to know with version of charset-normalizer requests need

How to get the needed version of a dependency

2022-12-14 Thread Cecil Westerhof via Python-list
If I want to know the dependencies for requests I use: pip show requests And one of the lines I get is: Requires: certifi, charset-normalizer, idna, urllib3 But I want (in this case) to know with version of charset-normalizer requests needs. How do I get that? -- Cecil Westerhof Senior