fosstodon.org is one of the many independent Mastodon servers you can use to participate in the fediverse.
Fosstodon is an invite only Mastodon instance that is open to those who are interested in technology; particularly free & open source software. If you wish to join, contact us for an invite.

Administered by:

Server stats:

8.7K
active users

#dundermethods

0 posts0 participants0 posts today
Jeffrey04<p><a href="https://kitfucoda.medium.com/the-versatility-of-call-a-python-developers-secret-weapon-a6bff776971a" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">kitfucoda.medium.com/the-versa</span><span class="invisible">tility-of-call-a-python-developers-secret-weapon-a6bff776971a</span></a></p><p>Python's __call__ dunder offers a closure alternative. It manages state in a class, callable like a function, opening new code structuring possibilities.</p><p>In complex scenarios, __call__ enhances readability and maintainability. Encapsulating logic and data promotes cleaner code, improving clarity and debugging.</p><p>For pre-filling arguments, consider __call__ over functools.partial, especially with methods needing internal state. It creates a state-holding object for robust operations.</p><p>This is beneficial in large projects with complex logic. Using __call__ improves organization and maintainability, leading to efficient development.</p><p><a href="https://hachyderm.io/tags/Python" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Python</span></a> <a href="https://hachyderm.io/tags/Programming" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Programming</span></a> <a href="https://hachyderm.io/tags/SoftwareDevelopment" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SoftwareDevelopment</span></a> <a href="https://hachyderm.io/tags/Coding" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Coding</span></a> <a href="https://hachyderm.io/tags/DunderMethods" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>DunderMethods</span></a> <a href="https://hachyderm.io/tags/ObjectOrientedProgramming" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ObjectOrientedProgramming</span></a> <a href="https://hachyderm.io/tags/FunctionalProgramming" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>FunctionalProgramming</span></a> <a href="https://hachyderm.io/tags/CodeReadability" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>CodeReadability</span></a> <a href="https://hachyderm.io/tags/SoftwareEngineering" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SoftwareEngineering</span></a> <a href="https://hachyderm.io/tags/OpenToWork" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>OpenToWork</span></a> <a href="https://hachyderm.io/tags/getfedihired" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>getfedihired</span></a></p>
Cyrille Pontvieux<p><span class="h-card" translate="no"><a href="https://mastodon.social/@jjasghar" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>jjasghar</span></a></span> lol ! Took me seconds to realize the difference! Does some <a href="https://piaille.fr/tags/python" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>python</span></a> tool may have warn you about unknown <a href="https://piaille.fr/tags/dundermethods" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>dundermethods</span></a> ?</p>
Pybites<p>New article:</p><p>⚠️Why you should avoid import * in Python 🐍<br /><a href="https://pybit.es/articles/why-you-should-avoid-import-in-python/" target="_blank" rel="nofollow noopener" translate="no"><span class="invisible">https://</span><span class="ellipsis">pybit.es/articles/why-you-shou</span><span class="invisible">ld-avoid-import-in-python/</span></a></p><p>Covering:<br />- Why modules are great and namespacing explained<br />- Why import * is a problem<br />- A practical example where a function gets overriden<br />- The recommended way to do imports<br />- What PEP8 has to say about this<br />- Protection workaround, use __all__ to define your module&#39;s public interface</p><p><a href="https://fosstodon.org/tags/python" class="mention hashtag" rel="tag">#<span>python</span></a> <a href="https://fosstodon.org/tags/pythonprogramming" class="mention hashtag" rel="tag">#<span>pythonprogramming</span></a> <a href="https://fosstodon.org/tags/modules" class="mention hashtag" rel="tag">#<span>modules</span></a> <a href="https://fosstodon.org/tags/encapsulation" class="mention hashtag" rel="tag">#<span>encapsulation</span></a> <a href="https://fosstodon.org/tags/namespacing" class="mention hashtag" rel="tag">#<span>namespacing</span></a> <a href="https://fosstodon.org/tags/zenofpython" class="mention hashtag" rel="tag">#<span>zenofpython</span></a> <a href="https://fosstodon.org/tags/bestpractices" class="mention hashtag" rel="tag">#<span>bestpractices</span></a> <a href="https://fosstodon.org/tags/pitfalls" class="mention hashtag" rel="tag">#<span>pitfalls</span></a> <a href="https://fosstodon.org/tags/imports" class="mention hashtag" rel="tag">#<span>imports</span></a> <a href="https://fosstodon.org/tags/dundermethods" class="mention hashtag" rel="tag">#<span>dundermethods</span></a></p>