| 06:21 | <ruby_on_tails> | an arc starts from the rightmost point, how can i change that to the topmost point ? |
| 15:08 | <gsnedders> | jgraham: Have a working copy of html5lib that's gone through 2to3 and 3to2, needing slight work after the latter. 5% quicker at parsing the spec, likely down to no implicit str/unicode conversions. |
| 15:08 | <gsnedders> | (Also, am in Lkpg) |
| 15:29 | <Ms2ger> | gsnedders, \o/ |
| 16:03 | <gsnedders> | So, the main challenge with 3to2: how do I have a string literal which is always the "str" type (i.e., a byte string on Py2 and a unicode string on Py3). |
| 16:10 | <Ms2ger> | Preprocess your python in python |
| 16:33 | <jgraham> | gsnedders: Why do you need that? |
| 16:33 | <jgraham> | If you do then you would do something like: |
| 16:34 | <jgraham> | def foo(x): |
| 16:34 | <jgraham> | if python2: |
| 16:34 | <jgraham> | return str(x) |
| 16:34 | <jgraham> | else: |
| 16:34 | <jgraham> | return unicode(x) |
| 16:34 | <jgraham> | Or whatever the right function names are |
| 16:46 | <zewt> | jgraham: may as well do "foo = str if python2 else unicode" in that case, heh |
| 17:07 | <Ms2ger> | "While Opera has a history of lying to sites for compatibility reasons, most other browsers do not." |
| 17:07 | <Ms2ger> | Orly |
| 17:22 | <jgraham> | Ms2ger: Hahaha |
| 17:22 | <jgraham> | Where's that from? |
| 17:23 | <Ms2ger> | http://lists.w3.org/Archives/Public/public-webapps/2012JulSep/0486.html |
| 17:23 | <jgraham> | Man, Tab should know better than that |
| 19:58 | <gsnedders> | jgraham: Ah, but 2to3 will convert str(x) to unicode(x). |
| 19:58 | <gsnedders> | jgraham: Or rather 3to2. |
| 19:59 | <gsnedders> | jgraham: So you end up with return unicode(x) on both branches. |
| 20:11 | <jarek> | Hi |
| 20:12 | <jarek> | if you specify HSLA values to CSSOM, should it be converted and stored as RGBA? |
| 20:12 | <jarek> | e.g.: |
| 20:12 | <jarek> | element.style.color = 'hsla(100, 40%, 50%, 0.5)' |
| 20:12 | <jarek> | element.style.color |
| 20:13 | <jarek> | > "rgba(110, 179, 76, 0.498039)" |
| 20:13 | <jarek> | this is how it works on both Firefox and Chrome |
| 20:13 | <jarek> | this is not what I would have expected |
| 20:19 | <gsnedders> | Both always return <color> values as rgba. There's a fair bit of sense in this, as all the various CSS syntax forms are stored as a normalized colour value internally, and in Firefox/Chrome it isn't stored what the input form was. |
| 20:24 | <jarek> | uhm... but this rather confusing to anyone using this API |
| 20:26 | <jarek> | e.g. if you are implementing HSL color picker then the information about hue that user has picked is lost |
| 20:27 | <gsnedders> | jarek: It isn't lost, you can get from rgba to hsla. |
| 20:27 | <jarek> | gsnedders: it is lost if both saturation and value were 0 |
| 20:28 | <jgraham> | gsnedders: You haven't really explained why you need something that is always a str |
| 20:29 | <gsnedders> | jgraham: types.ModuleType's first argument is a str in Py2 and a str in Py3. |
| 20:47 | <jgraham> | gsnedders: if hasattr(types, "StringTypes"): getattr(types, "StringTypes")[0]; else: str |
| 20:48 | <jgraham> | Presumably 3to2 isn't clever enough to convert that |
| 20:51 | <gsnedders> | jgraham: Yeah, I was guessing I'd have to do something like that. Which sucks. |
| 20:51 | <jgraham> | Only a little bit |
| 20:52 | <gsnedders> | (The only other issue is an outright bug in 3to2) |
| 20:52 | <gsnedders> | (It deletes a line in a try block. It then doesn't add "pass". Syntax error results.) |
| 20:52 | <jgraham> | http://web.archive.org/web/20010621171122/http://www.mozillazine.org/designpatterns/ |
| 20:52 | <gsnedders> | Still suspect there are other issues around elsewhere in the code. |
| 20:53 | <zewt> | gsnedders: if you just want to get the str function without it being converted, i'd hope __builtins__.str wouldn't be touched |
| 20:54 | <jgraham> | That kind of depends hwo 3to2 works, realy |
| 20:54 | <jgraham> | *really |
| 20:54 | <gsnedders> | zewt: On the other hand, that makes it dependant on default encoding in Py2. |
| 20:55 | <gsnedders> | (Whereas I really just want ISO-8859-1) |
| 20:59 | <jim> | what is a whatwg? |