jackfrued / jackfrued/Python-100-Days

Day16-20/Python语言进阶

Open
#74 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
187k
Forks
55.8k
PR merge metrics
No merged PRs in 30d

Description

def merge(items1, items2, comp):
"""合并(将两个有序的列表合并成一个有序的列表)"""
items = []
index, index2 = 0, 0 --> index1, index2 = 0, 0

另外:
__slots__魔法 部分的一点建议
这一部分对于从静态语言转过来的新手可能不好理解,可以增加一个例子来对比添加__slots__前后的区别,
比如:
class Person(object):
pass

def set_age(self, age):
self.age = age

from types import MethodType
def callDynamicBind():
p = Person()
p.name = “Qed”
print(p.name)
p.set_age = MethodType(set_age, p, Person)
p.set_age(35)
print(p.age)

然后加上__slots__之后就不可以进行上述操作。这样该属性的作用十分明确。

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Find the Day16-20 Python advanced lesson containing the merge function and the slots section. Check the variable-name correction in the merge example, then review the surrounding slots explanation and add the requested before-and-after example. Done means both the corrected code and clearer explanation are present in the lesson.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.