Re: [Python-Dev] [Python-checkins] peps: PEP 426: replace implied 'version starts with' with new ~= operator
Hi,
On Sat, Feb 23, 2013 at 5:33 AM, daniel.holth
http://hg.python.org/peps/rev/de69fe61f300 changeset: 4764:de69fe61f300 user: Daniel Holth
date: Fri Feb 22 22:33:09 2013 -0500 summary: PEP 426: replace implied 'version starts with' with new ~= operator
I haven't seen any discussion about this, but FWIW CSS [0] and JQuery [1] use ^= for this purpose. ^ also indicates the beginning of the string in regular expressions (this is why ^= was chosen for CSS/JQuery). They also use ~= to indicate "attribute contains word" [0][2]. Perl also has a similar-looking operator [3] (=~) used to test a regex match. Best Regards, Ezio Melotti [0]: http://www.w3.org/TR/selectors/#selectors [1]: http://api.jquery.com/attribute-starts-with-selector/ [2]: http://api.jquery.com/attribute-contains-word-selector/ [3]: http://perldoc.perl.org/perlop.html#Binding-Operators
On Sat, Feb 23, 2013 at 2:24 PM, Ezio Melotti
Hi,
On Sat, Feb 23, 2013 at 5:33 AM, daniel.holth
wrote: http://hg.python.org/peps/rev/de69fe61f300 changeset: 4764:de69fe61f300 user: Daniel Holth
date: Fri Feb 22 22:33:09 2013 -0500 summary: PEP 426: replace implied 'version starts with' with new ~= operator I haven't seen any discussion about this, but FWIW CSS [0] and JQuery [1] use ^= for this purpose. ^ also indicates the beginning of the string in regular expressions (this is why ^= was chosen for CSS/JQuery). They also use ~= to indicate "attribute contains word" [0][2]. Perl also has a similar-looking operator [3] (=~) used to test a regex match.
Daniel is a fan of this syntax, but I think it is inferior to the implied approach, so don't expect it to survive to any accepted version of the PEP :) Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
Nick Coghlan
Daniel is a fan of this syntax, but I think it is inferior to the implied approach, so don't expect it to survive to any accepted version of the PEP :)
Another thing against ~= is that it isn't valid Python syntax. It's not a deal- breaker, but it does mean that you can't e.g. use the ast module in the implementation. This might be a factor if the mini-language ever grows (as it recently did, adding parentheses). Regards, Vinay Sajip
On Sun, Feb 24, 2013 at 12:57 AM, Vinay Sajip
Nick Coghlan
writes: Daniel is a fan of this syntax, but I think it is inferior to the implied approach, so don't expect it to survive to any accepted version of the PEP :)
Another thing against ~= is that it isn't valid Python syntax. It's not a deal- breaker, but it does mean that you can't e.g. use the ast module in the implementation. This might be a factor if the mini-language ever grows (as it recently did, adding parentheses).
Daniel persuaded me that the *semantics* of Ruby's ~> pessimistic version comparison operator are highly desirable. I liked them so much, I'm now proposing them as the default behaviour of version specifiers. Thus, the "~=" operator goes away, and you can use "==" to explicitly request the previously proposed default behaviour, or just append an extra ".0" if you're more pessimistic about a dependency's backwards compatibility policies than the default interpretation. This and other aspects will be brought up on distutils-sig at some point not too far in the future :) Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
participants (3)
-
Ezio Melotti
-
Nick Coghlan
-
Vinay Sajip