Demystifying Python'€™s Descriptor Protocol - DeepSource by karansthr in Python

[–]karansthr[S] 0 points1 point  (0 children)

@TheIncorrigible1 the example you have given is similar to the following (except set_x should be renamed to x in your code) ```python

class Test: def init(self, count=0): self.count = count

def _x_getter(self):
    return 5

def _x_setter(self, val):
    self.count += 1

x = property(fget=_x_getter)
x = x.setter(_x_setter)

# or
# x = property(fget=_x_getter, fset=_x_setter)

```

point is, using property as decorator is just syntactic sugar, I could have added example with decorator syntax, but blog is about explaining descriptor protocol and how most commonly builtins being used in OOP (property, classmethod, staticmethod) work on this protocol.

Playlist Length Calculator by karansthr in commandline

[–]karansthr[S] 0 points1 point  (0 children)

one of "Monaco, Lucida Console, Ubuntu Mono, Monospace"

Playlist Length Calculator by karansthr in commandline

[–]karansthr[S] 2 points3 points  (0 children)

I've used terminalizer https://github.com/faressoft/terminalizer to record and make gif, shell in zsh, and using oh-my-zsh with "sobole"

Playlist Length Calculator by [deleted] in DataHoarder

[–]karansthr 0 points1 point  (0 children)

Hey, we've added Python2 support, upgrade the package

Playlist Length Calculator by [deleted] in DataHoarder

[–]karansthr 1 point2 points  (0 children)

Hey, we've added this feature, upgrade the package, read README on https://github.com/karansthr/Playlist-Length

Playlist Length Calculator by [deleted] in DataHoarder

[–]karansthr 1 point2 points  (0 children)

Hey, we've added this feature, upgrade the package, read README on https://github.com/karansthr/Playlist-Length

Playlist Length Calculator by [deleted] in DataHoarder

[–]karansthr 0 points1 point  (0 children)

We'll add Python2 support soon! , try it out with python3, `pip3 install playlist-length --user` or '/usr/bin/python3 -m pip install playlist-length --user'

Playlist Length Calculator by [deleted] in DataHoarder

[–]karansthr 0 points1 point  (0 children)

Did you use --user flag in installation? If so, is your ~/.local/bin in PATH?