Get Mystery Box with random crypto!

Nikita Shpilevoy | About IT, AI, etc

Logo of telegram channel nickshpil — Nikita Shpilevoy | About IT, AI, etc N
Logo of telegram channel nickshpil — Nikita Shpilevoy | About IT, AI, etc
Channel address: @nickshpil
Categories: Technologies
Language: English
Subscribers: 342
Description from channel

Software Development, Programming languages comparison, database benchmarks, programming books and other technical topics.
Feedback: contact@nickshpil.com

Ratings & Reviews

5.00

1 reviews

Reviews can be left only by registered users. All reviews are moderated by admins.

5 stars

1

4 stars

0

3 stars

0

2 stars

0

1 stars

0


F
Father

The channel is just started but it looks cool. Subscribed.


The latest Messages

2022-07-12 18:32:34 Basically, with remote work and a weaker EUR, we could well see even more US companies growing teams in Europe.

On the other hand, European companies with EUR funding will find it more expensive to hire in the US and expanding their market and engineering teams there will likely slow down.
7 views15:32
Open / Comment
2022-07-12 18:32:28
One US dollar is worth 1 EUR. The last time this was the case was 20 years ago, after the Dotcom bust ended. What impact will this have on tech? One important one for sure:

US companies hiring software engineers as remote will find hiring in Europe - and especially in Western Europe - far more affordable. Imagine hiring an experienced software engineer who worked at well-known tech companies or high-growth startups and can work at scale, for ~$90-130K/year. Well, if offering €90-130K*, you'll have plenty of candidates, and if you go higher you can find staff-level folks as well. Just a year ago, €90-130K meant $112-$162K/year - quote the difference in cost versus now!

This also means that companies that offer location-independent salaries in US dollars will see more interest from Europe, thanks to the EUR weakened. And companies that raised their funding in USD will see their hiring budgets go further in EUR.
7 views15:32
Open / Comment
2022-07-11 22:05:25 #Python tip:

Regular dicts can efficiently emulate methods exclusive to OrderedDict:

# Remove oldest
# od.popitem(0)
>>> d = dict(a=1, b=2, c=3)
>>> del d[next(iter(d))]
>>> d
{'b': 2, 'c': 3}

# Refresh position
# od.move_to_end('b')
>>> d['b'] = d.pop('b')
>>> d
{'c':3, 'b': 2}

These two methods are all you need to efficiently implement your own LRU cache variants:

# Cache miss: Store new entry and remove oldest
d[args] = func(*args)
if len(d) > maxsize:
d.popitem(0)

# Cache hit: Refresh position
d.move_to_end(args)

https://docs.python.org/3/library/collections.html#ordereddict-examples-and-recipes

Regular dicts already have d.popitem() which does the same as od.popitem(True) for OrderedDicts.

Ordered dicts have an od.move_to_end(key, 0) that moves entries to the beginning. There is no fast, clean equivalent for regular dicts.
7 views19:05
Open / Comment
2022-07-09 16:16:07 #Python factlet: Dictionary union x |= y matches x.update(y) and keeps order of x with overriding by y values and adding new key/value pairs. Like {**x, **y).

{**d1, **d2} looks uggly and ignores the types of the mappings and always returns a dict.

Python 3.10 introduced | operator for dict union:
>> a = {'x1': 1, 'x2': 2}
>> b = {'x2': 3, 'x3': 4}
>> a | b
{'x1': 1, 'x2': 3, 'x3': 4}

ChainMap is the way to resolve ordering by favoring the "deepest" dicts over the "shallowest":

>>> dict(ChainMap(dict(z=6, x=7), dict(q=1, w=2, y=3, r=4, d=5)))
{'q': 1, 'w': 2, 'z': 6, 'r': 4, 'd': 5, 'x': 7}

For example, the good use case for ChainMap is where root dict defines keys in some order you want to keep and "shallower" dict is just something you want to override root dict.

Check PEP 585 if you are interested in details and motivation of these operators.
10 views13:16
Open / Comment
2022-07-08 12:17:02 #Python factlet: The dict.popitem() method is guaranteed to remove key/value pairs in LIFO order.

>>> d = dict(red=1, green=2, blue=3)
>>> d.popitem()
('blue', 3)
>>> d.popitem()
('green', 2)
>>> d.popitem()
('red', 1)

In contrast, OrderedDict.popitem() supports both FIFO and LIFO extraction of key/value pairs.

>>> from collections import OrderedDict
>>> d = OrderedDict(red=1, green=2, blue=3)

>>> d.popitem(last=False) # FIFO
('red', 1)

>>> d.popitem() # LIFO
('blue', 3)
25 views09:17
Open / Comment
2022-07-08 02:37:25 #Python 3.11 brings
- Enhanced error location in tracebacks
- A new standard exception type (ExceptionGroup) and except* clause
- A new typing feature for annotating methods that return an instance of their class
- A new module for TOML parsing
25 views23:37
Open / Comment
2022-07-08 01:01:17 HTTP/3 benefits from the features of the UDP protocol and defines many of the new features that were in previous HTTP versions on the TCP layer. This allows to remove the limitations existing within the Internet’s infrastructure.

While HTTP/1.1 and HTTP/2 used TCP on the transport layer, HTTP/3 uses QUIC, aiming to solve one of the main problems of HTTP/2 regarding the linear progression of the downloads.
23 views22:01
Open / Comment
2022-07-08 00:14:23 #Python tip: Be beware of default_factory argument in defaultdict constructor. You have a risk of accidental dict mutation during lookups.

Example:
>>> d = defaultdict(list)
>>> print(d['x'])
[]
>>> print(d.keys())
dict_keys(['x'])

Whoops, we are created some key here.

Consider changing back to an ordinary dict. It is a very cheap operation without recomputing hash values. The only slow part is the interpreter needs to update all references.

Also, for whatever reason, lookup in dict() works a little faster than in defaultdict.
21 views21:14
Open / Comment
2022-07-08 00:05:44 TechLead Nick pinned «Hi , if you are intrigued with: Python Golang Backend Data Science Career Advice Follow me. I'm planning on using Telegram to share a lot of content, that you won't want to miss. Also feel free to connect with me in social media: https:…»
21:05
Open / Comment
2022-07-08 00:05:37 Hi , if you are intrigued with:

Python
Golang
Backend
Data Science
Career Advice

Follow me.

I'm planning on using Telegram to share a lot of content, that you won't want to miss.

Also feel free to connect with me in social media:
https://twitter.com/nickshpil
https://www.facebook.com/nickshpil
21 viewsedited  21:05
Open / Comment