<jupyter_start><jupyter_text>Named tuple<jupyter_code>sp = (23.0, 46.0)  # find lat > long
lat, long = sp
lat
long
from collections import namedtuple

Coord = namedtuple('Coord', ['lat', 'long'])
sp = Coord(23.0, 46.0)
sp
sp.lat
sp[0]
lat, long = sp
lat
sp.lat = 4
sp = dict(lat=23, long=46)
sp<jupyter_output><empty_output><jupyter_text>Data classes<jupyter_code>from dataclasses import dataclass

@dataclass
class Coordinate:
    lat: float
    long: float
sp = Coordinate(23, 46)
sp
xy = Coordinate('x', 'y')
xy<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13970588235294118, 'fraction_numerical': 0.04044117647058824, 'mean_word_length': 5.566265060240964, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '511332', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 235, 'n_tokens_neox': 221, 'n_words': 55, 'path': 'experiments/02-classes.ipynb', 'repo_name': 'kangli-bionic/pyob', 'size': '544'}