Commit Graph

61 Commits

Author SHA1 Message Date
xbe
9e1e8cd642 Implement str.count and add tests for it.
Also modify mp_get_index to accept:
1. Indices that are or evaluate to a boolean.
2. Slice indices.
Add tests for these two cases.
2014-03-12 22:57:16 -07:00
Damien George
c5966128c7 Implement proper exception type hierarchy.
Each built-in exception is now a type, with base type BaseException.
C exceptions are created by passing a pointer to the exception type to
make an instance of.  When raising an exception from the VM, an
instance is created automatically if an exception type is raised (as
opposed to an exception instance).

Exception matching (RT_BINARY_OP_EXCEPTION_MATCH) is now proper.

Handling of parse error changed to match new exceptions.

mp_const_type renamed to mp_type_type for consistency.
2014-02-15 16:10:44 +00:00
Damien George
d46ca25757 Fix some int casting that failed on 64 bit architecture. 2014-02-10 21:46:47 +00:00
Paul Sokolovsky
ac0134d427 Factor out mp_seq_count_obj() and implement tuple.count(). 2014-02-10 07:13:32 +02:00
Paul Sokolovsky
624eff6a8a Implement tuple.index(). 2014-02-10 07:13:32 +02:00
Paul Sokolovsky
0cd1dc06e6 Factor out mp_seq_index_obj() function to implement .index() on sequences. 2014-02-10 07:13:32 +02:00
Paul Sokolovsky
1a996c48ac Refactor list comparison code to mp_seq_cmp_objs(). 2014-02-08 22:56:36 +02:00
Paul Sokolovsky
87e85b7dc7 Implement str/bytes rich comparisons. 2014-02-02 08:58:16 +02:00
Paul Sokolovsky
7364af2d8c Factor out m_seq_get_fast_slice_indexes() fucntions as sequence helper.
Takes slice object and sequence length and computes subsequence indexes
for case of slice step=1.
2014-02-02 02:38:22 +02:00
Damien George
12eaccacda Merge branch 'master' of github.com:micropython/micropython
Conflicts:
	py/objstr.c
	py/py.mk
	py/stream.c
	unix/main.c
	unix/socket.c
2014-01-21 21:54:15 +00:00
Paul Sokolovsky
439542f70c sequence.c: Start to refactor sequence operations for reuse among types. 2014-01-21 00:39:12 +02:00