Peter Otten wrote:
...
> I recommend that you use a dataclass /instead/ of a namedtuple, not
> both. However, for a dataclass with the same fields in the same order as
> in your namedtuple the conversion is trivial:
>
> Create compatible namedtuple and dataclass types:
>
> >>> NTRow = namedtuple("N
On 18/12/2022 16:44, songbird wrote:
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:
from collections import namedtuple
Row = namedtuple("Row", "foo bar baz")
row = Row(1, 2, 3)
row._r
On 17/12/2022 20:45, Albert-Jan Roskam wrote:
On Dec 15, 2022 10:21, Peter Otten <__pete...@web.de> wrote:
>>> from collections import namedtuple
>>> Row = namedtuple("Row", "foo bar baz")
>>> row = Row(1, 2, 3)
>>> row._replace(bar=42)
Row(foo=1, bar=42, baz=3)
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:
>
> >>> from collections import namedtuple
> >>> Row = namedtuple("Row", "foo bar baz")
> >>> row = Row(1, 2, 3)
> >>> row._replace(bar=4
On Dec 15, 2022 10:21, Peter Otten <__pete...@web.de> wrote:
>>> from collections import namedtuple
>>> Row = namedtuple("Row", "foo bar baz")
>>> row = Row(1, 2, 3)
>>> row._replace(bar=42)
Row(foo=1, bar=42, baz=3)
Ahh, I always thought these are undocumen
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
, 2022 at 10:38 PM
To: python-list@python.org
Subject: Keeping a list of records with named fields that can be updated
*** Attention: This is an external email. Use caution responding, opening
attachments or clicking on links. ***
I'm relatively new to python but not new to programming in ge
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
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
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
10 matches
Mail list logo