How to Write Python correctly

Source: Internet
Author: User

Zope written in Python is the most widely used and easy-to-understand content management framework in the open source code field. This is exactly Microsoft. NET, but today it has become a reality for Python.

Why should we focus only on the so-called orthodox languages C ++, Java, and C? Isn't our goal a pragmatic programmer? C ++, Java, and even C # can all be seen as the same type of language: C ++ is flexible, but complicated syntax makes production efficiency low, and Java improves production efficiency.

However, flexibility is lost. C # is a good balance between production efficiency and flexibility, but it is still not enough. Otherwise, the father of Boo language will not be angry with Boo. Python is a dynamic type and a strong type language. Dynamic type means that you no longer need to make numerous declarations for each variable type.

Because the compiler will help you determine the type, it will decide the type of the Variable Based on the Value assignment of the variable. A strong type means that you cannot use a string as an int unless you explicitly convert it. Python itself is compact.

Because space is ignored in C ++, Java, C #, and "{}" to define the code block, if you like it, you can write all the code on one line, so you can write it as dizzy as possible. But this is not possible in Python, because there is only one Separator in Python, namely the colon ":".

At the same time, you can use indentation to differentiate code blocks. You may not get used to this method at first, but later, you will find that this method will benefit you a lot, because you have developed a good code style. Don't think that Python is a very academic language.

Although many people think it is very suitable as an entry-level language for learning programming. In fact, Python is not only suitable for beginners to learn programming, but also a powerful language. You can use it to do anything other languages can do.

Python itself is almost everywhere, and programs written in Python can run in various mainstream operating systems, even Palm. Oh, I almost forgot. Eric Raymond also told us that hackers must master four languages. The first step is Python.

Speaking of this, it seems that there is no link with production efficiency. Well, let's look at what we see is what we get. Download Python. Of course, if you cannot leave. NET in a day, you should start learning Python from IronPython.

After installing Python or IronPythonConsole, enter print "Hello, world" and press Enter, world appears on the screen. Now your first Python program has been compiled and executed. Compared with C ++, Java, and even C #, is it much faster to write and execute this classic program in Python? Haha ~~~ If I make up my mind to say that Python is highly productive, you will already scold me for being a lie.

  • Study on Python Database
  • Python developers
  • Analysis of Python Dynamic Language
  • Advantages of Python scripts
  • How to set the main Python thread

Well, it's easy. Let's try some practical code. But before that, you have to download two very famous class libraries. The first is wxPython. If you have read the Post above, you will know the header of wxPython. It is a well-known wxWidget implementation in Python. I don't know what wxWidget is?

No, I don't know how to read my Blog. (It's pretty bad, but I did know it soon. Don't hit me, huh ~~~)? In short, wxPython can be used for GUI development easily. Find a handy editor and type the following code to save it as a file with your favorite name.

Related Article

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.