Function error
I am new to python, pls help me to resolve the below error >>> def fib(n): ... """Print a Fibonacci series up to n.""" File "", line 2 """Print a Fibonacci series up to n.""" ^ IndentationError: expected an indented block -- https://mail.python.org/mailman/listinfo/python-list
Re: Function error
On Saturday, June 14, 2014 11:17:50 AM UTC-7, [email protected] wrote: > I am new to python, pls help me to resolve the below error > > > > > > >>> def fib(n): > > ... """Print a Fibonacci series up to n.""" > > File "", line 2 > > """Print a Fibonacci series up to n.""" > > ^ > > IndentationError: expected an indented block Python uses indentation to delineate blocks of code, instead of (for example) curly brackets. Add some white space (the convention is four characters) after at least the first line that ends with a colon, and then indent every line that is in the code block accordingly. Like this: def fib(n): """Print a Fibonacci series up to n.""" do_something() do_something_else() -- https://mail.python.org/mailman/listinfo/python-list
Re: Function error
On 6/14/2014 2:17 PM, [email protected] wrote: I am new to python, pls help me to resolve the below error Please read the nice tutorial, though no necessarily all at once. It explains things like this. def fib(n): ... """Print a Fibonacci series up to n.""" File "", line 2 """Print a Fibonacci series up to n.""" ^ IndentationError: expected an indented block -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: tempfile.py", line 83, in once_lock = _allocate_lock() thread.error: can't allocat lock
On 14Jun2014 10:47, SABARWAL, SHAL wrote: Thanks for responding on this. This is with python version 2.7 . Hi, Please respond to the list, not just to me. And please respond below the quoted text (and trim the quote for relevance). It makes things much easier for everyone to follow the discussion. Python 2.7 has many subreleases. If you issue the command "python" you will get a more precise answer, such as this (from a Mac): Python 2.7.7 (default, Jun 2 2014, 01:33:50) [GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> You can find downloads, incuding source, for Python here: https://www.python.org/download/ which will let you build the latest 2.7 series for your platform. Install it off to the side, for example in /opt/python-2.7.7. Then use that python executable (eg /opt/python-2.7.7/bin/python) to see if the problem still exists. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list
Re: parsley parsing question, how to make a variable grammar
On 06/13/2014 03:05 PM, Eric S. Johansson wrote: > I appreciate any insight before I go too far off track. > --- eric Perhaps this is off-topic, and doesn't answer your question, but is Parsley a natural language parsing tool? If not, and if it is natural language that you're trying to parse, maybe you should see if the natural language toolkit would be more appropriate to your needs. http://www.nltk.org/ >From what I can see, it's *the* framework for parsing and processing natural language text, and happens to be for Python! -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: This Swift thing
On 12 June 2014 03:08, Steven D'Aprano wrote: > We know *much more* about generating energy from E = mc^2 than we know > about optimally flipping bits: our nuclear reactions convert something of > the order of 0.1% of their fuel to energy, that is, to get a certain > yield, we "merely" have to supply about a thousand times more fuel than > we theoretically needed. That's about a thousand times better than the > efficiency of current bit-flipping technology. You're comparing a one-use device to a trillion-use device. I think that's unfair. Tell me when you find an atom splitter that works a trillion times. Then tell me what it's efficiency is, because it's not nearly 0.1%. -- https://mail.python.org/mailman/listinfo/python-list
Python's numeric tower
Does anyone know any examples of values or types from the standard library or well-known third-party libraries which satisfies isinstance(a, numbers.Number) but not isinstance(a, numbers.Complex)? -- Steven D'Aprano http://import-that.dreamwidth.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: This Swift thing
On Sun, 15 Jun 2014 02:51:49 +0100, Joshua Landau wrote: > On 12 June 2014 03:08, Steven D'Aprano > wrote: >> We know *much more* about generating energy from E = mc^2 than we know >> about optimally flipping bits: our nuclear reactions convert something >> of the order of 0.1% of their fuel to energy, that is, to get a certain >> yield, we "merely" have to supply about a thousand times more fuel than >> we theoretically needed. That's about a thousand times better than the >> efficiency of current bit-flipping technology. > > You're comparing a one-use device to a trillion-use device. I think > that's unfair. > > Tell me when you find an atom splitter that works a trillion times. > Then tell me what it's efficiency is, because it's not nearly 0.1%. Nuclear bombs may only get used once, but nuclear reactors get used continuously for years or decades, and like I already said, their efficiency is around 0.1% (mass converted to energy). There are also various types of atomic batteries, such as radioisotope thermoelectric generators, which convert the radiation given off by radioactive substances to electricity. They are typically expected to have an effective working life of a decade or more. -- Steven D'Aprano http://import-that.dreamwidth.org/ -- https://mail.python.org/mailman/listinfo/python-list
