作者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/cn.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