Whole-known-network
guy on facebook marketplace called me a jew. that's a new one
<p><span class="h-card" translate="no"><a href="https://mastodon.social/@gamingonlinux" class="u-url mention">@<span>gamingonlinux</span></a></span> you have my ear, citizen.</p>
<p><span class="h-card" translate="no"><a href="https://functional.cafe/@loke" class="u-url mention">@<span>loke</span></a></span> More info on this particular presentation here: <a href="https://aplmooc.fi/" target="_blank" rel="nofollow noopener noreferrer" translate="no"><span class="invisible">https://</span><span class="">aplmooc.fi/</span><span class="invisible"></span></a></p>
<p><span class="h-card" translate="no"><a href="https://mastodon.social/@dabeaz" class="u-url mention">@<span>dabeaz</span></a></span> </p><p>Aren't you already crossing some aesth-ethical lines forcing stuff into a one-liner already? 🐍</p>
<p><span class="h-card" translate="no"><a href="https://mastodon.social/@dabeaz" class="u-url mention">@<span>dabeaz</span></a></span> Also,</p><p>class DC:<br /> def __init_subclass__(cls, **kwargs):<br /> cls = dataclass(cls)<br /> sys.modules[cls.__module__].__dict__[cls.__name__] = cls</p><p>class Point(DC): x: int; y: int</p>
<p><span class="h-card" translate="no"><a href="https://mastodon.social/@dabeaz" class="u-url mention">@<span>dabeaz</span></a></span> Yeah, definitely looks hackey. _Does_ have type hints these days, though.</p>
<p><span class="h-card" translate="no"><a href="https://mastodon.social/@tekknolagi" class="u-url mention">@<span>tekknolagi</span></a></span> Ew is right.</p>
<p><span class="h-card" translate="no"><a href="https://mastodon.social/@dabeaz" class="u-url mention">@<span>dabeaz</span></a></span> I suppose you also would like a built-in way for that? Otherwise you could e.g. write this function:</p><p>def dtcls(name, **args):<br /> from dataclasses import dataclass<br /> return dataclass(type(name, (), dict(__annotations__=args)))</p><p>Point2 = dtcls('Point2', x=int, y=int)</p><p>print(Point2(1, 2))</p>
<p><span class="h-card" translate="no"><a href="https://mastodon.social/@dabeaz" class="u-url mention">@<span>dabeaz</span></a></span> If you are willing to have support code,</p><p>def d(name, anns):<br /> ty = dataclass(type(name, (), {'__annotations__': anns, **anns}))<br /> globals()[name] = ty<br /> return ty</p><p>d('Point', {'x': int, 'y': int})</p><p>but ew...</p>