MCPcopy Index your code
hub / github.com/python/cpython / _field_assign

Function _field_assign

Lib/dataclasses.py:579–588  ·  view source on GitHub ↗
(frozen, name, value, self_name)

Source from the content-addressed store, hash-verified

577
578
579def _field_assign(frozen, name, value, self_name):
580 # If we're a frozen class, then assign to our fields in __init__
581 # via object.__setattr__. Otherwise, just use a simple
582 # assignment.
583 #
584 # self_name is what "self" is called in this function: don't
585 # hard-code "self", since that might be a field name.
586 if frozen:
587 return f' __dataclass_builtins_object__.__setattr__({self_name},{name!r},{value})'
588 return f' {self_name}.{name}={value}'
589
590
591def _field_init(f, frozen, globals, self_name, slots):

Callers 1

_field_initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…