Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Requests have a cake in __version__.py? [closed]

While browsing the GitHub repository for the Python Requests library, I noticed there was a strange __cake__ variable at the bottom of requests/__version__.py.

__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2017 Kenneth Reitz'
__cake__ = u'\u2728 \U0001f370 \u2728'

Searching through the code, I found that __cake__ is referenced in requests/__init__.py when importing copyright and version info.

from .__version__ import __title__, __description__, __url__, __version__
from .__version__ import __build__, __author__, __author_email__, __license__
from .__version__ import __copyright__, __cake__

My best guess is that __cake__ was added as an Easter Egg, but I'm not sure what the value u'\u2728 \U0001f370 \u2728' represents. (Possibly a Unicode string?)

Why does Requests have a __cake__ variable? What does u'\u2728 \U0001f370 \u2728' mean?

like image 583
Stevoisiak Avatar asked Apr 27 '18 15:04

Stevoisiak


People also ask

Does requests come with Python?

Requests is released under the Apache License 2.0. Requests is one of the most popular Python libraries that is not included with Python.

What is import requests in Python?

The requests module allows you to send HTTP requests using Python. The HTTP request returns a Response Object with all the response data (content, encoding, status, etc).

Is Python requests library safe?

Requests is the only Non-GMO HTTP library for Python, safe for human consumption. Warning: Recreational use of other HTTP libraries may result in dangerous side-effects, including: security vulnerabilities, verbose code, reinventing the wheel, constantly reading documentation, depression, headaches, or even death.


1 Answers

\U0001F370 is a shortcake: https://codepoints.net/U+1F370

\u2728 is sparkles: https://codepoints.net/U+2728

But that's just the "what". More interestingly is "why" it is done.

I am not familiar with python package standards, so when I look at the surrounding code as well as previous commits, and see variables like __version__, __copyright__, __author__, I assume that other variables that you introduce yourself such as __cake__ are just as valid.

However, more realistically, whether there is a technical motivation behind it, I would say it is more for branding purposes, or simply for fun. But one thing we know for sure, the cake certainly is a lie.

like image 73
MxLDevs Avatar answered Oct 11 '22 10:10

MxLDevs