IT Arch (Posts about featured)https://rmariano.euenTue, 31 Dec 2019 18:06:52 GMTNikola (getnikola.com)http://blogs.law.harvard.edu/tech/rssDescriptors & Decoratorshttps://rmariano.github.io/itarch/posts/descriptors-decorators/Mariano Anaya<div><p>De­scrip­tors are an amaz­ing tool to have in our tool­box, as they come in handy
in many op­por­tu­ni­ties.</p>
<p>Prob­a­bly the best thing about de­scrip­tors, is that they can im­prove oth­er
­so­lu­tion­s. Let's see how we can write bet­ter dec­o­ra­tors, by us­ing de­scrip­tors.</p>
<p><a href="https://rmariano.github.io/itarch/posts/descriptors-decorators/">Read more…</a> (5 min remaining to read)</p></div>decoratorsdescriptorsfeaturedpythonhttps://rmariano.github.io/itarch/posts/descriptors-decorators/Sun, 21 May 2017 15:22:05 GMTTypes of Descriptorshttps://rmariano.github.io/itarch/posts/types-of-descriptors/Mariano Anaya<div><p>Re­sum­ing from where we left of­f, on the pre­vi­ous post, on which we took
<a class="reference external" href="https://rmariano.github.io/itarch/posts/a-first-look-at-descriptors/">A first look at de­scrip­tors</a>, it's time to ex­plore their dif­fer­ent type­s
and how they work in­ter­nal­ly.</p>
<p>In Python, almost everything is represented with a dictionary. Objects are
dictionaries. Classes are objects, hence they also are contained into a
dictionary. This is denoted by the <code>__dict__</code> attribute that objects
have.</p>
<p>There are two types of descriptors: data descriptors and non-data ones. If a
descriptor implements both <a class="footnote-reference brackets" href="https://rmariano.github.io/itarch/posts/types-of-descriptors/#id6" id="id1">1</a> <code>__get__()</code> and <code>__set__()</code>, it's
called a <em>data descriptor</em>; otherwise is a <em>non-data descriptor</em>.</p>
<p><a href="https://rmariano.github.io/itarch/posts/types-of-descriptors/">Read more…</a> (7 min remaining to read)</p></div>descriptorsfeaturedpythonhttps://rmariano.github.io/itarch/posts/types-of-descriptors/Sun, 14 May 2017 10:55:31 GMTA first look at descriptorshttps://rmariano.github.io/itarch/posts/a-first-look-at-descriptors/Mariano Anaya<div><p>De­scrip­tors are one of the most pow­er­ful fea­tures of Python. The rea­son why
they're so pow­er­ful is be­cause they en­able us to con­trol the core op­er­a­tions
(get, set, delete) <a class="footnote-reference brackets" href="https://rmariano.github.io/itarch/posts/a-first-look-at-descriptors/#id5" id="id1">1</a>, of an at­tribute in a giv­en ob­jec­t, so that we can hook
a par­tic­u­lar code, con­trolled by us, in or­der to mod­i­fy, change, or ex­tend the
o­rig­i­nal op­er­a­tion.</p>
<p><a href="https://rmariano.github.io/itarch/posts/a-first-look-at-descriptors/">Read more…</a> (8 min remaining to read)</p></div>descriptorsfeaturedpythonhttps://rmariano.github.io/itarch/posts/a-first-look-at-descriptors/Sat, 06 May 2017 13:13:48 GMT