RE: New to this language

Hi I am new to this language and I have a few questions regarding this language:

  • Can this language be used as a system’s programming language? Can I use this to write an OS?
  • Is GC enabled by default or not?
  • If I do chose to chose to have GC disabled, how else would member be managed? DO we fully manage it manually or is there something similar to the ownership model present in Rust?
  • If I used the compiled langauge version of Python instead of the interpreted version of Python, would it generate just as efficient code as C/C++ and/or Rust?
1 Like

It is not practical to write a full server or desktop OS in Python.

However there are Python interpreters which can run without an OS on
microcontrollers and similar tiny machines, such as MicroPython:

Different Python interpreters use different garbage collection, but in
general, no, you cannot manage memory manually. The CPython interpreter
uses two garbage collection tactics, a reference counter which is always
on, and a second GC for detecting cycles, which can be disabled.

Most Python interpreters include a compiler which pre-compiles the
source code to byte-code before running it. The byte-code runs in a
virtual machine:

  • The CPython interpreter generates byte-code for its own unnamed
    virtual machine;

  • IronPython generates byte-code for the .Net CLR;

  • Jython generates byte-code for the Java JVM;

  • PyPy includes a powerful Just In Time compiler which can, for
    carefully constructed examples, generate code as efficient or more so
    than C.

Nuitka translates Python code to C calls, which can then be compiled:

The line between system programming languages and application
programming languages is a blurry one, but usually Python is considered
to be an application or scripting language, not a system language.

Python is mostly used as:

  • an application and scripting language;

  • a glue language, for gluing together libraries written in C or
    Fortran; this includes calling numeric libraries;

  • a rapid application development language for prototyping;

etc. See the FAQs for further information, starting here:

1 Like

Hey mate, thank you for your response :slight_smile:

So in regards to this, does this also use GC?

And same with this as well?

All Python implementations use some form of garbage collection, PyPy
and Nuitka included.

The default garbage collector for PyPy is documented here:

Older versions documentation discussed alternative GCs:

I haven’t found documentation for Nuitka’s GC, but I didn’t look very
hard.

1 Like