Fonts for standard Python functions

Asked

Viewed 350 times

1

Is there any way I can figure out the algorithm behind functions like split() and in in Python, because in my faculty there are some forbidden functions.

  • Did any of the answers solve your question? Do you think you can accept one of them? Check out the [tour] how to do this, if you haven’t already. You would help the community by identifying what was the best solution for you. You can accept only one of them. But you can vote on any question or answer you find useful on the entire site.

2 answers

1

Yes, it is possible to see the split(), but it won’t do any good.

There are other variations of it.

The in is an operator and not a function. It has its source code on Github, a little harder to find, but at least now you know where it is.

My recommendation is that you do what the exercise asks and don’t look for shortcuts, their idea is not to copy from somewhere (and note that you couldn’t even search), the goal is to understand the problem and produce an algorithm from your head, only then will you learn to program. Copy things ready even a computer can do.

0

In Python there is actually no way.

Python is an interpreted language, much less efficient than languages such as C or Java. To improve its performance, much of the standard Python library has been implemented in native code, that is, there is no Python code behind the split, there is only machine code already compiled, which is not humanly understandable.

  • 3

    Hmmmm, almost everything you said here is wrong? The most common implementation of Python is written in C, so behind it there is a readable code. There are also other variations, such as Jython, Ironpython, Pypy, browser versions, and the list follows. All with human-readable code. After all, Python is (like a good programming language) Complete Turing, so any and all Python computation can do

Browser other questions tagged

You are not signed in. Login or sign up in order to post.