The Voidspace Techie Blog

Gravatar I don't mean to keep blasting your posting with the problems of IronPython, but this is just another example of the segmentation problem. The entire point of str is a string of bytes. It is not a text type anymore if you are following the rules. Thus, claiming 2.x compliance and making str a unicode type is simply not being Python at all. Causing you to use a .Net class to duplicate the functionality a builtin should be doing, but is implemented improperly, is just lazy on the IronPython team's part.

I don't mean to sound so negative, but honesty is the best policy.


Gravatar Well, I don't entirely disagree with you on this one - but there are a few issues.

The first is that the IronPython team see .NET integration as their highest priority, and not having Python strings would be a *major* annoyance.

Particularly given that both unicode and str have to inherit from basestring - I'm not sure they could have achieved that if str has to be an immutable bytes type.

Secondly, having Unicode strings is actually a major convenience! The fact that we don't have to worry about encodings inside Resolver means that solving the problems we had was trivially easy. I'm sure more problems will appear along the way, but for us a Unicode str is a great bonus. (Roll on Python 3).

Thirdly - the story is perhaps not so simple as I have made out. It *is* possible to store bytes in IronPython strings, but I have had a couple of problems. I'm just not sure what magic is going on here and what rules apply.

I think that where the string type loses data because it is unicode the IronPython team would see it as a bug - I'm honestly not sure though.

The interesting thing is that virtually no-one has complained (or even mentioned) this over the two or so years that IronPython has been around. They must be doing *enough* magic that it 'just works' most of the time, but there are some issues.

Fuzzy


Gravatar I don't agree with Calvin. Having IronPython, Jython, PyPy attempt to perfectly duplicate the CPython would *harm* Python as a language.

The community is learning, slowly, exactly what we mean by "str", "unicode", "bytes". These bugs are *good*, they are opportunities to learn.

I believe Guido explicitly said that he was learning about unicode issues "in the wild" for Python3k from Jython and IronPython.

"str", "unicode", "bytes" mean different things than they did three years ago. They just do.


Gravatar manuelg:

yes, we know the problems with str, but we are fixing them without breaking compatibility and its that breakage that IronPython doesn't care about. yet still calls itself Python. I don't want to sound like a ranter, but it all worries me gravely.

It worries me a lot.


Gravatar >>> from System.IO import File
>>> bytes = File.ReadAllBytes(filePath)

(IIRC).

Let it not be said that IPY is more verbose than vanilla Python


Name:

Email:

URL:

Comment:  ? 


 

Commenting by HaloScan