|
From: | Mike Willis |
Subject: | Re: [Discuss-gnuradio] Problems with Gnuradio-Companion |
Date: | Sat, 22 Nov 2014 17:26:21 -0000 |
Hi Tom Thanks for spotting this one. There isn’t anything in the documentation on it. No doubt it would be obvious to python developers and it is assumed we all know, but I wonder if that is true? Especially as we are writing to XML describing the interface to a C++ program. Now I know I am not very clever but how would I know what are reserved python codes? It would be obvious to a c programmer not to call something float or int, from, for class and so on. I looked up on the web for reserved python keywords: Reserved Words You may not name your variables any of the following words as they mean special things in Python:
Do NOT use any of the following words either (although they are not strictly Python reserved words, they conflict with the names of commonly-used Python functions):
You should also avoid all the names defined in the math library (you must avoid them if you import the library):
I would never have guessed not to use lambda. It is just the sort of thing I might chose for a wavelength input but “id” is not one of these. It’s a function:
Somewhere in the documentation, it would be really useful to have a list of reserved words and function names we can’t use, or even better some checking of the XML to warn people. It ought to be clear from the context that a user is not attempting to call a python function in describing a variable name. It is probably also the case that any function in any library that is imported is also not usable. Mike From: address@hidden [mailto:address@hidden On Behalf Of Tom Rondeau On Sat, Nov 22, 2014 at 11:08 AM, Mike Willis <address@hidden> wrote:
$ ipython In [1]: help(id) Help on built-in function id in module __builtin__: id(...) id(object) -> integer Return the identity of an object. This is guaranteed to be unique among simultaneously existing objects. (Hint: it's the object's memory address.) GRC runs in Python. It outputs Python code. You tried to use a reserved Python keyword. Tom |
[Prev in Thread] | Current Thread | [Next in Thread] |