Re: pygame - importing GL - very bad...

2013-01-06 Thread alex23
On Jan 6, 5:49 am, someone newsbo...@gmail.com wrote: I thought that python also used true pass-by-reference, although I haven't figured out exactly when I have this problem. I can just see that sometimes I get this problem and then I need to copy the variable, if I don't want the original

Re: pygame - importing GL - very bad...

2013-01-06 Thread someone
On 01/06/2013 12:37 PM, alex23 wrote: On Jan 6, 5:49 am, someone newsbo...@gmail.com wrote: I thought that python also used true pass-by-reference, although I haven't figured out exactly when I have this problem. I can just see that sometimes I get this problem and then I need to copy the

Re: pygame - importing GL - very bad...

2013-01-05 Thread someone
On 01/05/2013 02:30 AM, Dave Angel wrote: from opengl import gl, glu, glut gl.rotate(...) gl.clear(gl.COLOR_BUFFER_BIT) Erhm, that's the same as above. Is that what you meant to write? No, it's not the same; here he did not capitalize the function names. Previously they look like class

Re: pygame - importing GL - very bad...

2013-01-05 Thread Dave Angel
On 01/05/2013 05:49 AM, someone wrote: On 01/05/2013 02:30 AM, Dave Angel wrote: snip Function objects are enormously useful, as you get more adept at using Python. Ok, I'll look forward to that. Recently I had some problems with pass-by-value vs pass-by-reference. I googled the problem

Re: pygame - importing GL - very bad...

2013-01-05 Thread Chris Angelico
On Sat, Jan 5, 2013 at 9:49 PM, someone newsbo...@gmail.com wrote: Ok, I think you're right. At least I find that C-compilers catches many errors/warnings which python don't say anything about. But also C require me to define/declarer the types of variables before I use them... OTOH I guess I

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

Re: pygame - importing GL - very bad...

2013-01-05 Thread someone
On 01/05/2013 12:47 PM, Chris Angelico wrote: C has typed variables, so it's a compile-time error to try to put any other type into that variable. Python doesn't. That flexibility comes at the cost of error-catching. There are hybrid systems, but in general, type declarations imply variable

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

Re: pygame - importing GL - very bad...

2013-01-05 Thread Chris Angelico
On Sun, Jan 6, 2013 at 12:06 AM, someone newsbo...@gmail.com wrote: On 01/05/2013 12:47 PM, Chris Angelico wrote: You can find good references on the subject in various places, but call-by-reference as implemented in Pascal simply doesn't exist in most modern languages, because its semantics

Re: pygame - importing GL - very bad...

2013-01-05 Thread someone
On 01/05/2013 02:27 PM, Chris Angelico wrote: On Sun, Jan 6, 2013 at 12:06 AM, someone newsbo...@gmail.com wrote: In any case I think we understand each other. That's one of the links I just posted :) It's not just a naming difference, though. With Pascal's pass-by-reference semantics, this

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

Re: pygame - importing GL - very bad...

2013-01-04 Thread someone
On 01/03/2013 03:09 PM, Mike C. Fletcher wrote: On 13-01-02 08:53 PM, someone wrote: So this solution is not something I like too... But I can see some other people came up with good solutions, which I didn't knew about.. Why is this solution not to your liking? Python has namespaces for a

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

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

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

Re: pygame - importing GL - very bad...

2013-01-04 Thread Dave Angel
On 01/04/2013 08:10 PM, someone wrote: On 01/03/2013 03:09 PM, Mike C. Fletcher wrote: snip PyOpenGL's current approach is mostly attempting to maintain backward compatibility with the older revisions. wxPython actually rewrote its whole interface to go from * imports into namespaced

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}

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

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

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

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_]

Re: pygame - importing GL - very bad...

2013-01-03 Thread Mike C. Fletcher
On 13-01-02 08:53 PM, someone wrote: On 01/02/2013 10:57 PM, Michael Torrie wrote: On 01/01/2013 04:49 PM, someone wrote: On 01/01/2013 12:13 PM, Chris Angelico wrote: You could simply import OpenGL.GL as GL You're right - but I forgot to write that even though this maybe should/is

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

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

Re: pygame - importing GL - very bad...

2013-01-02 Thread alex23
On Jan 2, 1:01 pm, Nobody nob...@nowhere.com wrote: You can't delete built-in names. Actually, you can. If you ever need to shoot yourself in the foot in this particular way, you can always do: del __builtins__.format Not saying you _should_, just that you _can_ :) --

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

2013-01-02 Thread Peter Otten
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? Another thing is that I don't

Re: pygame - importing GL - very bad...

2013-01-02 Thread someone
On 01/02/2013 10:52 AM, alex23 wrote: On Jan 2, 1:01 pm, Nobody nob...@nowhere.com wrote: You can't delete built-in names. Actually, you can. If you ever need to shoot yourself in the foot in this particular way, you can always do: del __builtins__.format Not saying you _should_, just

Re: pygame - importing GL - very bad...

2013-01-02 Thread someone
On 01/02/2013 08:39 AM, Steven D'Aprano wrote: On Wed, 02 Jan 2013 00:49:36 +0100, someone wrote: What does this mean? Why does it say 'format cannot be deleted after I did the wildcard import ? It means that there is no format in the current scope, which implies that pygame no longer has a

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

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

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

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

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

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

Re: pygame - importing GL - very bad...

2013-01-02 Thread Michael Torrie
On 01/01/2013 04:49 PM, someone wrote: On 01/01/2013 12:13 PM, Chris Angelico wrote: You could simply import OpenGL.GL as GL You're right - but I forgot to write that even though this maybe should/is recommended many places then I've seen a lot of opengl code on the internet and

Re: pygame - importing GL - very bad...

2013-01-02 Thread Andrew Berg
On 2013.01.02 15:57, Michael Torrie wrote: Why is this solution not to your liking? Python has namespaces for a reason. They both keep code separated and modular. Use them. At most you should import the most commonly-used symbols only, and refer to the rest through their respective

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

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

Re: pygame - importing GL - very bad...

2013-01-02 Thread someone
On 01/02/2013 10:57 PM, Michael Torrie wrote: On 01/01/2013 04:49 PM, someone wrote: On 01/01/2013 12:13 PM, Chris Angelico wrote: You could simply import OpenGL.GL as GL You're right - but I forgot to write that even though this maybe should/is recommended many places then I've seen a

Re: pygame - importing GL - very bad...

2013-01-02 Thread someone
On 01/02/2013 11:30 PM, Andrew Berg wrote: On 2013.01.02 15:57, Michael Torrie wrote: *. The only place where I've seen an import * that actually belonged was in an __init__.py that brought sub-module symbols into the main package namespace, and even then I figure there's got to be a better

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

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

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

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

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

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

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

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

pygame - importing GL - very bad...

2013-01-01 Thread someone
See this code (understand why I commented out first line): # from OpenGL.GL import * from OpenGL.GL import glEnable, GL_DEPTH_TEST, \ glShadeModel, GL_SMOOTH, glClearColor, \ GL_CULL_FACE, GL_BLEND, glBlendFunc, \ GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, \ glClear,

Re: pygame - importing GL - very bad...

2013-01-01 Thread Chris Angelico
On Tue, Jan 1, 2013 at 10:00 PM, someone newsbo...@gmail.com wrote: See this code (understand why I commented out first line): # from OpenGL.GL import * from OpenGL.GL import glEnable, GL_DEPTH_TEST, \ glShadeModel, GL_SMOOTH, glClearColor, \ GL_CULL_FACE, GL_BLEND, glBlendFunc, \

Re: pygame - importing GL - very bad...

2013-01-01 Thread Steven D'Aprano
On Tue, 01 Jan 2013 12:00:32 +0100, someone wrote: See this code (understand why I commented out first line): # from OpenGL.GL import * [...] The reason why I commented out the first line is that I use pylint and it reports: [W] Redefining built-in 'format' for this line. From:

Re: pygame - importing GL - very bad...

2013-01-01 Thread Peter Otten
someone wrote: See this code (understand why I commented out first line): # from OpenGL.GL import * from OpenGL.GL import glEnable, GL_DEPTH_TEST, \ glShadeModel, GL_SMOOTH, glClearColor, \ GL_CULL_FACE, GL_BLEND, glBlendFunc, \ GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, \

Re: pygame - importing GL - very bad...

2013-01-01 Thread alex23
On Jan 1, 9:00 pm, someone newsbo...@gmail.com wrote: I can see that pygame hasn't been updated for a long while - not many users use it? It helps if you look in the right place: pygame Last Updated 2012-12-29: https://bitbucket.org/pygame/pygame/src pygame2:

Re: pygame - importing GL - very bad...

2013-01-01 Thread someone
On 01/01/2013 12:13 PM, Chris Angelico wrote: On Tue, Jan 1, 2013 at 10:00 PM, someone newsbo...@gmail.com wrote: See this code (understand why I commented out first line): # from OpenGL.GL import * from OpenGL.GL import glEnable, GL_DEPTH_TEST, \ glShadeModel, GL_SMOOTH,

Re: pygame - importing GL - very bad...

2013-01-01 Thread someone
On 01/01/2013 12:49 PM, Steven D'Aprano wrote: On Tue, 01 Jan 2013 12:00:32 +0100, someone wrote: See this code (understand why I commented out first line): # from OpenGL.GL import * [...] The reason why I commented out the first line is that I use pylint and it reports: [W] Redefining

Re: pygame - importing GL - very bad...

2013-01-01 Thread someone
On 01/01/2013 01:56 PM, Peter Otten wrote: someone wrote: It turns out pylint is lying. The situation is equivalent to $ cat module.py for format in [42]: pass del format $ cat main.py original_format = format from module import * assert format is original_format $ python

Re: pygame - importing GL - very bad...

2013-01-01 Thread someone
On 01/01/2013 11:39 PM, alex23 wrote: On Jan 1, 9:00 pm, someone newsbo...@gmail.com wrote: I can see that pygame hasn't been updated for a long while - not many users use it? It helps if you look in the right place: pygame Last Updated 2012-12-29: https://bitbucket.org/pygame/pygame/src

Re: pygame - importing GL - very bad...

2013-01-01 Thread Nobody
On Wed, 02 Jan 2013 00:49:36 +0100, someone wrote: In [11]: del format --- NameError Traceback (most recent call last) ipython-input-11-028e6ffb84a8 in module() 1 del format

Re: pygame - importing GL - very bad...

2013-01-01 Thread someone
On 01/02/2013 04:01 AM, Nobody wrote: On Wed, 02 Jan 2013 00:49:36 +0100, someone wrote: In [11]: del format --- NameError Traceback (most recent call last) ipython-input-11-028e6ffb84a8 in

Re: pygame - importing GL - very bad...

2013-01-01 Thread Steven D'Aprano
On Wed, 02 Jan 2013 00:49:36 +0100, someone wrote: On 01/01/2013 12:49 PM, Steven D'Aprano wrote: On Tue, 01 Jan 2013 12:00:32 +0100, someone wrote: See this code (understand why I commented out first line): # from OpenGL.GL import * [...] The reason why I commented out the