Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-05 Thread Jan Riechers

On 05.01.2013 03:11, someone wrote:

On 01/03/2013 12:27 PM, Chris Angelico wrote:

On Thu, Jan 3, 2013 at 10:19 PM, someone newsbo...@gmail.com wrote:

Doesn't this [ ... ] mean something optional?

What does {2,30}$ mean?

I think $ means that the {2,30} is something in the end of the
sentence...


You can find regular expression primers all over the internet, but to
answer these specific questions: [...] means any of the characters in
the range; the $ means end of string; and {2,30} means at least two,
and at most thirty, of the preceding character. So you have to have
one from the first group, then 2-30 from the second, for a total of
3-31 characters in your names.


Got it, thanks!




Just following the discussion which is very interesting, even so when 
not working with OpenGL (which looks like a nightmare with that naming 
space) :)


But about the regular expressions (a bit deeper look into that):
Like said of Chris:

[a-z]
defines a catching group, in this case all ascii lowercase letters 
ranging from a to z. If noting else is provided, the rule matches 
one letter if there is no range defined by something like:

{} - Target a range of a match/hit

There are also a
? - Lazy match
* - Gready match

[A-Z][0-9]{1,3} means translated:
Look for any uppercase letter in ascii(!) (not öäü or similiar) 
ranging from A to Z.


Now look for any digit (2nd catching group) with the addition to satisfy 
the rule ONLY if there are at least 1 to 3 digits found.
Note: If there are 4 or more digits - the catching rule is still 
satisfied and will provide a match/hit.


If there is a follow up group, the next evaluation is gone through if 
present and so forth. If the expression is satisfied, the match is returned.


The lazy ? and greedy * matches try to satisfy, as the naming 
implies, to match as less or as much of what you have asked for.


For example the regular expression is valid:
0* - Look for a zero, and be greedy as of how many zeros you want match 
which might follow.


Regular expressions don't have to include catching groups in order to work.

But when you use them yourself somehow, its quite simple I think.
I guess you are anyhow busy mangling with pyLint, PEP-Standards and 
pyOpenGL - so good luck with that :)


Jan Riechers

--
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-05 Thread someone

On 01/05/2013 01:49 PM, Jan Riechers wrote:

On 05.01.2013 03:11, someone wrote:
But about the regular expressions (a bit deeper look into that):
Like said of Chris:

[a-z]
defines a catching group, in this case all ascii lowercase letters
ranging from a to z. If noting else is provided, the rule matches
one letter if there is no range defined by something like:
{} - Target a range of a match/hit

There are also a
? - Lazy match
* - Gready match

[A-Z][0-9]{1,3} means translated:
Look for any uppercase letter in ascii(!) (not öäü or similiar)
ranging from A to Z.

Now look for any digit (2nd catching group) with the addition to satisfy
the rule ONLY if there are at least 1 to 3 digits found.
Note: If there are 4 or more digits - the catching rule is still
satisfied and will provide a match/hit.


Ok, thanks a lot for the elaboration... I think I need to work with it 
myself at some time to be sure of understanding it...



If there is a follow up group, the next evaluation is gone through if
present and so forth. If the expression is satisfied, the match is
returned.

The lazy ? and greedy * matches try to satisfy, as the naming
implies, to match as less or as much of what you have asked for.

For example the regular expression is valid:
0* - Look for a zero, and be greedy as of how many zeros you want match
which might follow.

Regular expressions don't have to include catching groups in order to work.

But when you use them yourself somehow, its quite simple I think.
I guess you are anyhow busy mangling with pyLint, PEP-Standards and
pyOpenGL - so good luck with that :)


You're right - I'm a bit overbooked at the moment - but thanks a lot 
for clarifyring this with the regexps :-)




--
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-04 Thread someone

On 01/03/2013 05:52 PM, Terry Reedy wrote:


That seems like a improper error message from the tool.  Invalid name
does *not* properly describe that situation.  The name is *not*
Invalid in any sense of the word, and a checker that tells you it is
is creating needless false-positives.  An error checker should be saying
something like:

 self.lightDone: Does not match PEP8 recommended style

making it clear that this is *not* an error, it is a *style* related
*warning*.


I quite agree. Wanting 3 chars for attribute names is not even PEP-8
style but pylint-author style. I was really surprised at that. In that
case, 'Does not match pylint recommended style.' or even 'configured
styles'. I have not used pylint or pychecker as of yet.


I agree with you all...

Thanks, everyone - now I shall investigate pylint and friends in more 
detail on my own :-)


--
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-04 Thread someone

On 01/03/2013 12:27 PM, Chris Angelico wrote:

On Thu, Jan 3, 2013 at 10:19 PM, someone newsbo...@gmail.com wrote:

Doesn't this [ ... ] mean something optional?

What does {2,30}$ mean?

I think $ means that the {2,30} is something in the end of the sentence...


You can find regular expression primers all over the internet, but to
answer these specific questions: [...] means any of the characters in
the range; the $ means end of string; and {2,30} means at least two,
and at most thirty, of the preceding character. So you have to have
one from the first group, then 2-30 from the second, for a total of
3-31 characters in your names.


Got it, thanks!


--
http://mail.python.org/mailman/listinfo/python-list


Re: Regular expression syntax, was Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-04 Thread someone

On 01/03/2013 12:39 PM, Peter Otten wrote:

someone wrote:


On 01/03/2013 10:00 AM, Peter Otten wrote:

Terry Reedy wrote:


[a-z_][a-z0-9_]{2,30}$) - so I suppose it wants this name to end with
[an
underscore ?


No, it allows underscores. As I read that re, 'rx', etc, do match. They


No, it's one leading letter or underscore [a-z_] plus at least two
letters, underscores or digits [a-z0-9_]{2,30}


Ah, [a-z0-9_]{2,30} means there should be at least two characters and
maximum 30 characters here ?


Yes. See

http://docs.python.org/2/library/re.html#regular-expression-syntax


Thanks - it's on my TODO-list to learn more about how to use these 
regexps...



--
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-04 Thread someone

On 01/03/2013 03:56 AM, Dave Angel wrote:

The first lint program I recall hearing of was available in the early
1980's, and was for the C language.  At the time, the C language was
extremely flexible (in other words, lots of ways to shoot yourself in
the foot) and the compiler was mostly of the philosophy - if there's a
way to make sense of the statement, generate some code, somehow.

Anyway, lint made sense to me as the crud that gets mixed in with the
real fabric.  And a linter is a machine that identifies and removes that
crud.  Well, the lint program didn't remove anything, but it identified
a lot of it.  I didn't hear the term linter till decades later.


Aah, now I understand this lintering and where it came from - thanks a 
lot! :-)


--
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-03 Thread Peter Otten
Terry Reedy wrote:

 [a-z_][a-z0-9_]{2,30}$) - so I suppose it wants this name to end with an
 underscore ?
 
 No, it allows underscores. As I read that re, 'rx', etc, do match. They

No, it's one leading letter or underscore [a-z_] plus at least two letters, 
underscores or digits [a-z0-9_]{2,30}

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-03 Thread someone

On 01/03/2013 03:55 AM, Ian Kelly wrote:

On Wed, Jan 2, 2013 at 7:24 PM, someone newsbo...@gmail.com wrote:



3) self.rx / rself.ry / self.rz: Invalid name rx (should match
[a-z_][a-z0-9_]{2,30}$) - so I suppose it wants this name to end with an
underscore ?


It wants the name to be at least 3 characters long.


Uh, ok, thank you. I'll remember that.

Doesn't this [ ... ] mean something optional?

What does {2,30}$ mean?

I think $ means that the {2,30} is something in the end of the sentence...


--
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-03 Thread someone

On 01/03/2013 10:00 AM, Peter Otten wrote:

Terry Reedy wrote:


[a-z_][a-z0-9_]{2,30}$) - so I suppose it wants this name to end with an
underscore ?


No, it allows underscores. As I read that re, 'rx', etc, do match. They


No, it's one leading letter or underscore [a-z_] plus at least two letters,
underscores or digits [a-z0-9_]{2,30}


Ah, [a-z0-9_]{2,30} means there should be at least two characters and 
maximum 30 characters here ?



--
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-03 Thread Chris Angelico
On Thu, Jan 3, 2013 at 10:19 PM, someone newsbo...@gmail.com wrote:
 Doesn't this [ ... ] mean something optional?

 What does {2,30}$ mean?

 I think $ means that the {2,30} is something in the end of the sentence...

You can find regular expression primers all over the internet, but to
answer these specific questions: [...] means any of the characters in
the range; the $ means end of string; and {2,30} means at least two,
and at most thirty, of the preceding character. So you have to have
one from the first group, then 2-30 from the second, for a total of
3-31 characters in your names.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Regular expression syntax, was Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-03 Thread Peter Otten
someone wrote:

 On 01/03/2013 10:00 AM, Peter Otten wrote:
 Terry Reedy wrote:

 [a-z_][a-z0-9_]{2,30}$) - so I suppose it wants this name to end with
 [an
 underscore ?

 No, it allows underscores. As I read that re, 'rx', etc, do match. They

 No, it's one leading letter or underscore [a-z_] plus at least two
 letters, underscores or digits [a-z0-9_]{2,30}
 
 Ah, [a-z0-9_]{2,30} means there should be at least two characters and
 maximum 30 characters here ?

Yes. See 

http://docs.python.org/2/library/re.html#regular-expression-syntax

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-03 Thread Mike C. Fletcher

On 13-01-02 09:48 PM, Terry Reedy wrote:
...

2) self.lightDone: Invalid name lightDone (should match

[a-z_][a-z0-9_]{2,30}$)

So I can now understand that pylint doesn't like my naming convention
with a capital letter in the middle of the variable name, like:
lightDone = a boolean value. I suppose pylint wants me to use (a
little longer method) an underscore to separate words in long variable
names...


That is more conventional in the Python community (and is in pep 8, I 
believe) but still a choice.
That seems like a improper error message from the tool.  Invalid name 
does *not* properly describe that situation.  The name is *not* 
Invalid in any sense of the word, and a checker that tells you it is 
is creating needless false-positives.  An error checker should be saying 
something like:


self.lightDone: Does not match PEP8 recommended style

making it clear that this is *not* an error, it is a *style* related 
*warning*.


HTH,
Mike

--

  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://www.vrplumber.com
  http://blog.vrplumber.com

--
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-03 Thread Terry Reedy

On 1/3/2013 9:19 AM, Mike C. Fletcher wrote:

On 13-01-02 09:48 PM, Terry Reedy wrote:
...

2) self.lightDone: Invalid name lightDone (should match

[a-z_][a-z0-9_]{2,30}$)

So I can now understand that pylint doesn't like my naming convention
with a capital letter in the middle of the variable name, like:
lightDone = a boolean value. I suppose pylint wants me to use (a
little longer method) an underscore to separate words in long variable
names...


That is more conventional in the Python community (and is in pep 8, I
believe) but still a choice.

That seems like a improper error message from the tool.  Invalid name
does *not* properly describe that situation.  The name is *not*
Invalid in any sense of the word, and a checker that tells you it is
is creating needless false-positives.  An error checker should be saying
something like:

 self.lightDone: Does not match PEP8 recommended style

making it clear that this is *not* an error, it is a *style* related
*warning*.


I quite agree. Wanting 3 chars for attribute names is not even PEP-8 
style but pylint-author style. I was really surprised at that. In that 
case, 'Does not match pylint recommended style.' or even 'configured 
styles'. I have not used pylint or pychecker as of yet.


--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-02 Thread someone

On 01/02/2013 01:07 PM, Peter Otten wrote:

someone wrote:


On 01/01/2013 01:56 PM, Peter Otten wrote:



from module import * # pylint: disable=W0622


Oh, I just learned something new now... How come I cannot type #pylint:
enable=W0622 in the line just below the import ?


With what intended effect?


If I have a section with A LOT OF warnings and I don't want those in 
that section to show up ? Isn't that valid enough?



Another thing is that I don't understand this warning:

Invalid name original_format (should match (([A-Z_][A-Z0-9_]*)|
   (__.*__))$)

I get it everywhere... I don't understand how it wants me to label my
variables... Maybe I should disable this warning to get rid of it...


pylint wants global names to be uppercase (what PEP 8 recommends for
constants) or special (two leading and two trailing underscores):

THATS_OK = 42
__thats_ok_too__ = object()
but_thats_not = spam


OMG... I don't want to type those underscores everywhere... Anyway, 
thank you very much for explaining the meaning of what it wants...




--
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-02 Thread Dave Angel
On 01/02/2013 09:09 AM, someone wrote:
 On 01/02/2013 01:07 PM, Peter Otten wrote:
 someone wrote:

 On 01/01/2013 01:56 PM, Peter Otten wrote:

 from module import * # pylint: disable=W0622

 Oh, I just learned something new now... How come I cannot type
 #pylint:
 enable=W0622 in the line just below the import ?

 With what intended effect?

 If I have a section with A LOT OF warnings and I don't want those in
 that section to show up ? Isn't that valid enough?

 Another thing is that I don't understand this warning:

 Invalid name original_format (should match (([A-Z_][A-Z0-9_]*)|
(__.*__))$)

 I get it everywhere... I don't understand how it wants me to label my
 variables... Maybe I should disable this warning to get rid of it...

 pylint wants global names to be uppercase (what PEP 8 recommends for
 constants) or special (two leading and two trailing underscores):

 THATS_OK = 42
 __thats_ok_too__ = object()
 but_thats_not = spam

 OMG... I don't want to type those underscores everywhere... Anyway,
 thank you very much for explaining the meaning of what it wants...




Global const values should be ALL_CAPS, so it's obvious that nobody
intends to modify them.  It's the non-const global attributes that
expect to be underscored.

You shouldn't have to use those underscores very often.  After all,
there is seldom a need for a non-const global value, right?  Don't think
of it as a pylint problem, but as a hint from pylint that perhaps you
should use fewer globals.



-- 

DaveA

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-02 Thread Chris Angelico
On Wed, Jan 2, 2013 at 11:07 PM, Peter Otten __pete...@web.de wrote:
 someone wrote:
 Another thing is that I don't understand this warning:

 Invalid name original_format (should match (([A-Z_][A-Z0-9_]*)|
   (__.*__))$)

 I get it everywhere... I don't understand how it wants me to label my
 variables... Maybe I should disable this warning to get rid of it...

 pylint wants global names to be uppercase (what PEP 8 recommends for
 constants) or special (two leading and two trailing underscores):

 THATS_OK = 42
 __thats_ok_too__ = object()
 but_thats_not = spam

Okay, I have to ask... why? Does it have an exception for names of classes?

I don't like linters that enforce too much style. Catch things that
might be mis-coded (like C's classic if (x = 1)), but don't complain
about my names. They're MY business.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-02 Thread Ian Kelly
On Wed, Jan 2, 2013 at 7:32 AM, Chris Angelico ros...@gmail.com wrote:
 Okay, I have to ask... why? Does it have an exception for names of classes?

Yes, and for module-level functions.

 I don't like linters that enforce too much style. Catch things that
 might be mis-coded (like C's classic if (x = 1)), but don't complain
 about my names. They're MY business.

pylint is configurable though, so you can disable any warnings you
don't care about.  My pylint macro has a fairly large number of -d
options in it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-02 Thread Chris Angelico
On Thu, Jan 3, 2013 at 4:52 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
 On Wed, Jan 2, 2013 at 7:32 AM, Chris Angelico ros...@gmail.com wrote:
 Okay, I have to ask... why? Does it have an exception for names of classes?

 Yes, and for module-level functions.

Oh, okay. So the check's a lot more specific than the message implies
- it applies only to non-callable module level names. I guess that's
reasonable.

 I don't like linters that enforce too much style. Catch things that
 might be mis-coded (like C's classic if (x = 1)), but don't complain
 about my names. They're MY business.

 pylint is configurable though, so you can disable any warnings you
 don't care about.  My pylint macro has a fairly large number of -d
 options in it.

Yeah, same applies to most linters I think. You end up disagreeing
with the author on half the points. Oh well. Doesn't make the tool
useless, just means you need to fiddle with it to get it how you want
it.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-02 Thread Ian Kelly
On Wed, Jan 2, 2013 at 10:57 AM, Chris Angelico ros...@gmail.com wrote:
 Yeah, same applies to most linters I think. You end up disagreeing
 with the author on half the points. Oh well. Doesn't make the tool
 useless, just means you need to fiddle with it to get it how you want
 it.

It's a lot less work to disable a check than to implement a desired
check that is missing, so to me it's better that a linter do too much
by default than not enough.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-02 Thread Steven D'Aprano
On Wed, 02 Jan 2013 09:26:32 -0500, Dave Angel wrote:

 On 01/02/2013 09:09 AM, someone wrote:
 On 01/02/2013 01:07 PM, Peter Otten wrote:

 pylint wants global names to be uppercase (what PEP 8 recommends for
 constants) or special (two leading and two trailing underscores):

 THATS_OK = 42
 __thats_ok_too__ = object()
 but_thats_not = spam

 OMG... I don't want to type those underscores everywhere... Anyway,
 thank you very much for explaining the meaning of what it wants...




 Global const values should be ALL_CAPS, so it's obvious that nobody
 intends to modify them.

Like math.pi I suppose? *wink*


 It's the non-const global attributes that expect to be underscored.

Pylint is wrong here.

The double-leading-and-trailing-underscore naming scheme is reserved for 
Python itself. PEP 8 explicitly states not to invent your own dunder 
names:

  __double_leading_and_trailing_underscore__: magic objects or
  attributes that live in user-controlled namespaces. E.g. __init__,
  __import__ or __file__. Never invent such names; only use them as
  documented.


The section on global variables does not say to use dunder names:

http://www.python.org/dev/peps/pep-0008/#id31


If pylint says that global variables should be named like __variable__, 
that is explicitly going against PEP 8.


 You shouldn't have to use those underscores very often.  After all,
 there is seldom a need for a non-const global value, right?  Don't think
 of it as a pylint problem, but as a hint from pylint that perhaps you
 should use fewer globals.

That at least is good advice.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-02 Thread Ian Kelly
On Wed, Jan 2, 2013 at 4:52 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 If pylint says that global variables should be named like __variable__,
 that is explicitly going against PEP 8.

It doesn't say that anywhere.  It includes dunder names in the regex
so that you don't get spurious warnings from pylint about the
formatting of names like __all__, nothing more.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-02 Thread someone

On 01/02/2013 03:26 PM, Dave Angel wrote:

On 01/02/2013 09:09 AM, someone wrote:

On 01/02/2013 01:07 PM, Peter Otten wrote:
OMG... I don't want to type those underscores everywhere... Anyway,
thank you very much for explaining the meaning of what it wants...





Global const values should be ALL_CAPS, so it's obvious that nobody
intends to modify them.  It's the non-const global attributes that
expect to be underscored.

You shouldn't have to use those underscores very often.  After all,
there is seldom a need for a non-const global value, right?  Don't think


I suppose you're right.


of it as a pylint problem, but as a hint from pylint that perhaps you
should use fewer globals.


I had some bad code which I improved greatly now with thanks to pylint. 
I'll remember what you've written the next time I look at it - I think I 
don't use that many global non-const values now - I wrapped a lot of 
things into a class now. This is much better and I guess the correct 
object-oriented thing to do. I hope/think I'll get this warning a lot 
fewer times in the future.


Thanks a lot for the explanation.





--
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-02 Thread someone

On 01/03/2013 12:52 AM, Steven D'Aprano wrote:

On Wed, 02 Jan 2013 09:26:32 -0500, Dave Angel wrote:



Global const values should be ALL_CAPS, so it's obvious that nobody
intends to modify them.


Like math.pi I suppose? *wink*


:-)


It's the non-const global attributes that expect to be underscored.


Pylint is wrong here.


Ok, forget my previous post - now I looked a bit deeper into it again. 
Consider this as an example:



# Global mouse states = global constants:
M_LEFT = 1
M_MIDDLE = 2
M_RIGHT = 3
M_WHEEL_UP = 4
M_WHEEL_DOWN = 5

class somethingWork:
 OpenGL something class 

def __init__(self, someInputFile):
self.inputFile = someInputFile
self.running = False
# self.viewport = (800,600)
self.viewport = (1024, 768)
self.lightDone = False
self.rx = 0 # rotation x
self.ry = 0 # rotation y
self.rz = 0 # rotation z
 etc ...


What pylint says is:

1) class somethingWork: Invalid name somethingWork (should match 
[A-Z_][a-zA-Z0-9]+$), I'm not that good at regular exps, but I suppose 
it wants my class name to start with a capital letter ?


2) self.lightDone: Invalid name lightDone (should match 
[a-z_][a-z0-9_]{2,30}$)


So I can now understand that pylint doesn't like my naming convention 
with a capital letter in the middle of the variable name, like: 
lightDone = a boolean value. I suppose pylint wants me to use (a 
little longer method) an underscore to separate words in long variable 
names...


3) self.rx / rself.ry / self.rz: Invalid name rx (should match 
[a-z_][a-z0-9_]{2,30}$) - so I suppose it wants this name to end with an 
underscore ?


I have a lot of these warnings...


The double-leading-and-trailing-underscore naming scheme is reserved for
Python itself. PEP 8 explicitly states not to invent your own dunder
names:

   __double_leading_and_trailing_underscore__: magic objects or
   attributes that live in user-controlled namespaces. E.g. __init__,
   __import__ or __file__. Never invent such names; only use them as
   documented.


I think I would also never use __something__ names...


The section on global variables does not say to use dunder names:

http://www.python.org/dev/peps/pep-0008/#id31


Thanks a lot for this reference...


If pylint says that global variables should be named like __variable__,
that is explicitly going against PEP 8.


I don't think that is what it's saying... But I think it wants me to use 
more underscores, i.e. self.lightDone = self.light_done I think...



You shouldn't have to use those underscores very often.  After all,
there is seldom a need for a non-const global value, right?  Don't think
of it as a pylint problem, but as a hint from pylint that perhaps you
should use fewer globals.


That at least is good advice.


Ok, sorry for my previous post. This post better explains how I've named 
my variables. I don't like it complains about a simple and good variable 
name as self.rx, self.ry, self.rz and so on. These are IMHO very good 
variable names: rotation about x, y and z. Short and precise/accurate. 
I'm not sure if I'll agree with all the warnings it comes up with. But I 
think I could maybe introduce more use of underscores in the middle of 
my variable names, in the future...


Thanks for the extra + good explanations.






--
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-02 Thread someone

On 01/02/2013 08:31 PM, Ian Kelly wrote:

On Wed, Jan 2, 2013 at 10:57 AM, Chris Angelico ros...@gmail.com wrote:

Yeah, same applies to most linters I think. You end up disagreeing
with the author on half the points. Oh well. Doesn't make the tool
useless, just means you need to fiddle with it to get it how you want
it.


It's a lot less work to disable a check than to implement a desired
check that is missing, so to me it's better that a linter do too much
by default than not enough.


I just started using pylint and some of the stuff it came up with is 
REALLY good - so I'll definately use pylint, pep8 (and friends) more in 
the future. And I think I'll also get to a point where I'll disable some 
of the checks - as one of you wrote: How I name my variables is (maybe) 
my own business and for instance I like a short variable name once in a 
while, e.g. rx, ry, rz for rotation around x- y- and z-axises and 
these variable names should not be changed.


But can I ask you something: English is not my native language and I 
looked up what linter means - but it's not in my dictionary. What doet 
linter mean ?


I don't suppose these exlanations are the same as you would give, in the 
context you're using?


http://www.wordreference.com/definition/linter
http://www.collinsdictionary.com/dictionary/american/linter
http://www.merriam-webster.com/dictionary/linter

?

--
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-02 Thread Terry Reedy

On 1/2/2013 9:24 PM, someone wrote:


What pylint says is:

1) class somethingWork: Invalid name somethingWork (should match
[A-Z_][a-zA-Z0-9]+$), I'm not that good at regular exps, but I suppose
it wants my class name to start with a capital letter ?


Yes


2) self.lightDone: Invalid name lightDone (should match
[a-z_][a-z0-9_]{2,30}$)

So I can now understand that pylint doesn't like my naming convention
with a capital letter in the middle of the variable name, like:
lightDone = a boolean value. I suppose pylint wants me to use (a
little longer method) an underscore to separate words in long variable
names...


That is more conventional in the Python community (and is in pep 8, I 
believe) but still a choice.



3) self.rx / rself.ry / self.rz: Invalid name rx (should match
[a-z_][a-z0-9_]{2,30}$) - so I suppose it wants this name to end with an
underscore ?


No, it allows underscores. As I read that re, 'rx', etc, do match. They 
are two chars in the indicated sets. I disagree with requiring 2 chars, 
as .x, .y, are sometimes quite appropriate.


--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-02 Thread Ian Kelly
On Wed, Jan 2, 2013 at 7:24 PM, someone newsbo...@gmail.com wrote:
 1) class somethingWork: Invalid name somethingWork (should match
 [A-Z_][a-zA-Z0-9]+$), I'm not that good at regular exps, but I suppose it
 wants my class name to start with a capital letter ?

Yes, PEP-8 recommends CamelCase for class names.

 2) self.lightDone: Invalid name lightDone (should match
 [a-z_][a-z0-9_]{2,30}$)

 So I can now understand that pylint doesn't like my naming convention with a
 capital letter in the middle of the variable name, like: lightDone = a
 boolean value. I suppose pylint wants me to use (a little longer method) an
 underscore to separate words in long variable names...

Also yes.

 3) self.rx / rself.ry / self.rz: Invalid name rx (should match
 [a-z_][a-z0-9_]{2,30}$) - so I suppose it wants this name to end with an
 underscore ?

It wants the name to be at least 3 characters long.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-02 Thread Dave Angel
On 01/02/2013 09:31 PM, someone wrote:
 On 01/02/2013 08:31 PM, Ian Kelly wrote:
 On Wed, Jan 2, 2013 at 10:57 AM, Chris Angelico ros...@gmail.com
 wrote:
 Yeah, same applies to most linters I think. You end up disagreeing
 with the author on half the points. Oh well. Doesn't make the tool
 useless, just means you need to fiddle with it to get it how you want
 it.

 It's a lot less work to disable a check than to implement a desired
 check that is missing, so to me it's better that a linter do too much
 by default than not enough.

 I just started using pylint and some of the stuff it came up with is
 REALLY good - so I'll definately use pylint, pep8 (and friends) more
 in the future. And I think I'll also get to a point where I'll disable
 some of the checks - as one of you wrote: How I name my variables is
 (maybe) my own business and for instance I like a short variable name
 once in a while, e.g. rx, ry, rz for rotation around x- y- and
 z-axises and these variable names should not be changed.

 But can I ask you something: English is not my native language and I
 looked up what linter means - but it's not in my dictionary. What
 doet linter mean ?

 I don't suppose these exlanations are the same as you would give, in
 the context you're using?

 http://www.wordreference.com/definition/linter
 http://www.collinsdictionary.com/dictionary/american/linter
 http://www.merriam-webster.com/dictionary/linter

 ?


The first lint program I recall hearing of was available in the early
1980's, and was for the C language.  At the time, the C language was
extremely flexible (in other words, lots of ways to shoot yourself in
the foot) and the compiler was mostly of the philosophy - if there's a
way to make sense of the statement, generate some code, somehow.

Anyway, lint made sense to me as the crud that gets mixed in with the
real fabric.  And a linter is a machine that identifies and removes that
crud.  Well, the lint program didn't remove anything, but it identified
a lot of it.  I didn't hear the term linter till decades later.




-- 

DaveA

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-02 Thread Ben Finney
Ian Kelly ian.g.ke...@gmail.com writes:

 On Wed, Jan 2, 2013 at 7:24 PM, someone newsbo...@gmail.com wrote:
  1) class somethingWork: Invalid name somethingWork (should match
  [A-Z_][a-zA-Z0-9]+$), I'm not that good at regular exps, but I
  suppose it wants my class name to start with a capital letter ?

 Yes, PEP-8 recommends CamelCase for class names.

PEP 8 discourages camelCase for names except for compatibility purposes,
and recommends TitleCase for class names.

-- 
 \   “I'm having amnesia and déjà vu at the same time. I feel like |
  `\  I've forgotten this before sometime.” —Steven Wright |
_o__)  |
Ben Finney

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pylint, was Re: pygame - importing GL - very bad...

2013-01-02 Thread Chris Rebert
On Wed, Jan 2, 2013 at 10:01 PM, Ben Finney ben+pyt...@benfinney.id.au wrote:
 Ian Kelly ian.g.ke...@gmail.com writes:

 On Wed, Jan 2, 2013 at 7:24 PM, someone newsbo...@gmail.com wrote:
  1) class somethingWork: Invalid name somethingWork (should match
  [A-Z_][a-zA-Z0-9]+$), I'm not that good at regular exps, but I
  suppose it wants my class name to start with a capital letter ?

 Yes, PEP-8 recommends CamelCase for class names.

 PEP 8 discourages camelCase for names except for compatibility purposes,
 and recommends TitleCase for class names.

If we must quibble over meta-nomenclature...
http://www.python.org/dev/peps/pep-0008/ :

The following naming styles are commonly distinguished:
[...]
* CapitalizedWords (or CapWords, or CamelCase -- so named because of
the bumpy look of its letters [3]). […]
* mixedCase (differs from CapitalizedWords by initial lowercase character!)


The term TitleCase does not make an appearance in the document.

Regards,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list