小编tin*_*x84的帖子

why this python function return len=7 instead of len=6?

I got this code below, but even debugging it, I cannot understand why gives me out 7 instead of 6.

More precisely when I debudg every return gives me the expected result:

  1. first func call: ipdb> --Return-- ['a']
  2. second func call: ipdb> --Return-- ['a', 'a']
  3. third func call: ipdb> --Return-- ['a', 'a', 'a']

but at the end func() + func() + func() becomes ['a', 'a', 'a', 'a', 'a', 'a', 'a']

why is there one 'a' more???

#!/usr/bin/python
# -*- coding: …
Run Code Online (Sandbox Code Playgroud)

python-3.x

3
推荐指数
1
解决办法
63
查看次数

标签 统计

python-3.x ×1