Python 3- strings or bytes interface
Rob Reilink <[email protected]> Wed, 4 Apr 2012 13:23:34 +0200
| Newsgroups | gmane.comp.python.opengl.devel |
|---|---|
| Message-ID | <[email protected]> |
--===============6566614334277531990== Content-Type: multipart/alternative; boundary=Apple-Mail-1-896612331 --Apple-Mail-1-896612331 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi, I've noticed that under Python3, PyOpenGL inconsistently expects 'str' = and 'bytes' objects as function arguments. For some functions, I'd = expect to use 'str' while in the current implementation 'bytes' is used. E.g. in glGetUniformlocation, the name of the uniform is to be specified = as a 'bytes' object, while I would expect to use 'str' since it is a = name. Also, shaders.compileShader takes a 'str' for the shader code Similarly, extensions.hasGLExtension() expects a 'str' object for the = extension name, but extension.AVAILABLE_GL_EXTENSIONS is a list of = 'bytes'. Of course, for arguments dealing with binary data (e.g. glTexImage2D), a = 'bytes' object is to be used. Apart from the actual implementation, has there been any thought on how = to expose things like uniform names to the user?=20 Rob ps. as a side note: I think for most cases the actual encoding to be = used is not really an issue since shader code, uniform names etc are = restricted to asci anyway. --------------------------------------------- Rob Reilink, M.Sc Science Applied phone: +31 6 187 26562 e-mail: [email protected] --------------------------------------------- --Apple-Mail-1-896612331 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii <html><head></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; = "><div>Hi,</div><div><br></div><div>I've noticed that under Python3, = PyOpenGL inconsistently expects 'str' and 'bytes' objects as function = arguments. For some functions, I'd expect to use 'str' while in the = current implementation 'bytes' is used.</div><div><br></div><div>E.g. in = glGetUniformlocation, the name of the uniform is to be specified as a = 'bytes' object, while I would expect to use 'str' since it is a name. = Also, shaders.compileShader takes a 'str' for the shader = code</div><div><br></div><div>Similarly, extensions.hasGLExtension() = expects a 'str' object for the extension name, but = extension.AVAILABLE_GL_EXTENSIONS is a list of = 'bytes'.</div><div><br></div><div>Of course, for arguments dealing with = binary data (e.g. glTexImage2D), a 'bytes' object is to be = used.</div><div><br></div><div>Apart from the actual implementation, has = there been any thought on how to expose things like uniform names to the = user? </div><div><br></div><div>Rob</div><div><br></div><div>ps. as = a side note: I think for most cases the actual encoding to be used = is not really an issue since shader code, uniform names etc are = restricted to asci anyway.</div><br><div> <div style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; = -webkit-line-break: after-white-space; = "><div>---------------------------------------------<br>Rob Reilink, = M.Sc<br>Science Applied</div><div><br>phone: +31 6 187 = 26562<br>e-mail: <a = href=3D"mailto:[email protected]">[email protected]<= /a><br>---------------------------------------------</div><div><br></div><= /div><br class=3D"Apple-interchange-newline"><br = class=3D"Apple-interchange-newline"> </div> <br></body></html>= --Apple-Mail-1-896612331-- --===============6566614334277531990== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Better than sec? Nothing is better than sec when it comes to monitoring Big Data applications. Try Boundary one-second resolution app monitoring today. Free. http://p.sf.net/sfu/Boundary-dev2dev --===============6566614334277531990== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ PyOpenGL Homepage http://pyopengl.sourceforge.net _______________________________________________ PyOpenGL-Devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyopengl-devel --===============6566614334277531990==--