The doc alludes to cobra having slicing behaviour like Pythons which I have taken to meaning behaves exactly the same.
Unfortunately (from my point of view at least) it doesnt ,in that slice indexes outside the existing range generate Exceptions rather than
generating a valid result up to the range boundaries.
I'm wondering if that behaviour is an intentional difference from pythons and if so what your reasoning for it might be.
Forums
Slicing behaviour vis a vis Python
7 posts
• Page 1 of 1
Slicing behaviour vis a vis Python
- Attachments
-
- Testslice.cobra
- (1.46 KiB) Downloaded 617 times
- hopscc
- Posts: 632
- Location: New Plymouth, Taranaki, New Zealand
Re: Slicing behaviour vis a vis Python
Not intentional. Will fix.
- Charles
- Posts: 2515
- Location: Los Angeles, CA
Re: Slicing behaviour vis a vis Python
Would you like a patchfile?
code and mods to the testfiles
code and mods to the testfiles
- hopscc
- Posts: 632
- Location: New Plymouth, Taranaki, New Zealand
Re: Slicing behaviour vis a vis Python
That would be great!
- Charles
- Posts: 2515
- Location: Los Angeles, CA
Re: Slicing behaviour vis a vis Python
here ya go
patch file for mods to CobraLang.cs and 3 test files
patch file for mods to CobraLang.cs and 3 test files
- Attachments
-
- slice.patch
- (5.04 KiB) Downloaded 631 times
- hopscc
- Posts: 632
- Location: New Plymouth, Taranaki, New Zealand
Re: Slicing behaviour vis a vis Python
Applied. Thanks.
In the future, feel free to delete obsolete code instead of commenting it out. We can always get it back from version control if we need it.
In the future, feel free to delete obsolete code instead of commenting it out. We can always get it back from version control if we need it.
- Charles
- Posts: 2515
- Location: Los Angeles, CA
Re: Slicing behaviour vis a vis Python
OK willdo.
- hopscc
- Posts: 632
- Location: New Plymouth, Taranaki, New Zealand
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 30 guests