1.1 --- a/lib/__builtins__/character.py Thu Dec 01 23:27:23 2016 +0100
1.2 +++ b/lib/__builtins__/character.py Thu Dec 01 23:48:24 2016 +0100
1.3 @@ -3,7 +3,7 @@
1.4 """
1.5 Character-related functions.
1.6
1.7 -Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 This program is free software; you can redistribute it and/or modify it under
1.11 the terms of the GNU General Public License as published by the Free Software
1.12 @@ -19,10 +19,21 @@
1.13 this program. If not, see <http://www.gnu.org/licenses/>.
1.14 """
1.15
1.16 +from native import _str_ord
1.17 +
1.18 def chr(i): pass
1.19 def hex(number): pass
1.20 def oct(number): pass
1.21 -def ord(c): pass
1.22 +
1.23 +def ord(c):
1.24 +
1.25 + "Return the value of the given character 'c'."
1.26 +
1.27 + if isinstance(c, string) and len(c) == 1:
1.28 + return _str_ord(c)
1.29 + else:
1.30 + raise ValueError(c)
1.31 +
1.32 def unichr(i): pass
1.33
1.34 # vim: tabstop=4 expandtab shiftwidth=4