Hey guys, good to see you again! First of all, it has been a great week altogether, and I’ve got a lot to discuss. So, let’s wait no more!
There’s a lot that’s happened this week, been binge watching Game Of Thrones, 😉 built a template for projects of NIT-dgp(org. maintained by students of NIT Durgapur); viz UIP.
A screenshot of the site, UIP!
Check out the link below 👇🏻 to look at my work. 😊
Projects | UIP
A cross-platform desktop application for downloading and scheduling wallpapers.nit-dgp.github.io
And last but not the least, we’ve all witnessed the launch of PSLV-C33, proud to be an Indian. 😋
I was assigned work on creating a plugin based architecture for gitmate with django REST framework, thanks to @sils, ( yay… \(o.o)/ I’ve got a nice mentor), I could accomplish the assigned task with ease.
This was the proposed structure for a plugin(viz. django app).
gitmate_testplugin
├── __init__.py
├── apps.py
├── views.py
├── migrations
│ ├── 0001_initial.py
│ └── __init__.py
└── models.py
models: holds the plugin specific settings, if any.
__init__: holds the initialization scripts, if any.
views: holds the plugin specific request-responders, if any.
And so, my work continues, thanks to GSoC I’m learning quite some python stuff recently.
This one’s quite specific to python3.
Ever had a trouble unpacking dictionaries into one? Normally, we’d have to do something like this, right?
>>> a = {'one': 1, 'two': 2}
>>> b = {'three': 3, 'four': 4}
>>> x = a.copy()
>>> x.update(b)
{'one': 1, 'two': 2, 'three': 3, 'four':4}
Copying, updating, bleh….that’s a hell lot, right? Don’t worry, there’s a small quirk that was introduced in PEP448 in python3.5
>>> x = {**a, **b}
{'one': 1, 'two': 2, 'three': 3, 'four':4}
But, it has some limitations too, it doesn’t work well with generators
, at least at the moment, (hopefully a fix coming soon!).
`>>> _list = [a,b]
>>> { **item for item in _list } # This doesn't work
`SyntaxError: dict unpacking cannot be used in dict comprehension
`>>> # The workaround that I use!
>>>` {k:v for item in \_list for k,v in item.items()}
{'one': 1, 'two': 2, 'three': 3, 'four':4}
Hope these tips work for you! 😇
All the best guys, catch ya’ later! 👋🏻
Signing off !!