have #python #dataclasses predicates ?
Say I have a variable my_var
I know it contains an instance of dataclass A or an instance of dataclass B
Can I say
is_A(my_var) ?
Does setting default "list" (or a "dict" for that matter) gets easier
-- being able to assign the damn list while listing an attribute instead of via "field( defaultfactory )" & "__post_init__" --
in a #Python #dataclasses class in later versions? Currently am stuck with the version meant for python 3.6.
Re: https://hachyderm.io/@leonerd@fosstodon.org/109858794297583601
@leonerd
Not with proliferation of "#dataclasses.dataclass" ...
#python
# https://docs.python.org/3/library/dataclasses.html
from dataclasses import dataclass
@dataclass
class Thing:
attr :str
def show( it ):
print( it.attr )
some = Thing( attr = 'value' )
some.show()
I'm using a Python dataclass to store dataset metadata. This is nice because it means I control the metadata vocabulary. However, my linter complains the dataclass has too many attributes which makes me wonder if I'm going the right way.
I'm made a poll and would welcome your thoughts?
#python #dataclasses #datascience #DataMesh
Every time I write a `class` statement in Python now, I wonder about this: https://blog.glyph.im/2023/02/data-classification.html
#python #dataclasses #programming
After making a tool in #python, I came to a conclusion.. Nowadays every time I create a class I always use #dataclasses... The only exception is literally a Exception 🤯 #dev #developer
#python #dataclasses #dev #developer
Repérage dans les dataclasses Python #python #dataclasses #développement https://hashtagueule.fr/posts/reperage-dans-les-dataclasses-python
#python #dataclasses #développement