Python inner working

Chai aur Code
29 Jan 202418:47

Summary

TLDRThe video script is from a Python tutorial series on the 'Tea and Code' channel, focusing on the installation of Python and pip, and the execution of a 'Hello World' program. The host encourages viewers to engage by aiming for 300 comments within 24 hours of the video upload. The script delves into the technical aspects of Python, discussing its nature as an interpreted and compiled language, and the process of converting source code to bytecode. It also touches on optimization techniques, the role of the Python virtual machine, and the importance of understanding Python's inner workings for developers, especially those aspiring to work in high-end companies or open-source projects.

Takeaways

  • 😀 The video is part of a series on the 'Tea and Code' channel, focusing on Python programming.
  • 🔧 The target for the video is to reach 300 comments within 24 hours of the video upload, emphasizing audience engagement.
  • 🎯 The script discusses the importance of understanding what happens behind the scenes in Python, moving beyond just writing code.
  • 💻 It highlights the difference between Python being an interpreted and a compiled language, and the role of byte code in Python's execution.
  • 🛠️ The video explains the process of Python code compilation into byte code and the subsequent execution by the Python virtual machine.
  • 📝 The script mentions the use of '.pyc' files, which are compiled Python code, and their role in making Python scripts run faster.
  • 🔎 It delves into the organization of Python's internal structure, including the use of '__init__.py' files and the significance of the '__main__' directory.
  • 🌐 The video touches on the concept of PythonAnywhere, an online platform for running Python scripts, and its role in executing Python code.
  • 📈 The script discusses the importance of understanding Python's inner workings for developers, especially those aiming to work in high-end companies or open-source projects.
  • 📝 The video concludes with an assignment for the viewers to write an article on the inner workings of Python after doing some research, encouraging deeper learning and contribution to the developer community.

Q & A

  • What is the main target of the video?

    -The main target of the video is to achieve 300 comments within 24 hours of the video upload.

  • What is the purpose of discussing Python and its inner workings in the video?

    -The purpose is to demystify what happens behind the scenes when Python code is executed and to generate interest by discussing the engineering aspects of Python.

  • What is the difference between Python being an interpreted language and a compiled language as discussed in the video?

    -The video clarifies the misconception that Python is either strictly an interpreted or a compiled language. It explains that Python compiles source code into an intermediate bytecode, which is then executed by the Python Virtual Machine.

  • Why is it important to understand the difference between bytecode and machine code in the context of Python?

    -Understanding the difference is important because bytecode is an intermediate representation that is platform-independent, while machine code is specific to the hardware and is what the computer's processor directly executes.

  • What is the role of the Python Virtual Machine (PVM) in executing Python code?

    -The PVM continuously loops, executing any code fed into it. It takes the bytecode produced by the compilation of Python source code and runs it, handling the execution of the program.

  • What does the video suggest about the optimization of Python code?

    -The video suggests that optimization is necessary when dealing with imported files and modules, as the Python interpreter needs to manage and compile the bytecode efficiently.

  • Why is it recommended to install and explore things when working with Python, as mentioned in the video?

    -It is recommended to install and explore to understand the hidden folders and processes that occur when Python code is executed, which are often abstracted away from the user.

  • What is the significance of the '.pyc' files discussed in the video?

    -The '.pyc' files are bytecode files that are generated from Python source code. They are used to speed up the execution of Python scripts by skipping the syntax checking and parsing that occurs with source code.

  • How does the video address the importance of understanding Python's inner workings for job interviews?

    -The video emphasizes that high-end companies and open-source projects often ask for in-depth knowledge of Python's inner workings, not just basic scripting or print statements.

  • What are some of the different implementations of Python mentioned in the video?

    -The video mentions CPython (the standard implementation), Jython, IronPython, PyPy, and Stackless Python as some of the different implementations.

  • What is the assignment proposed at the end of the video for viewers who understood the inner workings presented?

    -The assignment is for viewers to do some research, understand the material better, and write a good article about it, potentially on a developer-focused website like Hashnode.

Outlines

00:00

😀 Introduction to Python and Tea with Code

The speaker warmly welcomes the audience to the 'Tea and Code' channel and introduces the series 'Tea and Python.' They emphasize the need to have Python-pip installed to print a 'Hello World' program. The speaker sets a small goal for the video, aiming for 300 comments within 24 hours of the video upload. They express their hope that the audience will find the behind-the-scenes workings of Python interesting and promises an entertaining video. The speaker then shares their surprise at the lack of discussion on the engineering aspects of Python and aims to spark interest in these areas.

05:01

👨‍💻 Behind the Scenes of Python's Working

The speaker delves into the technical aspects of Python, starting with a simple 'Hello World' example. They discuss the process of writing Python code and the resulting bytecode, which is then executed by the Python interpreter. The speaker clarifies misconceptions about Python being an interpreted or a compiled language, explaining that Python code is compiled into an intermediate bytecode. They emphasize that this bytecode is platform-independent and can be executed on any machine with a Python interpreter. The speaker also touches on the optimization that occurs when bytecode is used, as it has already undergone syntax checks and parsing.

10:03

📝 Deeper Understanding of Python's Compilation Process

The speaker continues to explain the compilation process of Python, highlighting that the term 'compiled' in Python refers to the conversion of source code into bytecode, not machine code. They discuss the role of the Python interpreter in executing this bytecode and how it differs from a traditional compiled language. The speaker also mentions the importance of Python's version in the compilation process, emphasizing that the version used can affect the optimization and features available. They provide an example of a simple Python script and how it is compiled into bytecode, which is then executed by the interpreter.

15:03

🌐 Variants of Python and Their Applications

The speaker concludes the discussion by exploring different variants of Python, such as CPython, which is the standard implementation, and others like IronPython and PyPy, which are optimized for specific use cases like working with Java or improving performance. They emphasize the importance of understanding the differences between these implementations and how they are used in various environments. The speaker also encourages the audience to share the video and engage with the content, suggesting that such engagement can lead to more in-depth videos on the subject.

Mindmap

Keywords

💡Python

Python is a high-level, interpreted programming language known for its readability and简洁性. In the video, Python is the central theme, as the script discusses the installation of Python using pip and the execution of a 'Hello World' program. The video aims to demystify the inner workings of Python, which is crucial for understanding how the language processes code behind the scenes.

💡pip

pip is a package manager for Python, allowing users to install and manage additional libraries and tools. The script mentions the installation of 'python-pip', which is essential for managing Python packages. It's a key component in the Python ecosystem, enabling developers to extend the functionality of their Python environment.

💡Hello World

The 'Hello World' program is a simple application that outputs 'Hello, World!' to the screen. It's traditionally the first program a programmer writes when learning a new programming language. In the script, the 'Hello World' example serves as an entry point to discuss the compilation and execution process of Python code.

💡Compilation

Compilation is the process of translating source code written in one programming language (the source language) into another language (the target language). The script refers to Python's compilation process, which involves converting the source code into an intermediate form known as bytecode. This is a crucial step in understanding how Python executes code.

💡Bytecode

Bytecode is an intermediate representation of the source code, which is platform-independent and can be executed by a virtual machine. In the context of the video, Python compiles the source code into bytecode, which is then executed by the Python Virtual Machine. The script explains that bytecode is not machine code but an intermediate step that makes Python both portable and efficient.

💡Python Virtual Machine (PVM)

The Python Virtual Machine (PVM) is a software implementation that can execute programs written in Python. The script discusses how bytecode is fed into the PVM, which then executes the code. This concept is fundamental to understanding the runtime environment of Python programs.

💡Interpreter

An interpreter is a program that directly executes instructions written in a programming or scripting language. The script touches on the debate of whether Python is an interpreted or compiled language. It clarifies that Python uses an interpreter to execute bytecode, which is an intermediate step between source code and machine code.

💡Import Statements

Import statements are used in Python to include modules and packages whose functionality is required in the program. The script mentions the use of import statements and their role in organizing code. They are essential for modular programming, allowing developers to reuse code and maintain a clean structure.

💡Optimization

Optimization in programming refers to the process of modifying a software system to make it more efficient or effective. The script discusses the optimization of Python code, particularly in the context of import statements and bytecode compilation. It highlights the importance of understanding optimization for writing efficient Python programs.

💡PythonAnywhere

PythonAnywhere is a cloud-based Python development and hosting platform. The script mentions PythonAnywhere as an example of a service that allows users to run Python code in a managed environment. It's used to illustrate the concept of running Python code and managing Python projects online.

💡Version Control

Version control is a system that records changes to a file or set of files over time so that specific versions can be recalled later. The script refers to version control in the context of managing changes in Python code, emphasizing its importance for tracking modifications and maintaining different versions of a software project.

Highlights

Introduction to the 'Tea and Python2' series on the 'Tea and Code' channel.

Requirement of having Python-pip installed to print 'Hello World'.

Setting a target of 300 comments within 24 hours of the video upload.

Discussion on the surprising aspect of Python understanding and the need for more engineering behind-the-scenes discussions.

Explanation of the process of writing 'Hello World' in Python and the associated file naming conventions.

Diving into the concept of Python being an interpreted language versus a compiled language.

Introduction to the PythonAnywhere platform and its role in executing Python scripts.

Explanation of the compilation process to bytecode in Python.

Discussion on the benefits of bytecode, such as faster execution due to reduced syntax checks and parsing.

Importance of the '__pycache__' folder and its role in storing compiled bytecode.

Explanation of the '__main__' check in Python and its purpose.

Details on the 'source_change' and how Python handles changes in the source code.

Importance of specifying the Python version when creating '__pycache__' files.

Discussion on the optimization of imports and the role of internal compilers.

Introduction to the Python virtual machine (PVM) and its continuous loop for executing fed files.

Comparison of the PVM to a car engine, emphasizing the necessity of a runtime engine for language execution.

Highlighting the importance of understanding bytecode and machine code for high-end interviews in tech companies.

Encouragement for viewers to share the video to promote the creation of more in-depth technical content.

Assignment for viewers to write an article on the discussed Python internals for practice and to be featured on a popular developer blog.

Transcripts

play00:00

हां जी कैसे हैं आप सभी स्वागत है आप सभी

play00:02

का चाय और कोड चैनल में और हमारी सीरीज चल

play00:06

रही है चाय और python2 पे हम

play00:20

python-pip एटलीस्ट इंस्टॉल होना चाहिए

play00:23

आपको एक हेलो वर्ल्ड प्रिंट करवा सकूं ठीक

play00:26

है बस इसके बाद हम आगे चलेंगे इस वीडियो

play00:28

का जो हमारा टारगेट है वो बहुत ही छोटा सा

play00:30

टारगेट है सिर्फ 300 कमेंट्स का विद इन 24

play00:32

आवर्स ऑफ द अपलोड ऑफ दिस वीडियो तो होप

play00:35

फुली कि आप लोग 24 आवर्स के अंदर ही हमारे

play00:38

इतने कमेंट्स करवा देंगे तो प्लीज टारगेट

play00:40

फटाफट अचीव करवा दीजिएगा सब्सक्राइब नहीं

play00:42

किया है तो कर दीजिएगा और चलते हैं आगे अब

play00:45

पता है मुझे इस वीडियो की सबसे

play00:46

सरप्राइजिंग बात क्या लगती है कि देखिए

play01:00

कि यार सही मायने में तो पाइथन अब समझ में

play01:02

आ रही है कि एक्चुअली में बिहाइंड द सीन

play01:04

इनर वर्किंग होता क्या है पाइथन का अभी तक

play01:06

तो सिर्फ लोग या तो हैंड रिटन नोट्स दे

play01:08

रहे थे या सिर्फ कोड कर रहे थे तो ऐसा

play01:10

नहीं होना चाहिए ना कभी तो कोई

play01:12

इंजीनियरिंग बिहाइंड द सीन की बात करे

play01:14

ताकि इंटरेस्ट बना रहे तो इस वीडियो को

play01:15

देख के आपको बहुत मजा आएगा ये प्रॉमिस है

play01:17

तो चलिए चलते हैं अब मेन जो प्रॉब्लम वाली

play01:20

बात है ना वो क्या है एक्चुअली में आपके

play01:22

साथ में पहले स्क्रीन शेयर करते हैं कि जब

play01:24

हमने हेलो वर्ल्ड पाइथन लिखा था ये हेलो

play01:26

चाय तब तक तो कोई दिक्कत नहीं थी सिर्फ एक

play01:28

हेलो चाय ही लिखा था ने चाय विथ

play01:49

python2 अंडरस्कोर पहले और फिर वो दिखता

play01:52

एक अंडरस्कोर जैसा है फिर ये पाय कैश है

play01:54

क्या चीज और इसके अंदर यह फाइल आई कहां से

play01:57

जो कि है हेलो

play01:59

c python3 122

play02:05

pc5 के इसके रन कर सकता हूं क्या पाइथन

play02:08

इसको वापस से प्रोड्यूस करेगा क्या होगा

play02:10

जब मैं कोड में कोई चेंज करूंगा तो ये

play02:11

सारी चीजें हमें एक्चुअली में जाननी थी और

play02:14

इसी के बारे में हमारा ये पूरा वीडियो है

play02:15

ताकि हमें

play02:28

pythonanywhere.com हैं कि मेन मुद्दे की

play02:31

जो बात है उसको छोड़ देते हैं सर पाइथन तो

play02:33

इंटरप्रिटेड लैंग्वेज होती है सर पाइथन तो

play02:35

कंपाइल्ड लैंग्वेज होती है बस इसी बहस में

play02:38

लगे हुए हैं यह नहीं जानना कि एक्चुअली

play02:40

में वर्किंग बताओ ना मैं खुद जज कर लूंगा

play02:42

इंटरप्रिटेड है कि कंपाइल्ड है वर्किंग

play02:44

बताओ चलिए आपको वर्किंग ही समझाते हैं इस

play02:46

लैंग्वेज की बड़ी इंटरेस्टिंग वर्किंग है

play02:48

पहले चलते हैं हम हमारे आईपैड व्यू पे तो

play02:51

यह है हमारा आईपैड व्यू जिन लोगों को नहीं

play02:53

पता कि हम कुछ थ्योरी वगैरह डिस्कस करते

play02:55

टाइम हमारा यही वाइट बोर्ड है यही ब्लैक

play02:58

बोर्ड है यही डिजिटल बोर्ड है इसी पे हम

play03:00

काम चलाते हैं तो इस वीडियो के अंदर हम

play03:01

जानेंगे कि pythonanywhere.com

play03:29

प्रोग्राम बोलिए इसमें कोई अंतर नहीं है

play03:31

कुछ लोग स्क्रिप्ट बोलते हैं मैं

play03:32

प्रोग्राम बोलता हूं या आप प्रोग्राम बोल

play03:34

लीजिए कोई इसमें खास अंतर नहीं आने वाला

play03:36

हमने उसको फाइल का नेम दिया . पवा और उसने

play03:39

जो भी उसके अंदर इंस्ट्रक्शन थे उसको

play03:40

एग्जीक्यूट करवा दिया चाहे वो प्रिंटिंग

play03:42

का इंस्ट्रक्शन हो चाहे कोई कैलकुलेशन का

play03:44

इंस्ट्रक्शन हो या हो सकता है कोई वेब पेज

play03:46

बनाने का इंस्ट्रक्शन हो जो भी उसने

play03:48

इंस्ट्रक्शन कंप्लीट कर दिया तो जब वो

play03:50

इंस्ट्रक्शन कंप्लीट करते हैं तो बिहाइंड

play03:52

द सीन आपको कुछ दिखता है ये जो मैंने

play03:53

बनाया है ये एक्चुअली में

play03:59

बाइट कोड हां जी

play04:29

पास वो है बाइट कोड बाइट कोड पे भी अभी और

play04:31

चर्चा करेंगे यह आपका जावा वाला बाइट कोड

play04:33

वगैरह मत समझ लेना इसको ऑलमोस्ट वैसा ही

play04:36

है बट नहीं थोड़ा सा अलग भी होता है तो

play04:38

बाइट कोड अपना बनता है बाइट कोड बनने के

play04:40

बाद जैसे आपने

play04:45

python-pip v ए जिसका नाम है

play04:53

python2 कोड जो है उसके बाद फेच किया जाता

play04:56

है

play04:59

पूरा कोड रन होता है इसके बारे में भी और

play05:01

डिटेल अभी हम चर्चा करेंगे इन्हीं नोट्स

play05:03

के अंदर बट यही बेसिक काम है तो देखा कुछ

play05:05

ज्यादा इसमें कुछ खास था ही नहीं ना ही

play05:06

कोई ऐसे थ्रेड्स है ना लूप्स है ना कुछ इस

play05:09

तरह से है कि क्यूज लग गई ऐसा कुछ नहीं है

play05:11

बस सिंपल बाइट कोड बनेगा बाइट कोड बनने के

play05:13

बाद पाइथन सीधा वर्चुअल मशीन में जाता है

play05:15

और वहां पे कोड रन होता है तो बड़ा ही

play05:16

बेसिक सा काम है अब हम चलते हैं हमारा जो

play05:19

स्टेप वन है वो क्या होता है कंपाइल टू

play05:21

बाइट कोड अब जैसे मैं लिखूंगा कंपाइल टू

play05:23

बाइट कोड कुछ लोग सोचेंगे कि अरे यह तो

play05:25

कंपाइल्ड लैंग्वेज हुई ना बाइट कोड में

play05:27

हुआ नहीं यह एक्चुअली में एक कहने का

play05:29

तरीका है यह एक अ टेक जर्गन बोल सकते हो

play05:32

आप इसको या टेक्नोलॉजिकल टर्म है कि

play05:34

एक्चुअली में जब आपका पाइथन का कोड

play05:36

कन्वर्ट होता है बाइट कोड में तो वो

play05:38

कंपाइल्ड ा डाउन होता है तो उसको एक

play05:40

इंटरप्रिटेशन टर्म है वो तो इससे ये मत

play05:42

सोच लेना कि नहीं नहीं पाइथन अब क्योंकि

play05:44

बाइट कोड बनता ही है तो मैं तो कंपाइल

play05:45

लैंग्वेज कहूंगा नहीं ऐसा नहीं है वो एक

play05:47

इंटरमीडिएट स्टेप है आपका जिसमें हम बोलते

play05:50

हैं कि वो पाइथन का आपका जो सारा सोर्स

play05:51

कोड है वो कंपाइल डाउन होता है बाइट कोड

play05:54

में अब बाइट कोड जो है ना वो आपका लो लेवल

play05:56

कोड है मशीन कोड नहीं है लो लेवल को कोड

play05:59

है जो कि प्लेटफॉर्म इंडिपेंडेंट है यानी

play06:02

कि अब इससे फर्क ज्यादा नहीं पड़ेगा कि आप

play06:04

इस कोड को आप चाहो तो वैसे तो रन करा सकते

play06:07

हो इसको भी कि आप इसको मैक पे रन कर रहे

play06:09

हो या विज पे उसको बेसिकली अब रन कराने के

play06:11

लिए एक

play06:26

python-pip वीएम मिल जाएगा वहां हम रन करा

play06:28

देते हैं

play06:30

अच्छा अब एक इंटरेस्टिंग बात क्या है कि

play06:32

आपका जो बाइट कोड है ना वो एक्चुअली में

play06:34

फास्टर रन करता है क्योंकि जो भी चेक्स

play06:36

करने थे सिंटेक्स वगैरह के जो भी पार्सिंग

play06:39

वगैरह करनी थी वो सब हो चुकी है मोस्टली

play06:41

पूरी तरह से नहीं होती है बट मोस्टली आपकी

play06:43

हो चुकी होती है इसलिए बाइट कोड जो है वह

play06:45

कंपैरेटिव आपकी स्क्रिप्ट से तो कंपैरेटिव

play06:48

ज्यादा फास्ट रन करता है इसलिए बाइट कोड

play06:51

python2 कोड है ना यह जो हमारी फाइल दिखी

play06:54

थी हमें स्टार्टिंग में जो डॉट प वाईसी

play06:56

लंबा सा नाम था हेलो अंडर चाय समथिंग

play06:58

समथिंग वो एक्चुअली में जो डॉट पवाई है वो

play07:01

एक्चुअली में आपका कंपाइल्ड

play07:02

pythonanywhere.com

play07:29

को कुछ एक इंडिपेंडेंट मशीनस भी लगती है

play07:31

जो कि आपको डसी या इस तरह का कोड

play07:33

प्रोड्यूस करती है

play07:41

python3 का ही होता है तो देखा कितना छोटा

play07:44

सा प्रोग्राम है लेकिन वहां पे लिखा जाता

play07:46

है इतना सब कुछ अब हमारे पास एक और फोल्डर

play07:48

जो आया था वो आया था

play07:50

अ पा कश अब क्या है कई बार जब आप इस तरह

play07:55

का सॉफ्टवेयर लिखते हैं तो आपकी जो यह

play07:57

फ्रोजन बाइनरीज हैड पसी है अ यह कई बार

play08:00

डिलीट होके रिकंस्ट्रक्ट भी होती है कई

play08:02

बार इसके वर्जंस भी बनते हैं कई क्योंकि

play08:04

आप जैसे-जैसे कोड में चेंज करोगे उतना ही

play08:06

तो कोड लिखोगे नहीं तो अलग-अलग चेंज करोगे

play08:08

तो उस हिसाब से वोह सारी अगर आपके मेन

play08:10

फोल्डर के अंदर आएगी तो सोचिए कितनी सारी

play08:12

फाइल्स आपके पास भर गई है तो सिर्फ उन्हीं

play08:14

को ऑर्गेनाइज्ड रखने के लिए

play08:23

python.py के अंदर जब भी आप काम करेंगे तो

play08:25

आपके ये अंडरस्कोर अंडरस्कोर और लास्ट में

play08:27

भी अंडरस्कोर अंडरस्कोर आपका पीछा नहीं

play08:29

छोड़ेंगे ये कई जगह आपके यूज़ आएंगे ये

play08:31

सिर्फ एक अ ये चीज दर्शाता है कि ये चीजें

play08:44

python's में तो इसी तरह के ये

play08:58

pythonanywhere.com को कुछ एक अलग वैल्यू

play09:01

देती है कुछ अलग समझती है तो अलग-अलग

play09:03

रोल्स हैं उसके वो हम आगे जाके देखेंगे बट

play09:05

अभी के लिए ता जान लो कि हां ये जैसे ही

play09:07

आपने लिखा अंडर अंडर स्टार्ट और एंड में

play09:09

तो मतलब आप कुछ एक इंपॉर्टेंस दर्शा चाह

play09:11

रहे हो उसका पाइथन के लिए हो सकता है

play09:13

पाइथन उसको इंटरनल यूज में ले या फिर हो

play09:15

सकता है आप कुछ फीड करना चाह रहे हो

play09:23

python.py -31 2pc इस नाम के अंदर क्या है

play09:27

दो चीजें मेन इंपॉर्टेंट होती है एक आपका

play09:30

सोर्स चेंज अच्छा मैंने चेंज के अंदर यहां

play09:32

पे हम लिखना ही भूल गए ठीक है जी ये लीजिए

play09:35

अभी लिख देते हैं चेंज ठीक है तो एक तो

play09:38

आपका सोर्स चेंज जैसे-जैसे आपका सोर्स कोड

play09:41

चेंज होगा तो क्या होता है मोस्टली ये जो

play09:43

प्रोग्रामिंग लैंग्वेजेस ये जितनी भी होती

play09:44

है ना ये कुछ ना कुछ डिफिंग एल्गोरिदम यूज

play09:47

करती है यानी कि डिफरेंस फाइंडिंग

play09:48

एल्गोरिथम ये क्या करती है कंपेयर करती है

play09:51

कि आपका जो पहले का सोर्स कोड था उससे

play09:53

हमने कुछ पी वाईसी बनाया अब आपने कुछ

play09:55

सोर्स कोड में चेंज कर दिया तो कितना चेंज

play09:56

कर दिया पूरा कंप्लीट फिर से नहीं बनता है

play09:59

सिर्फ जो चेंजेज होते हैं वो वहां पे जाते

play10:00

हैं जैसे आपने कभी गेट यूज़ करा हो तो गेट

play10:02

वापस से पूरा सोर्स कोड थोड़ी ना पुश करता

play10:04

है जिन फाइल्स में सिर्फ चेंज है वो

play10:06

चेंजेज को पुश करता है तो उसी तरह से कुछ

play10:08

यहां पे भी सोर्स चेंज के लिए डिफिंग

play10:09

एल्गोरिथम्स यूज होती है

play10:10

pythonanywhere.com

play10:29

जब आप स्टैंडर्ड पाइथन के बारे में बात

play10:31

करते हैं तो यानी कि हम सी पाइथन का जो

play10:33

इंटरप्रिटेशन है वह हम यूज़ कर रहे हैं आप

play10:35

ज्यादातर यही यूज़ करने वाले हो बट ऐसा

play10:37

नहीं है कि यही है बहुत सारे और वर्जन भी

play10:38

है तो यहां पे ये जो पी वाईसी बन रहा है

play10:41

उसके लिए पाइथन का वर्जन भी इंपॉर्टेंट

play10:43

होता है इसलिए इसने नाम दिया सी

play10:44

pythonanywhere.com

play10:59

नहीं लिख दिया उसने उसने

play11:05

python.py न की हमारी जो बाइनरीज बनी है

play11:08

बाइट कोड बना है बाइनरीज तो नहीं बाइट कोड

play11:10

बना है यह एक्चुअली में

play11:11

python3.8 वर्जन पे बना है इसने यूज़ करा

play11:14

है स्टैंडर्ड पाइथन का सी पाइथन और वहां

play11:16

से हमारे पास ये अ फ्रोजन बाइनरीज आई है

play11:20

ओके यह एक और अभी रिसेंटली ही रिसेंटली

play11:24

मेरा मतलब है कुछ तीन चार पा साल के अंदर

play11:25

ही ये इंप्लीमेंटेशन हुआ है यह जो आपका डॉ

play11:28

पवाई फाइल है ये आपकी इंपोर्टेड फाइल्स पे

play11:30

बनेगा इसीलिए मैंने आपको जो पहला ही हमने

play11:32

वीडियो इंट्रोड्यूस किया था जहां पे सिर्फ

play11:35

हेलो वर्ल्ड लिख के ज्यादातर छोड़ देते

play11:36

हैं मैंने आपसे कुछ इंपोर्ट भी करवाया

play11:38

थोड़ा एक्स्ट्रा पेन दिया आपको क्योंकि ये

play11:40

जो चीज है ना ये पूरी कहानी ये एक्चुअली

play11:42

में इंपोर्टेड फाइल्स पे ही आती है ये कभी

play11:44

भी टॉप लेवल फाइल्स पे नहीं आती टॉप लेवल

play11:46

फाइल से मेरा मतलब है जब पूरे फोल्डर के

play11:48

अंदर फाइल ही एक हो आप कुछ इंपोर्ट

play11:50

एक्सपोर्ट कर ही नहीं रहे हो तो फिर

play11:51

ओबवियस सी बात है क्यों ही इसका जरूरत

play11:53

पड़ेगा क्यों ही ऑप्टिमाइजेशन की इतनी

play11:54

जरूरत पड़ेगी एक ही तो फाइल है सीधा ही

play11:56

हमारी जो पाइथन वर्चुअल मशीन है उसमें

play11:58

डालो और काम खत्म करा दो बट जब चीजें इधर

play12:00

से उधर से इंपोर्ट होती है तब

play12:01

ऑप्टिमाइजेशन की जरूरत आती है कि क्या

play12:03

बेस्ट तरीका हो सकता है कि उसको हम लेके आ

play12:05

सकें और इंटरनल कंपाइलर आपके काम करते हैं

play12:07

तो ये हो गया हमारा बेसिक पूरा काम अब

play12:10

छोटा सा डिस्कशन हम पीवीएम पे भी कर लेते

play12:12

हैं देखिए पीवीएम जब बोलते हैं ना पाइथन

play12:14

वर्चुअल मशीन तो बड़ा ही ऐसा लगता है कि

play12:16

अरे यार कुछ भयंकर वाला डिस्कशन कर दिया

play12:18

हमने अ जबकि कुछ है नहीं इतना ज्यादा एक

play12:21

बेसिकली छोटा सा सॉफ्टवेयर है वर्चुअल

play12:23

मशीन और उसके अंदर क्या है कंटीन्यूअसली

play12:25

एक लूप चलता रहता है अ जिस लूप के अंदर आप

play12:27

जैसे ही कोई भी फाइल फेड करते हो उसको

play12:29

एग्जीक्यूट कर देता है सारा का सारा बस

play12:31

इतना सा काम है उसका अब हो सकता है आप

play12:33

उसके अंदर बाइट कोड फीड कर रहे हो तो वो

play12:34

कंटीन्यूअसली तो लूप चल ही रहा है बाइट

play12:36

कोड जैसे ही दिया तो उसने स्टार्ट से लेके

play12:38

एंड तक उसको एग्जीक्यूट करा दिया और

play12:39

इसीलिए

play12:48

python-tk ही फीड होता है पीवीएम की सबसे

play12:50

अच्छी बात ये है कि आप डायरेक्ट python's

play12:52

भी उसमें दे सकते हो और इसीलिए आपका

play12:54

पीवीसी सबके लिए जनरेट नहीं होता है जो

play12:56

बेसिक आपकी टॉप लेवल फाइल्स है कुछ आपने

play12:58

main.py h पवा कुछ लिखा है तो वहां पे

play13:01

आपको कभी देखने को ही नहीं मिलता है अब

play13:03

मोस्टली जो ऑनलाइन आपके कंपाइलर्स हैं या

play13:06

इस तरह के हैं ये चीजें आपसे हाइड कर देते

play13:09

हैं वो आपको नहीं बताएंगे कि एक ऐसा हिडन

play13:11

फोल्डर भी जनरेट हुआ है तो अ इसीलिए मैं

play13:14

कहता हूं इंस्टॉल करो चीजों को देखो और

play13:16

थोड़ा सा प्रॉब्लम लो अच्छा यह जो पीवीएम

play13:19

है ना इसको एक रन टाइम इंजन भी बोला जाता

play13:22

है जैसे हर लैंग्वेज को ना एक रन टाइम

play13:25

इंजन चाहिए ही होता है और बिना रन टाइम

play13:27

इंजन के ना को वर्क करना तो पॉसिबल ही

play13:30

नहीं है ऐसा है कि बिना इंजन के आप कार

play13:32

चला रहे हो तो बिना इंजन के कार नहीं चलती

play13:35

अब आप उसमें चाहे डीजल इंजन डालो पेट्रोल

play13:37

इंजन डालो या फिर इलेक्ट्रिक इंजन एक इंजन

play13:39

तो चाहिए का इसीलिए कई लैंग्वेजेस जैसे

play13:42

आपने अगर मुझसे जावास्क्रिप्ट पढ़ी हो तो

play13:43

वहां पे भी मैं इंजन की काफी बात करता हूं

play13:45

कि जैसे अपना नोड का जो v8 इंजन है वो

play13:48

एक्चुअली में कोड रन करता है नोड रन नहीं

play13:50

करता है नोड तो उसके ऊपर अराउंड एक रैपर

play13:52

है इसी तरह से जो आपका पाइथन होता है यहां

play13:54

पे हमारे पास 1000 इंजन नहीं है हमारे पास

play13:56

सीधा पीवीएम है जो कि डायरेक्टली पान . से

play13:59

आता है सब यही इंजन उठाते हैं और कोई

play14:02

नोटबुक में लगा देता है कोई उसको मिनी

play14:04

कोंडा में लगा देता है तो काम अपना यही

play14:06

होता है बट बेसिकली उसी को ही रन टाइम

play14:08

इंजन कहा जाता है अब इसीलिए जैसा कि मैंने

play14:11

बताया इसको पाइथन इंटरप्रेटर हम बोलते हैं

play14:14

तो इसीलिए उम्मीद है आपको अब काफी कुछ

play14:16

इसका समझ में आया

play14:18

होगा जो लोग शायद पहली बार सीरीज देख रहे

play14:21

हैं हमारा थोड़ा सा ऐसा रॉ चलता है कभी

play14:23

चाय पीते हैं साथ में कभी पानी पीते हैं

play14:25

चलता रहता है अपना ऐसे ठीक है एक कुछ

play14:27

इंपॉर्टेंट नोट्स आपके इंटरव्यू

play14:29

पर्सपेक्टिव के लिए अगर आप हाई एंड

play14:30

कंपनियों में काम करना चाह रहे हैं या ओपन

play14:32

सोर्स जो कंपनियां होती है वह इस तरह की

play14:35

बिहाइंड द सीन डिटेल्स काफी पूछती है वो

play14:37

सिर्फ आपसे ये नहीं कहेगी कि यह प्रिंट

play14:39

करा दो या यह पाइथन बना दो इसीलिए पाइथन

play14:41

के अंदर एंथियास बहुत है और रिजेक्शन बहुत

play14:43

ज्यादा है क्योंकि वो इन डेप्थ नॉलेज की

play14:45

बहुत ज्यादा कमी है सबसे पहली चीज तो आपको

play14:47

पता होनी चाहिए कि बाइट कोड ना मशीन कोड

play14:50

नहीं है यह डायरेक्ट इंस्ट्रक्शन नहीं है

play14:53

जो आप अपनी

play14:58

होता है आपके हार्डवेयर के लिए लेकिन बाइट

play15:01

कोड ना मशीन कोड नहीं है तो इसलिए याद

play15:03

रखना बाइट कोड कभी भी नहीं होता है किसी

play15:05

भी लैंग्वेज में अगर बाइट कोड बन रहा है

play15:06

ना वो कभी भी मशीन का इंस्ट्रक्शन नहीं है

play15:09

मशीन का इंस्ट्रक्शन जैसे असेंबली

play15:10

लैंग्वेज प्रोड्यूस करती है या फिर आपकी

play15:12

कोई भी लैंग्वेज प्रोड्यूस करती है जो

play15:14

डायरेक्टली हार्डवेयर को इंस्ट्रक्शन दिया

play15:15

जाता है तो बाइट कोड वो नहीं है ये याद

play15:18

रखना बाइट कोड ना यहां पे

play15:27

pythonanywhere.com जावा की वर्चुअल मशीनस

play15:29

वगैरह होती है उसमें आप फीड कर दो तो नहीं

play15:31

यह पूरा ऑप्टिमाइज भी उसके लिए हुआ है

play15:33

लिखा भी उसी के लिए गया है स्पेसिफिकेशन

play15:35

भी उसी की है तो यह पाइथन स्पेसिफिक

play15:37

इंटरप्रिटेशन है अच्छा अब इतनी बात कर ली

play15:40

तो थोड़ी सी बात इस पे भी कर लेते हैं अभी

play15:42

देखिए हमने जो यूज़ करा वो यूज़ करा सी

play15:44

पाइथन और आप मेजॉरिटी केसेस क्या 90 पर

play15:47

केसेस में आप सी पाइथन ही यूज़ करने वाले

play15:49

हो कुछ एक एक्सेप्शन होते हैं वहां पे

play15:52

जरूर आप कुछ इसका अलग वर्जन या अलग

play15:53

ऑप्टिमाइजेशन वगैरह यूज़ कर लेते हो बट

play15:55

ज्यादातर केसेस में आप सी पाइथन यूज़

play15:57

करोगे जब भी भी स्टैंडर्ड पाइथन या पाइथन

play16:00

नॉर्मल किसी ने कहा है तो उसका मतलब है

play16:02

स्टैंडर्ड इंप्लीमेंटेशन उसका मतलब है सी

play16:04

पाइथन और रेगुलर जितने भी आपके पैकेजेस

play16:06

मैनेजर्स हैं या नटू में आप इंस्टॉल करो

play16:08

तो हमेशा आपके सी पाइथन ही डिफॉल्ट आएगी

play16:10

इसीलिए बाकी जितने वर्जंस है उनको

play16:13

स्पेसिफिकली मेंशन करना पड़ता है कि नहीं

play16:15

नहीं नहीं मैं पंगे सी पाइथन से नहीं ले

play16:17

रहा हूं मुझे पंगा लेना है किसी और

play16:20

वेरिएंट के पाइथन से अब और वेरिएंट है कौन

play16:22

से देखिए जाइथन भी है एक जिसको जे पाइथन

play16:25

बोलते हैं जाइथन ज्यादातर तो मैंने नहीं

play16:27

सुना बोलते हुए बट जे पाइथन नहीं बोलते

play16:28

हैं इसको इसी तरह से आयरन पाइथन भी है जे

play16:31

पाइथन ओबवियस सी बात है जावा की बाइनरीज

play16:34

के साथ जब आपको अ कुछ वर्क करना होता है

play16:36

तब उस तरह से आगे जाके हम और डिस्कशन

play16:38

करेंगे कि क्या मतलब है मेरा कि अ जावा की

play16:41

बाइनरी से या फिर जावा में बात करने से वो

play16:43

भी बा आपको बाद में बताएंगे और उसके बाद

play16:46

यह आयरन पाइथन भी होता है इसके अलावा

play16:48

स्टैक लेस भी है पाई पाई भी है जैसे कॉन

play16:50

करेंसी में आपको ज्यादा काम करना है तो आप

play16:51

स्टैक लेस वर्जन यूज़ करते हो परफॉर्मेंस

play16:54

ओरिएंटेड ज्यादा करना है तो आप पाई पाई

play16:55

यूज़ करते हो और ये सिर्फ कुछ नाम लिखे

play16:57

हैं और भी बहुत सारे नाम है पाइ बड़ी

play16:58

इंटरेस्टिंग लैंग्वेज है और इसलिए मुझे

play17:00

ज्यादा मजा आता है

play17:07

python-pip के अंदर होता है हमने सिर्फ

play17:10

हेलो वर्ल्ड लिखा और इतना सारा इंटरनल काम

play17:12

हो गया बट आपको शायद देखने में लगे कि

play17:14

बहुत इंटरनल काम हुआ है बट मेरी नजर से

play17:17

अगर देखोगे तो लगेगा इतना ही काम है अब

play17:19

चाहे कोड में कुछ भी लिखूं और ज्यादा

play17:21

बिहाइंड द सीन इंटरनल डेप्थ नहीं आ रही है

play17:23

अब तो मुझे बस सिंटेक्स सीखना है यह

play17:25

लैंग्वेज कैसे-कैसे काम करनी है उसके

play17:27

स्टैंडर्डाइज्ड फीचर मुझे जानने और बस

play17:29

मुझे अपना काम करना है तो इसीलिए मैं कहता

play17:30

हूं python2 चीजें नहीं है एक जो हमारा

play17:33

थ्योर डिस्कशन आता है थोड़ा सा वो मेमोरी

play17:35

को लेके आता है इ

play17:38

म्यूटेशन एक आपको बदलना पड़ता है उसके बाद

play17:43

म्यूटेशंस यही था एक छोटा सा वीडियो अ

play17:47

बिहाइंड द सीन पाइथन की इनर वर्किंग के

play17:49

बारे में अगर आपको ये वीडियो अच्छा लगा हो

play17:51

तो प्लीज प्लीज शेयर करिएगा क्योंकि इस

play17:53

तरह के इनर वर्किंग वीडियोस को लोग शेयर

play17:55

कम करते हैं इसीलिए यह वीडियोस कम बनाए

play17:58

जाते हैं पर आप अगर शेयर करेंगे और लोगों

play18:00

को बोलेंगे कि नहीं हमें ऐसे वीडियोस पसंद

play18:02

है तो बाकी क्रिएटर्स भी फिर बनाएंगे तो

play18:04

सबका भला है इसके अंदर तो प्लीज शेयर

play18:06

करिएगा फटाफट से और एक छोटा सा असाइनमेंट

play18:08

आपके लिए कि अगर आपको ये इनर वर्किंग समझ

play18:11

में आई थोड़ी और रिसर्च करिएगा इसके ऊपर

play18:13

और इसके ऊपर एक अच्छा सा आर्टिकल लिखेगा अ

play18:15

वन ऑफ माय फेवरेट वेबसाइट हैश नोड जिस पे

play18:17

सारे डेवलपर्स ही ब्लॉग लिखते हैं तो वहां

play18:19

पे लिखिए और इस वीडियो को एंबेड जरूर

play18:21

करिएगा उसके अंदर और शेयर कीजिएगा मुझे भी

play18:28

करने का मन हो तो कर लीजिएगा कोई ऐसा

play18:30

फोर्स नहीं है और कोई ऐसा कंपल्शन नहीं है

play18:33

बट हां एक कंपल्शन है चाय पीते रहिए कोड

play18:35

एंजॉय करते रहिए चलिए सब्सक्राइब कर दिया

play18:37

तो ठीक है नहीं कर दिया तो हम भी कहीं

play18:39

नहीं जा रहे मिलते हैं आपसे अगले वीडियो

play18:46

में

Rate This

5.0 / 5 (0 votes)

関連タグ
Python CodingBytecodePythonanywhereCode ExecutionHello WorldPython SeriesProgramming TutorialInterpreterCompiled LanguagePython 3.8
英語で要約が必要ですか?