Re: [openstack-dev] Add a hacking check to not use Python Source Code Encodings (PEP0263)

2014-07-22 Thread Doug Hellmann


On Tue, Jul 22, 2014, at 08:41 AM, Ihar Hrachyshka wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA512
 
 On 21/07/14 17:11, Doug Hellmann wrote:
  
  On Jul 21, 2014, at 4:45 AM, Christian Berendt
  bere...@b1-systems.de wrote:
  
  Hello.
  
  There are some files using the Python source code encodings as
  the first line. That's normally not necessary and I want propose
  to introduce a hacking check to check for the absence of the
  source code encodings.
  
  We need to be testing with Unicode inputs. Will the hacking check
  still support that case?
 
 I suspect it just means that we won't be able to use Unicode
 codepoints in the code, while we still may specify those characters as
 escape sequences, as in:
 
  \N{GREEK CAPITAL LETTER DELTA}  # Using the character name
 '\u0394'
  \u0394  # Using a 16-bit hex value
 '\u0394'
  \U0394  # Using a 32-bit hex value
 '\u0394'
 
 (shamelessly copied from https://docs.python.org/3/howto/unicode.html)

And what is the benefit of doing that? I assume there's some reason for
suggesting this change, but I don't understand it. Is there a tool
breaking on unicode characters now that I haven't heard about, maybe?

Doug

 
  
  Doug
  
  
  Best, Christian.
  
  -- Christian Berendt Cloud Computing Solution Architect Mail:
  bere...@b1-systems.de
  
  B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg /
  http://www.b1-systems.de GF: Ralph Dehner / Unternehmenssitz:
  Vohburg / AG: Ingolstadt,HRB 3537
  
  ___ OpenStack-dev
  mailing list OpenStack-dev@lists.openstack.org 
  http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
 
  
  
  ___ OpenStack-dev
  mailing list OpenStack-dev@lists.openstack.org 
  http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
  
 -BEGIN PGP SIGNATURE-
 Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
 
 iQEcBAEBCgAGBQJTzlv6AAoJEC5aWaUY1u57xK4H/iaHyoE2+0gz5sZHhbMHBXm3
 8Dti0ZOB2D4XEOhaxhXguuaDQQdzYHc3LOj09uzO+7qjgKQa5X7SExYDg7Tz6VaC
 lqgv5mnLZNgt2iNNK0PFGwzYV/n12w513DCuTAxROPKrZuaoMwAZFfqkcf6YGTDg
 tH16qU8nr/1SFZYVE7w/flDRI5gS04yZavIHwuMEzWN5fXebR5TxDe/JRwFNMocI
 jMwSZKY73TBzGlp8ND9bee0Wzv/IbUzjIi/R+FZAhgwK53Dc/jxUGJ9V+aKEox8d
 JdF7yvquOhBQRwuARt9O6IRvN3AG2oT+lcheSA/KAkOZ+1v1oRjNDqkn2Y9KNRk=
 =jGEy
 -END PGP SIGNATURE-
 
 ___
 OpenStack-dev mailing list
 OpenStack-dev@lists.openstack.org
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] Add a hacking check to not use Python Source Code Encodings (PEP0263)

2014-07-22 Thread John Dennis
On 07/21/2014 04:45 AM, Christian Berendt wrote:
 Hello.

 There are some files using the Python source code encodings as the first
 line. That's normally not necessary and I want propose to introduce a
 hacking check to check for the absence of the source code encodings.


I assume you mean you want to prohibit the use of the source code
encoding declaration as opposed to mandating it's use in every file, if
so then ...

NAK. This is a very useful and essential feature, at least for the
specific case of UTF-8. Python 3 source files are defined to be UTF-8
encoded however the same is not true for Python 2 which requires an
explicit source coding for UTF-8. Properly handling
internationalization, especially in the unit tests is critical.
Embedding code points outside the ASCII range via obtuse notation is
both cumbersome and impossible to read without referring to a chart, a
definite drawback. OpenStack in general has not had a great track record
with respect to internationalization, let's not make it more difficult
instead let's embrace those features which promote better
internationalization support.

Given Python 3 has declared the source code encoding is UTF-8 I see no
justification for capriciously declaring Python 2 cannot share the same
encoding. Nor do we want to make it difficult for developers by forcing
them to use unnatural hexadecimal escapes in strings.

However my concerns are strictly limited to UTF-8, I do not think we
should allow any other source code encoding aside from UTF-8. I'd
advocate for a hacking rule to check for any encoding other than UTF-8
(no need to check for ASCII since it's a proper subset of UTF-8). For
example Latin-1 should be flagged as a definite problem.

Do you have a reason for advancing this restriction?

-- 
John


___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


[openstack-dev] Add a hacking check to not use Python Source Code Encodings (PEP0263)

2014-07-21 Thread Christian Berendt
Hello.

There are some files using the Python source code encodings as the first
line. That's normally not necessary and I want propose to introduce a
hacking check to check for the absence of the source code encodings.

Best, Christian.

-- 
Christian Berendt
Cloud Computing Solution Architect
Mail: bere...@b1-systems.de

B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537

___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] Add a hacking check to not use Python Source Code Encodings (PEP0263)

2014-07-21 Thread Doug Hellmann

On Jul 21, 2014, at 4:45 AM, Christian Berendt bere...@b1-systems.de wrote:

 Hello.
 
 There are some files using the Python source code encodings as the first
 line. That's normally not necessary and I want propose to introduce a
 hacking check to check for the absence of the source code encodings.

We need to be testing with Unicode inputs. Will the hacking check still support 
that case?

Doug

 
 Best, Christian.
 
 -- 
 Christian Berendt
 Cloud Computing Solution Architect
 Mail: bere...@b1-systems.de
 
 B1 Systems GmbH
 Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
 GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
 
 ___
 OpenStack-dev mailing list
 OpenStack-dev@lists.openstack.org
 http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev