看板 Python 關於我們 聯絡資訊
大家好 各位前輩好 我有兩個問題想請教前輩們 第一.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://www.ptt.cc/bbs/Python/M.1445967842.A.11D.html
tiefblau: primitive types, static length 10/28 09:30
aweimeow: Python 只有 string 而已欸, py2 好像有 char 可是py3沒 10/28 09:40
hankdai: 了解!感謝兩位前輩的指導 10/28 10:26
uranusjr: Python 2 也沒有 char, Guido 認為 character 是 string 10/28 11:24
uranusjr: 的特例, 所以沒有 character type 10/28 11:25
hankdai: 感謝前輩解惑! 10/28 12:16
walelile: 有人認為python沒有primitive types,全部都是object 10/28 22:56
walelile: 如果用sys.getsizeof()來看string size,不覺得是static 10/28 22:58
walelile: google "Check if a variable's type is primitive" 10/28 23:00