Forums

Slicing behaviour vis a vis Python

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Slicing behaviour vis a vis Python

Postby hopscc » Mon Apr 14, 2008 1:16 am

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.
Attachments
Testslice.cobra
(1.46 KiB) Downloaded 111 times
hopscc
 
Posts: 631
Location: New Plymouth, Taranaki, New Zealand

Re: Slicing behaviour vis a vis Python

Postby Charles » Mon Apr 14, 2008 2:04 am

Not intentional. Will fix.
Charles
 
Posts: 2510
Location: Los Angeles, CA

Re: Slicing behaviour vis a vis Python

Postby hopscc » Mon Apr 14, 2008 3:28 am

Would you like a patchfile?
code and mods to the testfiles
hopscc
 
Posts: 631
Location: New Plymouth, Taranaki, New Zealand

Re: Slicing behaviour vis a vis Python

Postby Charles » Mon Apr 14, 2008 9:14 am

That would be great!
Charles
 
Posts: 2510
Location: Los Angeles, CA

Re: Slicing behaviour vis a vis Python

Postby hopscc » Tue Apr 15, 2008 1:16 am

here ya go
patch file for mods to CobraLang.cs and 3 test files
Attachments
slice.patch
(5.04 KiB) Downloaded 109 times
hopscc
 
Posts: 631
Location: New Plymouth, Taranaki, New Zealand

Re: Slicing behaviour vis a vis Python

Postby Charles » Sat Apr 19, 2008 6:28 pm

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.
Charles
 
Posts: 2510
Location: Los Angeles, CA

Re: Slicing behaviour vis a vis Python

Postby hopscc » Sat Apr 19, 2008 11:22 pm

OK willdo.
hopscc
 
Posts: 631
Location: New Plymouth, Taranaki, New Zealand


Return to Discussion

Who is online

Users browsing this forum: No registered users and 3 guests

cron