Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions source/_static/sitemap-index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,103 +80,103 @@
<priority>0.80</priority>
</url>
<url>
<loc>https://python.coderz.ir/lessons/l12.html</loc>
<lastmod>2021-03-17T17:10:25+00:00</lastmod>
<loc>https://python.coderz.ir/lessons/l12-function-in-python.html</loc>
<lastmod>2023-04-17T17:10:25+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://python.coderz.ir/lessons/l13.html</loc>
<lastmod>2021-03-17T17:10:25+00:00</lastmod>
<loc>https://python.coderz.ir/lessons/l13-decorator-generator-and-lambda-with-python-functions.html</loc>
<lastmod>2023-04-17T17:10:25+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://python.coderz.ir/lessons/l14.html</loc>
<lastmod>2021-03-17T17:10:25+00:00</lastmod>
<loc>https://python.coderz.ir/lessons/l14-recursive-functions-and-memoization-in-python.html</loc>
<lastmod>2023-04-17T17:10:25+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://python.coderz.ir/lessons/l15.html</loc>
<lastmod>2021-03-17T17:10:25+00:00</lastmod>
<loc>https://python.coderz.ir/lessons/l15-regular-expression-in-python.html</loc>
<lastmod>2023-04-17T17:10:25+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://python.coderz.ir/lessons/l16.html</loc>
<lastmod>2021-03-17T17:10:25+00:00</lastmod>
<loc>https://python.coderz.ir/lessons/l16-python-module-re.html</loc>
<lastmod>2023-04-17T17:10:25+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://python.coderz.ir/lessons/l17.html</loc>
<lastmod>2021-03-17T17:10:25+00:00</lastmod>
<loc>https://python.coderz.ir/lessons/l17-object-oriented-programming-with-python.html</loc>
<lastmod>2023-04-17T17:10:25+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://python.coderz.ir/lessons/l18.html</loc>
<lastmod>2021-03-17T17:10:25+00:00</lastmod>
<loc>https://python.coderz.ir/lessons/l18-inheritance-and-association-in-python.html</loc>
<lastmod>2023-04-17T17:10:25+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://python.coderz.ir/lessons/l19.html</loc>
<lastmod>2021-03-17T17:10:25+00:00</lastmod>
<loc>https://python.coderz.ir/lessons/l19-metaclass-and-abstraction-in-python.html</loc>
<lastmod>2023-04-17T17:10:25+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://python.coderz.ir/lessons/l20.html</loc>
<lastmod>2021-03-18T17:10:25+00:00</lastmod>
<loc>https://python.coderz.ir/lessons/l20-encapsulation-polymorphism-in-python.html</loc>
<lastmod>2023-04-18T17:10:25+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://python.coderz.ir/lessons/l21.html</loc>
<lastmod>2021-03-19T17:10:25+00:00</lastmod>
<loc>https://python.coderz.ir/lessons/l21-descriptors-and-context-manager-in-python.html</loc>
<lastmod>2023-04-19T17:10:25+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://python.coderz.ir/lessons/l22.html</loc>
<lastmod>2021-03-19T17:10:25+00:00</lastmod>
<loc>https://python.coderz.ir/lessons/l22-type-hinting-and-data-class-in-python.html</loc>
<lastmod>2023-04-19T17:10:25+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://python.coderz.ir/lessons/l23.html</loc>
<lastmod>2021-03-29T17:10:25+00:00</lastmod>
<loc>https://python.coderz.ir/lessons/l23-traceback-and-exception-handling-in-python.html</loc>
<lastmod>2023-04-29T17:10:25+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://python.coderz.ir/lessons/l24.html</loc>
<lastmod>2021-04-01T17:10:25+00:00</lastmod>
<loc>https://python.coderz.ir/lessons/l24-raise-exception-warning-and-assertion-in-python.html</loc>
<lastmod>2023-04-01T17:10:25+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://python.coderz.ir/lessons/l25.html</loc>
<lastmod>2021-04-15T17:10:25+00:00</lastmod>
<loc>https://python.coderz.ir/lessons/l25-python-module-datetime.html</loc>
<lastmod>2023-04-15T17:10:25+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://python.coderz.ir/changelog.html</loc>
<lastmod>2023-03-17T17:10:19+00:00</lastmod>
<lastmod>2023-04-17T17:10:19+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://python.coderz.ir/support.html</loc>
<lastmod>2023-03-17T17:10:25+00:00</lastmod>
<lastmod>2023-04-17T17:10:25+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://python.coderz.ir/support-report.html</loc>
<lastmod>2023-03-17T17:10:25+00:00</lastmod>
<lastmod>2023-04-17T17:10:25+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://python.coderz.ir/python-interactive.html</loc>
<lastmod>2021-03-17T17:10:19+00:00</lastmod>
<lastmod>2021-04-17T17:10:19+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://python.coderz.ir/python-resources.html</loc>
<lastmod>2021-03-20T17:10:19+00:00</lastmod>
<lastmod>2021-04-20T17:10:19+00:00</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://python.coderz.ir/index.html</loc>
<lastmod>2021-03-17T17:10:23+00:00</lastmod>
<lastmod>2021-04-17T17:10:23+00:00</lastmod>
<priority>0.64</priority>
</url>

Expand Down
9 changes: 9 additions & 0 deletions source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
=============


.. raw:: html

<p class="rubric" id="00137" ><a class="reference external" href="#00137">00137</a> - جمعه ۸ اردیبهشت ۱۴۰۲</p>

* دروس دوازدهم تا بیست و پنجم ویرایش و بروزرسانی گردید.


----

.. raw:: html

<p class="rubric" id="00136" ><a class="reference external" href="#00136">00136</a> - پنج‌شنبه ۷ اردیبهشت ۱۴۰۲</p>
Expand Down
30 changes: 15 additions & 15 deletions source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@
lessons/l09-control-flow-statements-in-python
lessons/l10-input-print-and-files-in-python
lessons/l11-python-standard-library
lessons/l12
lessons/l13
lessons/l14
lessons/l15
lessons/l16
lessons/l17
lessons/l18
lessons/l19
lessons/l20
lessons/l21
lessons/l22
lessons/l23
lessons/l24
lessons/l25
lessons/l12-function-in-python
lessons/l13-decorator-generator-and-lambda-with-python-functions
lessons/l14-recursive-functions-and-memoization-in-python
lessons/l15-regular-expression-in-python
lessons/l16-python-module-re
lessons/l17-object-oriented-programming-with-python
lessons/l18-inheritance-and-association-in-python
lessons/l19-metaclass-and-abstraction-in-python
lessons/l20-encapsulation-polymorphism-in-python
lessons/l21-descriptors-and-context-manager-in-python
lessons/l22-type-hinting-and-data-class-in-python
lessons/l23-traceback-and-exception-handling-in-python
lessons/l24-raise-exception-warning-and-assertion-in-python
lessons/l25-python-module-datetime
changelog
support
support-report
Expand All @@ -72,7 +72,7 @@
:scale: 60 %
:alt: بروز شده با نسخه 3.11

**شروع:** فروردین ۱۳۹۴ **و** **آخرین بروزرسانی:** اردیبهشت ۱۴۰۲ [`گزارش توسعه <changelog.html>`__] - **در حال بروزرسانی با نسخه ۳.۱۱ پایتون**
**شروع:** فروردین ۱۳۹۴ **و** **آخرین بروزرسانی:** اردیبهشت ۱۴۰۲ [`گزارش توسعه <changelog.html>`__] - **بروز شده با نسخه ۳.۱۱ پایتون**



4 changes: 2 additions & 2 deletions source/lessons/l02-setup-python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

در هنگام نصب نسخه‌‌ای که قصد دارید از آن به صورت نسخه‌ پیش‌فرض پایتون خود استفاده نمایید، به این نکته توجه داشته باشید که در مرحله‌ سفارشی‌سازی (Customize) گزینه‌ افزودن خودکار مسیر مفسر پایتون به متغیر Path ویندوز را فعال نمایید (همانند تصویر پایین). در این صورت با وارد کردن دستور ``python`` در خط فرمان ویندوز، مفسر پایتون (این نسخه) فراخوانی می‌شود. برای شروع، با وارد کردن دستور ``python –V`` یا ``python --version`` می‌توانید از نسخه‌ پایتون نصب شده آگاهی یابید:

.. image:: /_static/l02-install-python-on-windows.png
.. image:: /_static/lessons/l02-install-python-on-windows.png
:align: center

.. code::
Expand All @@ -88,7 +88,7 @@
مسیر Control Panel > System > Advanced system settings > Advanced را طی کرده و سپس با کلیک بر روی Environment Variables پنجره‌ جدیدی باز می‌گردد که در قسمت System variables آن Path را پیدا و انتخاب نمایید. بر روی Edit در پایین همان پنجره کلیک کرده و عبارت ``;C:\Python34;C:\Python34\Scripts`` (برای نسخه 3.4) را به ابتدای متن موجود در قسمت Variable value پنجره‌ جدید وارد و سپس بر روی دکمه‌ OK کلیک نمایید. :)


.. image:: /_static/l02-add-path-on-windows.png
.. image:: /_static/lessons/l02-add-path-on-windows.png
:align: center

.. caution::
Expand Down
2 changes: 1 addition & 1 deletion source/lessons/l03-create-and-run-a-python-project.rst
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@
زمانی که اقدام به اجرای یک اسکریپت می‌کنید؛ ابتدا، اسکریپت و تمام ماژول‌های ``import`` شده در آن به بایت‌کد کامپایل و سپس بایت‌کد‌های حاصل جهت تفسیر به زبان ماشین و اجرا، به ماشین مجازی فرستاده می‌شوند. آنچه ما از آن به عنوان مفسر پایتون (پیاده‌سازی CPython) یاد می‌کنیم در واقع ترکیبی از یک کامپایلر و یک ماشین مجازی است. تصویر پایین به خوبی روند اجرای کدهای پایتون را نمایش می‌دهد.


.. image:: /_static/l03-interpreter.png
.. image:: /_static/lessons/l03-interpreter.png
:align: center
:target: http://trizpug.org/Members/cbc/wyntkap/compiler.html

Expand Down
8 changes: 4 additions & 4 deletions source/lessons/l05-object-oriented-programming.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@

برای مثال یک کلاس خودرو ساده را در نظر بگیرید که در آن صفات: رنگ بدنه، ظرفیت باک، بیشینه سرعت و متدهای: راندن، دریافت میزان سوخت، سوخت گیری، تنظیم سرعت، توقف تعریف شده است. در همان ابتدا یعنی زمان نمونه‌سازی می‌توانیم با تنظیم صفات توسط متد سازنده، اشیا هم نوع ولی با صفات متفاوتی را ایجاد نماییم. برای مثال: دو خودروی آبی با ظرفیت باک ۲۰ لیتر و بیشینه سرعت ۸۰ کیلومتر-ساعت یا یک خودروی صورتی با ظرفیت باک ۴۰ لیتر و بیشینه سرعت ۱۶۰ کیلومتر-ساعت که البته هر سه آن‌ها تمام متدهای کلاس را در خود دارند:

.. image:: /_static/l05-car-class-sample.jpg
.. image:: /_static/lessons/l05-car-class-sample.jpg
:align: center

.. image:: /_static/l05-car-class-object-sample.jpg
.. image:: /_static/lessons/l05-car-class-object-sample.jpg
:align: center


Expand Down Expand Up @@ -97,7 +97,7 @@

کلاس‌ها می‌توانند مستقل باشند ولی هنگامی که وارد رابطه‌های وراثت می‌شوند، یک ساختار سلسله مراتب (Hierarchy) به شکل درخت را تشکیل می‌دهند. برای نمونه به ساختار سلسله مراتب وراثت پایین که مربوط به برخی اشکال هندسی است توجه نمایید، پیکان‌ها نشانگر نسبت is-a هستند.

.. image:: /_static/l05-Inheritance-Hierarchy-Sample.png
.. image:: /_static/lessons/l05-Inheritance-Hierarchy-Sample.png
:align: center


Expand All @@ -109,7 +109,7 @@

در برنامه‌نویسی شی‌گرا نسبت دیگری نیز با عنوان «نسبت **دارد-یک**» (HAS-A Relationship) وجود دارد که بیانگر مفهومی به نام «**ترکیب**» (Composition) است که شکل دیگری از قابلیت استفاده مجدد کد می‌باشد ولی مفهومی متفاوت با وراثت دارد. این نسبت زمانی بیان می‌شود که درون یک کلاس (مانند: C) از کلاس دیگری (مانند: D) نمونه‌سازی شده باشد؛ یعنی شی کلاس C درون خودش شی‌ای از کلاس D را داشته باشد؛ در این حالت می‌گوییم: C has a D. به یاد دارید خواندیم کلاس کارخانه خودروسازی با هماهنگ کردن اشیای واحدهای کوچکتر، عملیات خود را تعریف می‌کند. مثلا کلاس موتور - یعنی درون این کلاس یک شی از کلاس موتور ایجاد شده است، اکنون می‌توانیم بگوییم: «خودرو» یک «موتور» دارد.

.. image:: /_static/l05-has-a-Sample.png
.. image:: /_static/lessons/l05-has-a-Sample.png
:align: center


Expand Down
6 changes: 3 additions & 3 deletions source/lessons/l06-python-syntax.rst
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ Docstring باید به عنوان دستور نخست درج گردد و این

در تصویر پایین به شیوه تورفتگی‌ بلاک‌ها نسبت به سرآیند خود توجه نمایید:

.. image:: /_static/l06-python-Indentation-block.png
.. image:: /_static/lessons/l06-python-Indentation-block.png
:align: center

.. tip::
Expand Down Expand Up @@ -401,7 +401,7 @@ Docstring باید به عنوان دستور نخست درج گردد و این
در نمونه کد بالا: دستور ``;int a = 1`` بیان می‌کند که محلی از حافظه به نام ``a`` برای نگهداری اعداد صحیح (integers) در نظر گرفته شود و مقدار ``1`` در آن قرار بگیرد؛ از این پس متغیر ``a`` معرف این نقطه از حافظه می‌باشد (درست به مانند یک جعبه) که اکنون حاوی مقدار ``1`` است (شکل پایین - یک). در ادامه دستور ``;a = 2`` باعث می‌شود مقدار پیشین متغیر ``a`` حذف (از جعبه خارج) و مقدار جدید یعنی ``2`` در آن قرار داده شود (شکل پایین - دو). توجه داشته باشید که در این دسته زبان‌ها، نوع (type) توسط متغیر تعیین می‌گردد و تلاش برای قرار دادن نوع داده دیگری به غیر از ``int`` در متغیر ``a`` (به مانند ``3.7`` یا ``"string"``) باعث بروز خطا در زمان کامپایل می‌گردد. دستور سوم:‌ ``;int b = a`` در ابتدا باعث ایجاد یک محل جدید در حافظه با نام ``b`` و از نوع همان اعداد صحیح می‌شود و سپس مقدار درون متغیر ``a`` را درون آن کپی می‌کند؛ اکنون دو محل برای نگهداری نوع داده ``int`` در حافظه موجود است که هر دو حاوی مقدار ``2`` می‌باشند (شکل پایین - سه).


.. image:: /_static/l06-c-variable.png
.. image:: /_static/lessons/l06-c-variable.png
:align: center

.. rubric:: ولی در پایتون:
Expand All @@ -420,7 +420,7 @@ Docstring باید به عنوان دستور نخست درج گردد و این
#. متغیرِ (یا همان نامِ) ``a`` را در جایی دیگر از حافظه ایجاد می‌کند (البته در صورتی که قبلا ایجاد نشده باشد).
#. یک پیوند از متغیر ``a`` به شی ``1`` برقرار می‌کند. به این پیوند «ارجاع» (Reference) گفته می‌شود .

.. image:: /_static/l06-python-variable-01.png
.. image:: /_static/lessons/l06-python-variable-01.png
:align: center

انتساب شی دیگری (که می‌تواند از هر نوع دیگری باشد) به یک متغیر موجود؛ باعث حذف ارجاع قبلی آن و ارجاع به شی جدید می‌شود. دستور ``a = 2`` باعث ایجاد شی ``2``، حذف ارجاع متغیر ``a`` به شی ``1`` و ایجاد ارجاعی جدید از متغیر ``a`` به شی ``2`` می‌شود. هر متغیر نامی است برای اشاره به یک شی؛ دستور ``b = a`` نیز می‌گوید: یک متغیر جدید با نام ``b`` ایجاد گردد و به همان شی‌ای ارجاع داشته باشد که متغیر ``a`` ارجاع دارد.
Expand Down
5 changes: 3 additions & 2 deletions source/lessons/l08-list-and-tuple-in-python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@
>>> L2
[7, 2, 3]

.. image:: /_static/l08-python-list-assignment-01.png
.. image:: /_static/lessons/l08-python-list-assignment-01.png
:align: center

ولی اگر شی لیست مورد نظر عضوهایی از نوع لیست (یا هر نوع تغییر پذیر دیگر) داشته باشد، مشکل فوق همچنان برای این عضوها باقی است. به نمونه کد و تصویر پایین توجه نمایید::
Expand Down Expand Up @@ -363,7 +363,7 @@



.. image:: /_static/l08-python-list-assignment-02.png
.. image:: /_static/lessons/l08-python-list-assignment-02.png
:align: center

در پایتون کپی شی به دو شیوه **«سطحی»** (Shallow Copy) و **«عمیق»** (Deep Copy) انجام می‌شود که به ترتیب توسط تابع‌های ``()copy`` و ``()deepcopy`` از درون ماژول ``copy`` در دسترس هستند [`اسناد پایتون <http://docs.python.org/3/library/copy.html>`__]. در شیوه کپی سطحی همانند کاری که پیش از این انجام دادیدم - یعنی انتساب با استفاده از اندیس ``[:]`` - اشیا داخلی کپی نمی‌شوند و تنها یک ارجاع جدید به آن‌ها داده می‌شود؛ در حالی که توسط شیوه کپی عمیق از تمامی اشیا (تغییر پذیر) داخلی نیز یک کپی ایجاد می‌گردد::
Expand Down Expand Up @@ -750,6 +750,7 @@
[1]


.. _python-tuple:

توپِل
------
Expand Down
Loading