A Story About Python And C.


Let's talk a little about Python and C

A little back story

So I was asked "what's the difference between python and C?" and I was like what?? I actually do not know!!! Then i did a little research and... let's find out what I learnt.

What is a compiled and an interpreted language??

Compiled Language Compiled languages are converted directly into machine code that the processor can execute. As a result, they tend to be faster and more efficient to execute than interpreted languages. They also give the developer more control over hardware aspects like CPU usage.

Interpreted Language This runs through a program line by line and execute each command.

Static Typing Static type checks are performed without running the program. This is done as your program is compiled. The type of variable is not allowed to change over it's lifetime.

Dynamic Typing Python is a dynamically typed language. This means that the Python interpreter does type checking only as code runs, and the type of a variable is allowed to change over its lifetime.

Weakly typed languages make conversions between unrelated types implicitly; whereas, strongly typed languages don’t allow implicit conversions between unrelated types.

According to Fedora Packaging Python packages have different requirements from C let's take a quick look:

Python packages

Every package that uses Python (at runtime and/or build time) and/or installs Python modules MUST explicitly include BuildRequires: python3-devel in its .spec file, even if Python is not actually invoked during build time.

Mandatory macros

The following macros MUST be used where applicable.

The expansions in parentheses are provided only as reference/examples.

The macros are defined for you in all supported Fedora and EPEL versions.

%{python3} (/usr/bin/python3): The Python interpreter. For example, this macro should be used for invoking Python from a spec file script, passed to configure scripts to select a Python executable, or used as %{python3} -m pip to run a Python-based tool.

If the packaged software invokes Python at run time (as opposed to running Python to build/test it), it might be necessary to pass flags to %{python3} to isolate it from user-installed packages. See Shebangs for details.

%{python3_version} (e.g. 3.9, 3.10): Version of the Python interpreter.

%{python3_version_nodots} (e.g. 39, 310): Version of the Python interpreter without the dot.

%{python3_sitelib} (e.g. /usr/lib/python3.9/site-packages): Where pure-Python modules are installed.

%{python3_sitearch} (e.g. /usr/lib64/python3.9/site-packages): Where Python extension modules (native code, e.g. compiled from C) are installed.

Packages MUST include the source file (.py) AND the bytecode cache (.pyc) for each pure-Python importable module. The source files MUST be included in the same package as the bytecode cache.

Each Python package MUST include Package Distribution Metadata conforming to PyPA specifications (specifically, Recording installed distributons).

Packages MUST NOT own shared directories owned by Python itself, such as the top-level pycache directories (%{python3_sitelib}/pycache, %{python3_sitearch}/pycache). Read more


I haven't had much experience in building C packages so far but; If your application is a C or C++ application you must list a BuildRequires against gcc, gcc-c++ or clang. Those packages will include everything that is required to build a standards conforming C or C++ application.

Other languages Fedora packages uses for packaging are: