Is there a design defect in the Python language?

Source: Internet
Author: User
Looking at the source code written in python, many do not know what the type is or what method to call, and the return values of common methods do not know what the type is. Chinese processing is rather poor, the Garbled text is very serious. Why do we recommend it? Looking at the source code written in python, many do not know what the type is or what method to call, and the return values of common methods do not know what the type is. Chinese processing is rather poor, the Garbled text is very serious. Why do we recommend it? Reply: Isn't function annotation added to python3? With function annotation or isinstance method, IDE can find available methods. Actually, there is no REPL. The answer below is so cool... dare not speak...
I had to sacrifice others' articles. Don't spray me any more. I don't understand the text in the link, and I don't know what he is talking about... posting this link does not mean that I agree or disagree with any point in this link. I personally keep an independent and optimistic attitude towards python.
Python is uugly
Wit. io You do not know the type of the problem.

The solution is to use JetBrains PyCharm , There is a type derivation (note to add a type annotation ).

The solution is to use a strong static language. For example, I am addicted to the Rust language.

In addition, Python is considering introducing the type check (mypy) [Python-ideas] Proposal: Use mypy syntax for function annotations . Python 3 supports type annotations.

def func(foo: Foo) -> Bar:    Bar(foo)
I laughed at the python flaw. Let's talk about JavaScript. This language is 10 (ni) points (ma) Ling (keng) active (duo) Python as a dynamic language, the concept of "duck type" in use, that is, if a creature walks up like a duck and calls it like a duck, it is a duck. For Python programming, the interpreter only needs to check whether the object has corresponding methods and attributes regardless of the type of the object. So you can call whatever type you want. If the type error interpreter tells you that the method you call does not exist. You can use commands such as "dir (obj)" to view the methods and attributes of this object. Of course, you can also use "type (obj)" to view the current type of this object. For Chinese garbled characters, the subject uses Windows. The default Python encoding is Unicode. * The nix system is generally compatible, while Windows uses gbk encoding, if you need to unify the text encoding, we recommend that you use the following program to convert the encoding:

# Convert the string to UTF-8. If the string fails to be converted to gbk, try: doc = doc. encode ('utf-8') encoding t UnicodeEncodeError: doc = doc. encode ('gbk', 'ignore ')
Python does have garbage, but none of the items listed in your problem description are:

Looking at the source code written in python, many do not know what the type is or what method to call, and the return values of common methods do not know what the type is. Chinese processing is rather junk, garbled code is very serious and a waste of time. Why do I still recommend it? So many comments have scared me.

In fact, this is a matter of self-understanding and wisdom. It is not interesting to compete for it. It is a matter of personal taste. If it is a bug, it has been fixed for a long time.

Let's look at the answer to @ Xu winquan and look at these questions from another perspective.

By the way, I would like to tell you how to use rust to ensure that the type system is safe.

========================================

LZ, you can't even try python.

1. python is known as an object-oriented language.

Let's take a look at the list class: list. append (), list. count (). Well, it looks pretty good ...... But wait! Len (list) What a ghost! Is consistence eaten by a dog .. Think you are an STL Algorithm Library ????

2. The naming style cannot be viewed directly.

Getstatusoutput inputs what is this ..???

3. Closure.

Hey, python has lambda expressions. Is there a closure? Let's give it a try.

def f(x):    return lambda y: x + yg = f(10)print (g(20))
Scala is a good topic. Dynamic Language quickly eliminates warranty and writes Java or C #. What you mentioned earlier is that dynamic language is like this, I have only learned C/C ++/Java?
Chinese garbled characters. You can try Python3.x.

Ps: After learning erlang/haskell, I guess the subject will say that there are no loops and no spam language.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.