作者hankdai (hank)
看板Python
標題[問題] python的字串型態
時間Wed Oct 28 01:43:59 2015
大家好 各位前輩好
我有兩個問題想請教前輩們
第一.Should strings be simply a special kind of character array or a primitive
types?
第二.Should strings have static or dynamic length?
最近再學程式語言,看到這兩個題目,不知道如果是以python的字串型態來想會是什麼
感謝各位前輩解惑
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.35.80.253
※ 文章網址: https://webptt.com/m.aspx?n=bbs/Python/M.1445967842.A.11D.html
1F:→ tiefblau: primitive types, static length 10/28 09:30
2F:推 aweimeow: Python 只有 string 而已欸, py2 好像有 char 可是py3沒 10/28 09:40
3F:→ hankdai: 了解!感謝兩位前輩的指導 10/28 10:26
4F:→ uranusjr: Python 2 也沒有 char, Guido 認為 character 是 string 10/28 11:24
5F:→ uranusjr: 的特例, 所以沒有 character type 10/28 11:25
6F:→ hankdai: 感謝前輩解惑! 10/28 12:16
7F:→ walelile: 有人認為python沒有primitive types,全部都是object 10/28 22:56
8F:→ walelile: 如果用sys.getsizeof()來看string size,不覺得是static 10/28 22:58
9F:→ walelile: google "Check if a variable's type is primitive" 10/28 23:00