On 12/15/2022 11:34 PM, MRAB wrote:
On 2022-12-15 22:49, Gronicus@SGA.Ninja wrote:
Yes, it works like a charm. On the tupility of it all.
Special thanks for the explanation too…..
(Originally asked but I found the errors. All is working)
Now that the code no longer produces the errors, I see
On 2022-12-15 22:49, Gronicus@SGA.Ninja wrote:
Yes, it works like a charm. On the tupility of it all.
Special thanks for the explanation too…..
(Originally asked but I found the errors. All is working)
Now that the code no longer produces the errors, I see that the year and month
not incl
Oops,
"items = dstr[1:-2].split(',')"
should have read
"items = dstr[1:-1].split(',')".
On 12/15/2022 1:56 PM, Thomas Passin wrote:
It's hard to be sure from what you have offered, but I suspect that you
are taking the string "(2022, 12, 13, 5, 3, 30)" from the file and
using it as is. Wh
Yes, it works like a charm. On the tupility of it all.
Special thanks for the explanation too…..
(Originally asked but I found the errors. All is working)
Now that the code no longer produces the errors, I see that the year and month
not included in the calculation? How do I fix this?
Fro
Not sure what you mean:
x = datetime.datetime(year=2018,month=12,day=4,hour=10)
y = datetime.datetime(year=2022,month=12,day=13,hour=5)
print(x -y)
-1470 days, 5:00:00
If you want to display years, (x-y).days /365
From: Python-list on
behalf of Gronicus@SGA.Ninja
Date: Thursday, December
Yes, it works like a charm. On the tupility of it all.
Special thanks for the explanation too…..
Now that the code no longer produces the errors, I see that the year and month
not included in the calculation? How do I fix this?
From: anthony.flury
Sent: Thursday, December 15, 2022 1:47 P
On 2022-12-15, MRAB wrote:
> A problem with having a single return is that it can lead to excessive
> indentation:
>
> if test_1:
> ...
>
> if test_2:
> ...
>
> if test_3:
> ...
>
> return
I sometimes have to work on code li
On 12/15/2022 3:58 AM, Chris Green wrote:
Thomas Passin wrote:
I personally tend to use
if test: return
even inside larger blocks.
I always try to avoid multiple returns from functions/methods, as soon
as things get complex it's all to easy to miss clean-up etc.
"No mul
There is a Python adapter for SQLITE called "APSW". It has a config()
function. I looked in the codebase and it defines the two configuration
constants needed to turn off the double quote behavior (see
https://sqlite.org/quirks.html). These constants are
SQLITE_DBCONFIG_DQS_DDL and SQLITE_DB
It's hard to be sure from what you have offered, but I suspect that you
are taking the string "(2022, 12, 13, 5, 3, 30)" from the file and
using it as is. When you feed that in as a starred argument, the string
gets treated as a sequence where each item is a character in the string.
Your ex
On 2022-12-15 19:05, avi.e.gr...@gmail.com wrote:
Multiple returns is not always a problem as it depends on the nature of a
task whether it has complex enough cases.
I have seen code that instead sets Boolean variables when it is ready to
return and everything else keeps checking the variables t
On 2022-12-15 18:14, Gronicus@SGA.Ninja wrote:
So far so good , I can now use a variable in datetime.datetime but it only
works if I hard-code the time/date information. Now I want to have the code
read from a file but I get: TypeError: function takes at most 9 arguments
(26 given)
I figure that
I once saw a C function full of GOTOs which jumped to the return state at the
bottom of the functions because the programmer had learned that “multiple
returns are a bad idea.”
I totally agree multiple returns causing confusion is a symptom of poor design,
not a cause.
Required cleanup is easi
Thanks for the discussion. I’m aware that SQLite has several different options
for identifier quoting, but they’re not cross-compatible with other SQL,
whereas double quotes are (modulo this strange SQLite behavior).
Is anyone here familiar with the python sqlite3 implementation? I wonder how
h
Multiple returns is not always a problem as it depends on the nature of a
task whether it has complex enough cases.
I have seen code that instead sets Boolean variables when it is ready to
return and everything else keeps checking the variables to skip further
processing so the program then slide
Peter Otten wrote:
>
> While I think what you need is a database instead of the collection of
> csv files the way to alter namedtuples is to create a new one:
the files are coming from the web site that stores the
accounts. i already have manually created files from many
years ago with some of
r...@zedat.fu-berlin.de (Stefan Ram) writes:
>>"No multiple returns" is often found in programming guidelines.
>
> I religiously followed that when I did more C programming
> than today. Then, I read an article about how the result
> pattern makes functions measurably slower. (It should not
Thomas Passin wrote:
>I personally tend to use
>
> if test: return
>
> even inside larger blocks.
I always try to avoid multiple returns from functions/methods, as soon
as things get complex it's all to easy to miss clean-up etc.
"No multiple returns" is often found in prog
So far so good , I can now use a variable in datetime.datetime but it only
works if I hard-code the time/date information. Now I want to have the code
read from a file but I get: TypeError: function takes at most 9 arguments
(26 given)
I figure that the structure in the file is incorrect. What sho
I have a lot of NamedTuples in my codebase, and I now add new ones never. They
were a good option prior to Python 3.7 but dataclasses are much easier to work
with and are almost a drop-in substitute.
A combination of a default dictionary and a dataclass might meet your needs:
import collectio
On 14/12/2022 19:50, 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, dividends, transfers of
funds, etc.)
Assume that
On 13/12/2022 15:46, Michael F. Stemper wrote:
It's easy enough -- in fact necessary -- to handle the bottom
level of a function differently than the levels above it. What
about the case where you want to handle something differently
in the top level than in lower levels? Is there any way to tell
22 matches
Mail list logo