# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# ### Lexcial
# - As its name, the Python program <small>(file)</small> was "splited" into *words*.
# - Formally, the sentence is that using **parser** breaks a file into *a stream of tokens*, XD.
#
# ### the *Token*
# - Just a bunch of const vals, and the [stdlib - pylangservice](https://docs.python.org/3.7/library/language.html)
# - Source code: [```token.py```](https://github.com/python/cpython/blob/3.7/Lib/token.py), [```Token.h```](https://github.com/python/cpython/blob/3.7/Include/token.h)
# - Do check the [stdlib](https://docs.python.org/3.7/library/language.html) material!

# ### Indentation   
#
# Check this 
#
# ```python
# def perm(l):
#         # This is a LEGIT function!
#         # Not very nice looking, it works though. XD.
#     if len(l) <= 1:
#                   return [l]
#     r = []
#     for i in range(len(l)):
#              s = l[:i] + l[i+1:]
#              p = perm(s)
#              for x in p:
#               r.append(l[i:i+1] + x)
#     return r
# ```
#
# This one will **NOT** work
#
# ```python
#  def perm(l):                       # error: first line indented
# for i in range(len(l)):             # error: not indented
#     s = l[:i] + l[i+1:]
#         p = perm(l[:i] + l[i+1:])   # error: unexpected indent
#         for x in p:
#                 r.append(l[i:i+1] + x)
#             return r                # error: inconsistent dedent
# ```

# ### Line joining
#
# Explicit
#
# ```python
# if 1 == 1 \
#     and 2 == 2 \
#     and 3 == 3 \
#     and 1 + 2 + 3 == 6:
#     print('You cannot add comments in here')      
# ```

# Implicit
#
# ```python
# num = {
#     (1, 2, 3),  # ah
#     [4, 5, 6],  # ya 
#     {7, 8, 9}   # weee
# }
# ```

# ### the *underscore* identifiers
#
# if u're using ```from module import *```
#
# ```python
# if 'this is the file being imported':
#     a  = 1  # totally fine
#     _b = 2  # nah, u won't get this one
# ```
#
# the ```__*```
# - kinda the same but inside the *class*
# - plus the 'a bit' different mechanics
#
# ah, about the ```__*__```
# - see more at [here](https://docs.python.org/3/reference/datamodel.html#specialnames), and [here](https://rszalski.github.io/magicmethods/)
#
#

# ### String stuff

# 0x01 - special cases

# +
isinstance(b'A', bytes)
isinstance('A' , str)

"\'"   # '
r"\'"  # \'
# -

# 0x02 - concat

print(
    "what"  # haha
    " the"  # comments here!
    "fuck"  # ya still able to add '+'
)

# 0x03 - ```f'{}'```

# +
# Just the expr u put into the `eval` (with restrictions)

f'{1 + 2}'
f'{1 and 0}'

greeting = 'hello'

f'{greeting}'
f'{greeting!r}'
f'{greeting:>15}'

# nasty nesting, XD
f'The {greeting!r} got {float(len(greeting)):10.{len(greeting)}} alphabets.'

# +
import datetime

today = datetime.datetime.today()

print(
    f'{today:%B %d, %Y}'
)
# -

# ### Number stuff

# 0x01 - groupin' 

# +
# cool, huh?

100_0000_0000  # yes
0xdead_BEEF    # u sure want this?

# yes, here comes the Mr. binary!
0b1111_1111

# and our float num
3.14159_26535

# and our imaginary num
6.666_888j 

StarcoderdataJupyterScriptsDedupFiltered