Re: Syntax question

2020-08-16 Thread Manfred Lotz
On Sun, 16 Aug 2020 06:09:17 -0500 Skip Montanaro wrote: > > Typing is not required by > > Python. However, you may find the extra error-checking helpful... > > I haven't used type hints much, if at all, but my understanding is > that the "extra error-checking" of which you speak is gotten thr

Re: Syntax question

2020-08-16 Thread Skip Montanaro
> Typing is not required by > Python. However, you may find the extra error-checking helpful... I haven't used type hints much, if at all, but my understanding is that the "extra error-checking" of which you speak is gotten through other static checkers, correct? I know the syntax was developed wi

Re: Syntax question

2020-08-16 Thread Manfred Lotz
On Sun, 16 Aug 2020 10:12:04 +0200 Klaus Jantzen wrote: > Hi, > > the other day I came across the book "Classic Computer Science > Problems in Python" by David Kopec. > > The function definitions in the examples  like > > = > def fib2(n: int) -> int: >     if n < 2:  # base case >   

Re: Syntax question

2020-08-16 Thread dn via Python-list
On 16/08/2020 20:12, Klaus Jantzen wrote: Hi, the other day I came across the book "Classic Computer Science Problems in Python" by David Kopec. The function definitions in the examples  like = def fib2(n: int) -> int:     if n < 2:  # base case     return n     return fib2(n - 2)

Syntax question

2020-08-16 Thread Klaus Jantzen
Hi, the other day I came across the book "Classic Computer Science Problems in Python" by David Kopec. The function definitions in the examples  like = def fib2(n: int) -> int:     if n < 2:  # base case     return n     return fib2(n - 2) + fib2(n - 1)  # recursive case if __name__

Re: syntax question

2018-06-02 Thread Chris Angelico
On Sat, Jun 2, 2018 at 9:08 PM, Sharan Basappa wrote: > Can anyone please tell me what the following line in a python program does: > > line = lambda x: x + 3 > > I have pasted the entire code below for reference: > > from scipy.optimize import fsolve > import numpy as np > line = lambda x: x + 3

Re: syntax question

2018-06-02 Thread Timo Furrer
>From the Python documentation at https://docs.python.org/3/tutorial/controlflow.html#lambda-expressions > Small anonymous functions can be created with the lambda keyword. This function returns the sum of its two arguments: lambda a, b

syntax question

2018-06-02 Thread Sharan Basappa
Can anyone please tell me what the following line in a python program does: line = lambda x: x + 3 I have pasted the entire code below for reference: from scipy.optimize import fsolve import numpy as np line = lambda x: x + 3 solution = fsolve(line, -2) print solution -- https://mail.python.org

Re: General computer language, syntax question.

2016-03-01 Thread Steven D'Aprano
On Tue, 1 Mar 2016 12:56 am, jonas.thornv...@gmail.com wrote: > I mean for for example Javascript Jonas, this is a Python forum. If we thought Javascript was a beautiful and well-designed language, we're be on a Javascript forum, complaining about Python. > if (typeof array[index] !== 'undefine

Re: General computer language, syntax question.

2016-02-29 Thread Joel Goldstick
On Mon, Feb 29, 2016 at 9:39 AM, Mark Lawrence wrote: > On 29/02/2016 13:45, jonas.thornv...@gmail.com wrote: > >> I have a problem programming uniform networks, "x nodes with y links" >> that turn out to be really hairy to solve for me and i feel i really lack >> the programming features >> >> "

Re: General computer language, syntax question.

2016-02-29 Thread Ian Kelly
On Feb 29, 2016 7:11 AM, wrote: > > Sorry but would not if (array==empty) suffice and be alot clearer? In Python, you can just do "if len(array) == 0" or "if not array". In JavaScript you have "if (array.length === 0)". Is there some problem with that? I would prefer this over your suggestion s

Re: General computer language, syntax question.

2016-02-29 Thread Mark Lawrence
On 29/02/2016 13:45, jonas.thornv...@gmail.com wrote: I have a problem programming uniform networks, "x nodes with y links" that turn out to be really hairy to solve for me and i feel i really lack the programming features "Actually i program in javascript" but the problem seem general for all

Re: General computer language, syntax question.

2016-02-29 Thread Joel Goldstick
On Mon, Feb 29, 2016 at 9:05 AM, wrote: > Den måndag 29 februari 2016 kl. 14:57:04 UTC+1 skrev jonas.t...@gmail.com: > > Den måndag 29 februari 2016 kl. 14:45:37 UTC+1 skrev > jonas.t...@gmail.com: > > > I have a problem programming uniform networks, "x nodes with y links" > that turn out to be r

Re: General computer language, syntax question.

2016-02-29 Thread jonas . thornvall
Den måndag 29 februari 2016 kl. 14:57:04 UTC+1 skrev jonas.t...@gmail.com: > Den måndag 29 februari 2016 kl. 14:45:37 UTC+1 skrev jonas.t...@gmail.com: > > I have a problem programming uniform networks, "x nodes with y links" that > > turn out to be really hairy to solve for me and i feel i really

Re: General computer language, syntax question.

2016-02-29 Thread MRAB
On 2016-02-29 13:45, jonas.thornv...@gmail.com wrote: I have a problem programming uniform networks, "x nodes with y links" that turn out to be really hairy to solve for me and i feel i really lack the programming features "Actually i program in javascript" but the problem seem general for all

Re: General computer language, syntax question.

2016-02-29 Thread Joel Goldstick
On Mon, Feb 29, 2016 at 8:45 AM, wrote: > I have a problem programming uniform networks, "x nodes with y links" that > turn out to be really hairy to solve for me and i feel i really lack the > programming features > > "Actually i program in javascript" but the problem seem general for all > prog

Re: General computer language, syntax question.

2016-02-29 Thread jonas . thornvall
Den måndag 29 februari 2016 kl. 14:45:37 UTC+1 skrev jonas.t...@gmail.com: > I have a problem programming uniform networks, "x nodes with y links" that > turn out to be really hairy to solve for me and i feel i really lack the > programming features > > "Actually i program in javascript" but th

General computer language, syntax question.

2016-02-29 Thread jonas . thornvall
I have a problem programming uniform networks, "x nodes with y links" that turn out to be really hairy to solve for me and i feel i really lack the programming features "Actually i program in javascript" but the problem seem general for all programming languages including Pyhton. For a beauti

Re: A syntax question

2014-11-11 Thread alister
On Mon, 10 Nov 2014 19:53:56 -0500, Dennis Lee Bieber wrote: > On Mon, 10 Nov 2014 14:56:11 GMT, alister > declaimed the following: > >>On Mon, 10 Nov 2014 14:54:55 +, alister wrote: >> >>> On Mon, 10 Nov 2014 14:44:53 +, Grant Edwards wrote: >>> On 2014-11-10, David Palao wrote:

Re: A syntax question

2014-11-10 Thread Tim Chase
On 2014-11-10 20:08, Mark Lawrence wrote: > On 10/11/2014 11:31, David Palao wrote: > >> My crystal ball is currently in for repair and is not expected > >> back in the foreseeable future. > > > > Without a crystal ball, this prediction might be not well founded. > > > > Especially in the future w

Re: A syntax question

2014-11-10 Thread Mark Lawrence
On 10/11/2014 11:31, David Palao wrote: My crystal ball is currently in for repair and is not expected back in the foreseeable future. Without a crystal ball, this prediction might be not well founded. Especially in the future when sombody asks "Who the hell was he replying to?". -- My fe

Re: A syntax question

2014-11-10 Thread Roy Smith
In article , Chris Angelico wrote: > On Tue, Nov 11, 2014 at 3:11 AM, Grant Edwards > wrote: > > I know, but in c.l.p, even jokes get nicely pednatic answers. > > And in c.l.p, odd jokes get even more pedantic spelling corrections. > > ChrisA a n d i m a g i n a r y j o k e s g e t r o

Re: A syntax question

2014-11-10 Thread Chris Angelico
On Tue, Nov 11, 2014 at 3:11 AM, Grant Edwards wrote: > I know, but in c.l.p, even jokes get nicely pednatic answers. And in c.l.p, odd jokes get even more pedantic spelling corrections. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: A syntax question

2014-11-10 Thread Grant Edwards
On 2014-11-10, alister wrote: > On Mon, 10 Nov 2014 14:44:53 +, Grant Edwards wrote: > >> On 2014-11-10, David Palao wrote: >> My crystal ball is currently in for repair and is not expected back in the foreseeable future. >>> >>> Without a crystal ball, this prediction might be not

Re: A syntax question

2014-11-10 Thread Joel Goldstick
On Mon, Nov 10, 2014 at 9:54 AM, Chris Angelico wrote: > On Tue, Nov 11, 2014 at 1:35 AM, Joel Goldstick > wrote: >> Your problem is that count is not local. You are reading count from >> an outer scope. When you try to increment count in your function, it >> can't because it doesn't exist. >>

Re: A syntax question

2014-11-10 Thread Peter Otten
Joel Goldstick wrote: > On Mon, Nov 10, 2014 at 6:39 AM, Wolfgang Maier > wrote: >> You may want to read: >> >> https://docs.python.org/3/faq/programming.html?highlight=global#why-am-i-getting-an-unboundlocalerror-when-the-variable-has-a-value >> >> from the Python docs Programming FAQ section. >

Re: A syntax question

2014-11-10 Thread alister
On Mon, 10 Nov 2014 14:54:55 +, alister wrote: > On Mon, 10 Nov 2014 14:44:53 +, Grant Edwards wrote: > >> On 2014-11-10, David Palao wrote: >> My crystal ball is currently in for repair and is not expected back in the foreseeable future. >>> >>> Without a crystal ball, this p

Re: A syntax question

2014-11-10 Thread alister
On Mon, 10 Nov 2014 14:44:53 +, Grant Edwards wrote: > On 2014-11-10, David Palao wrote: > >>> My crystal ball is currently in for repair and is not expected back in >>> the foreseeable future. >> >> Without a crystal ball, this prediction might be not well founded. > > That isn't a predict

Re: A syntax question

2014-11-10 Thread Chris Angelico
On Tue, Nov 11, 2014 at 1:35 AM, Joel Goldstick wrote: > Your problem is that count is not local. You are reading count from > an outer scope. When you try to increment count in your function, it > can't because it doesn't exist. > Don't use globals. False analysis, I'm afraid. The problem is t

Re: A syntax question

2014-11-10 Thread Grant Edwards
On 2014-11-10, David Palao wrote: >> My crystal ball is currently in for repair and is not expected back >> in the foreseeable future. > > Without a crystal ball, this prediction might be not well founded. That isn't a prediction. It's an explicit statement of no prediction. He said that it is

Re: A syntax question

2014-11-10 Thread Joel Goldstick
On Mon, Nov 10, 2014 at 6:39 AM, Wolfgang Maier wrote: > You may want to read: > > https://docs.python.org/3/faq/programming.html?highlight=global#why-am-i-getting-an-unboundlocalerror-when-the-variable-has-a-value > > from the Python docs Programming FAQ section. > It explains your problem pretty

Re: A syntax question

2014-11-10 Thread Wolfgang Maier
You may want to read: https://docs.python.org/3/faq/programming.html?highlight=global#why-am-i-getting-an-unboundlocalerror-when-the-variable-has-a-value from the Python docs Programming FAQ section. It explains your problem pretty well. As others have hinted at, always provide concrete Python

Re: A syntax question

2014-11-10 Thread David Palao
> My crystal ball is currently in for repair and is not expected back in > the foreseeable future. Without a crystal ball, this prediction might be not well founded. -- https://mail.python.org/mailman/listinfo/python-list

Re: A syntax question

2014-11-10 Thread alister
On Mon, 10 Nov 2014 12:07:58 +0100, Mok-Kong Shen wrote: > I don't understand the following phenomenon. Could someone kindly > explain it? Thanks in advance. > > M. K. Shen > > - > > count=5 > > def test(): >print(count) >if count==5: >

A syntax question

2014-11-10 Thread Mok-Kong Shen
I don't understand the following phenomenon. Could someone kindly explain it? Thanks in advance. M. K. Shen - count=5 def test(): print(count) if count==5: count+=0 ### Error message if this line is active, otherwise ok. print(cou

Re: except clause syntax question

2012-01-31 Thread Mel Wilson
Chris Angelico wrote: > On Wed, Feb 1, 2012 at 9:03 AM, Duncan Booth > wrote: >> Abitrarily nested tuples of exceptions cannot contain loops so the code >> simply needs to walk through the tuples until it finds a match. > > Is this absolutely guaranteed? The C API for CPython provides: > (Py2) h

Re: except clause syntax question

2012-01-31 Thread Chris Angelico
On Wed, Feb 1, 2012 at 12:12 PM, Ian Kelly wrote: > Incidentally, I *think* that any correctly written C code attempting > to nest a tuple inside itself would make the reference count of the > tuple be at least 2 at the time of the call, and so it would fail. Good, nice that that's certain :) Mi

Re: except clause syntax question

2012-01-31 Thread Ian Kelly
On Tue, Jan 31, 2012 at 6:09 PM, Ian Kelly wrote: > On Tue, Jan 31, 2012 at 5:53 PM, Chris Angelico wrote: >> On Wed, Feb 1, 2012 at 9:03 AM, Duncan Booth >> wrote: >>> Abitrarily nested tuples of exceptions cannot contain loops so the code >>> simply needs to walk through the tuples until it fi

Re: except clause syntax question

2012-01-31 Thread Ian Kelly
On Tue, Jan 31, 2012 at 5:53 PM, Chris Angelico wrote: > On Wed, Feb 1, 2012 at 9:03 AM, Duncan Booth > wrote: >> Abitrarily nested tuples of exceptions cannot contain loops so the code >> simply needs to walk through the tuples until it finds a match. > > Is this absolutely guaranteed? The C API

Re: except clause syntax question

2012-01-31 Thread Chris Angelico
On Wed, Feb 1, 2012 at 9:03 AM, Duncan Booth wrote: > Abitrarily nested tuples of exceptions cannot contain loops so the code > simply needs to walk through the tuples until it finds a match. Is this absolutely guaranteed? The C API for CPython provides: (Py2) http://docs.python.org/c-api/tuple.h

Re: except clause syntax question

2012-01-31 Thread Charles Yeomans
On Jan 31, 2012, at 7:12 PM, Terry Reedy wrote: > On 1/31/2012 8:57 AM, Charles Yeomans wrote: > >> In any case, though I appreciate your attempt at a post hoc justification, > > I was hoping for a positive explanation. > > I think the best you are going to get is that Python somewhat consisten

Re: except clause syntax question

2012-01-31 Thread Terry Reedy
On 1/31/2012 8:57 AM, Charles Yeomans wrote: In any case, though I appreciate your attempt at a post hoc justification, > I was hoping for a positive explanation. I think the best you are going to get is that Python somewhat consistently*, for both practical and historical reasons#, uses tupl

Re: except clause syntax question

2012-01-31 Thread Duncan Booth
Charles Yeomans wrote: > To catch more than one exception type in an except block, one writes > > except (A, B, C) as e: > > I'm wondering why it was decided to match tuples, but not lists: > > except [A, B, C] as e: > > The latter makes more sense semantically to me -- "catch all exception >

Re: except clause syntax question

2012-01-31 Thread Charles Yeomans
On Jan 31, 2012, at 8:24 AM, Mel Wilson wrote: > Charles Yeomans wrote: > >> To catch more than one exception type in an except block, one writes >> >> except (A, B, C) as e: >> >> I'm wondering why it was decided to match tuples, but not lists: >> >> except [A, B, C] as e: >> >> The latter

Re: except clause syntax question

2012-01-31 Thread Ethan Furman
Charles Yeomans wrote: On Jan 31, 2012, at 9:51 AM, Steven D'Aprano wrote: On Tue, 31 Jan 2012 08:57:31 -0500, Charles Yeomans wrote: I don't think of a tuple as a container, and I don't think it a misunderstanding on my part to think this. >> Well, it is a misunderstanding, because tuples A

Re: except clause syntax question

2012-01-31 Thread Charles Yeomans
On Jan 31, 2012, at 11:38 AM, Devin Jeanpierre wrote: > On Tue, Jan 31, 2012 at 11:23 AM, Charles Yeomans > wrote: >> >> On Jan 31, 2012, at 9:51 AM, Steven D'Aprano wrote: >> >>> On Tue, 31 Jan 2012 08:57:31 -0500, Charles Yeomans wrote: >>> I don't think of a tuple as a container, and

Re: except clause syntax question

2012-01-31 Thread Devin Jeanpierre
On Tue, Jan 31, 2012 at 11:23 AM, Charles Yeomans wrote: > > On Jan 31, 2012, at 9:51 AM, Steven D'Aprano wrote: > >> On Tue, 31 Jan 2012 08:57:31 -0500, Charles Yeomans wrote: >> >>> I don't think of a tuple as a container, and I don't think it a >>> misunderstanding on my part to think this. >>

Re: except clause syntax question

2012-01-31 Thread Charles Yeomans
On Jan 31, 2012, at 9:51 AM, Steven D'Aprano wrote: > On Tue, 31 Jan 2012 08:57:31 -0500, Charles Yeomans wrote: > >> I don't think of a tuple as a container, and I don't think it a >> misunderstanding on my part to think this. > > Well, it is a misunderstanding, because tuples ARE containers.

Re: except clause syntax question

2012-01-31 Thread Steven D'Aprano
On Tue, 31 Jan 2012 08:57:31 -0500, Charles Yeomans wrote: > I don't think of a tuple as a container, and I don't think it a > misunderstanding on my part to think this. Well, it is a misunderstanding, because tuples ARE containers. You might as well say "I don't think of boxes as containers". W

Re: except clause syntax question

2012-01-31 Thread Charles Yeomans
On Jan 30, 2012, at 7:00 PM, Steven D'Aprano wrote: > On Mon, 30 Jan 2012 12:41:00 -0500, Charles Yeomans wrote: > >> To catch more than one exception type in an except block, one writes >> >> except (A, B, C) as e: >> >> I'm wondering why it was decided to match tuples, but not lists: >> >>

Re: except clause syntax question

2012-01-31 Thread Mel Wilson
Charles Yeomans wrote: > To catch more than one exception type in an except block, one writes > > except (A, B, C) as e: > > I'm wondering why it was decided to match tuples, but not lists: > > except [A, B, C] as e: > > The latter makes more sense semantically to me -- "catch all exception >

Re: except clause syntax question

2012-01-30 Thread Devin Jeanpierre
On Mon, Jan 30, 2012 at 7:00 PM, Steven D'Aprano wrote: > On Mon, 30 Jan 2012 12:41:00 -0500, Charles Yeomans wrote: > >> To catch more than one exception type in an except block, one writes >> >> except (A, B, C) as e: >> >> I'm wondering why it was decided to match tuples, but not lists: >> >> e

Re: except clause syntax question

2012-01-30 Thread Steven D'Aprano
On Mon, 30 Jan 2012 12:41:00 -0500, Charles Yeomans wrote: > To catch more than one exception type in an except block, one writes > > except (A, B, C) as e: > > I'm wondering why it was decided to match tuples, but not lists: > > except [A, B, C] as e: Simplicity. If you also allow lists, the

Re: except clause syntax question

2012-01-30 Thread Mel Wilson
Charles Yeomans wrote: > To catch more than one exception type in an except block, one writes > > except (A, B, C) as e: > > I'm wondering why it was decided to match tuples, but not lists: > > except [A, B, C] as e: > > The latter makes more sense semantically to me -- "catch all exception >

Re: except clause syntax question

2012-01-30 Thread Charles Yeomans
On Jan 30, 2012, at 12:56 PM, Aaron wrote: > On 01/30/2012 06:41 PM, Charles Yeomans wrote: >> To catch more than one exception type in an except block, one writes >> >> except (A, B, C) as e: >> >> I'm wondering why it was decided to match tuples, but not lists: >> >> except [A, B, C] as e: >

Re: except clause syntax question

2012-01-30 Thread Aaron
On 01/30/2012 06:41 PM, Charles Yeomans wrote: To catch more than one exception type in an except block, one writes except (A, B, C) as e: I'm wondering why it was decided to match tuples, but not lists: except [A, B, C] as e: The latter makes more sense semantically to me -- "catch all excep

except clause syntax question

2012-01-30 Thread Charles Yeomans
To catch more than one exception type in an except block, one writes except (A, B, C) as e: I'm wondering why it was decided to match tuples, but not lists: except [A, B, C] as e: The latter makes more sense semantically to me -- "catch all exception types in a list" as opposed to "catch this

Re: Syntax question

2010-06-02 Thread pmz
On 2 Cze, 20:07, Matteo Landi wrote: > Anyway I suggest you to use a syntax like: > > >>>b = list(a) > > in order to copy a list, it should be better than slicing. > > > > > > On Wed, Jun 2, 2010 at 7:56 PM, geremy condra wrote: > > On Wed, Jun 2, 2010 at 10:40 AM, pmz wrote: > >> Dear Group, >

Re: Syntax question

2010-06-02 Thread Matteo Landi
Yes it is; d[i:j] is equal to "give me the array from the d[i] to d[j - 1]", and if you omit i and j then the i and j are respectively assumed as 0 and len(d) - 1. On Wed, Jun 2, 2010 at 8:01 PM, pmz wrote: > On 2 Cze, 19:56, geremy condra wrote: >> On Wed, Jun 2, 2010 at 10:40 AM, pmz wrote: >

Re: Syntax question

2010-06-02 Thread Matteo Landi
Anyway I suggest you to use a syntax like: >>>b = list(a) in order to copy a list, it should be better than slicing. On Wed, Jun 2, 2010 at 7:56 PM, geremy condra wrote: > On Wed, Jun 2, 2010 at 10:40 AM, pmz wrote: >> Dear Group, >> >> It's really rookie question, but I'm currently helping my

Re: Syntax question

2010-06-02 Thread pmz
On 2 Cze, 19:56, geremy condra wrote: > On Wed, Jun 2, 2010 at 10:40 AM, pmz wrote: > > Dear Group, > > > It's really rookie question, but I'm currently helping my wife in some > > python-cases, where I'm non-python developer and some of syntax-diffs > > make me a bit confused. > > > Could anyone

Re: Syntax question

2010-06-02 Thread geremy condra
On Wed, Jun 2, 2010 at 10:40 AM, pmz wrote: > Dear Group, > > It's really rookie question, but I'm currently helping my wife in some > python-cases, where I'm non-python developer and some of syntax-diffs > make me a bit confused. > > Could anyone give some light on line, as following: > "ds = d[:

Re: Syntax question

2010-06-02 Thread Chris Rebert
On Wed, Jun 2, 2010 at 10:40 AM, pmz wrote: > Dear Group, > > It's really rookie question, but I'm currently helping my wife in some > python-cases, where I'm non-python developer and some of syntax-diffs > make me a bit confused. > > Could anyone give some light on line, as following: > "ds = d[:

Syntax question

2010-06-02 Thread pmz
Dear Group, It's really rookie question, but I'm currently helping my wife in some python-cases, where I'm non-python developer and some of syntax-diffs make me a bit confused. Could anyone give some light on line, as following: "ds = d[:]" ### where 'd' is an array Let me guess, is it a declar

Re: Python-3.2 (SVN) bug [was syntax question]

2009-10-12 Thread Mark Dickinson
On Oct 12, 7:55 am, Helmut Jarausch wrote: > I wrote > I'm trying to build the recent Python-3.2a (SVN). > It fails in > Lib/tokenize.py  (line 87) [...] > with: TypeError: group() argument after ** must be a mapping, not tuple I believe I've found the source of this problem: the --with-tsc conf

Re: Python-3.2 (SVN) bug [was syntax question]

2009-10-12 Thread Mark Dickinson
On Oct 12, 7:55 am, Helmut Jarausch wrote: > I wrote > I'm trying to build the recent Python-3.2a (SVN). > It fails in > Lib/tokenize.py  (line 87) > > 85  def group(*choices): return '(' + '|'.join(choices) + ')' > 86  def any(*choices): return group(*choices) + '*' > 87  def maybe(*choices): ret

Python-3.2 (SVN) bug [was syntax question]

2009-10-12 Thread Helmut Jarausch
I wrote I'm trying to build the recent Python-3.2a (SVN). It fails in Lib/tokenize.py (line 87) 85 def group(*choices): return '(' + '|'.join(choices) + ')' 86 def any(*choices): return group(*choices) + '*' 87 def maybe(*choices): return group(*choices) + '?' with: TypeError: group() argum

Re: Syntax question

2009-10-10 Thread Helmut Jarausch
Benjamin Peterson wrote: Helmut Jarausch skynet.be> writes: As I said, it's 'make' in Python's source directory (SVN revision 75309 Last Changed Date: 2009-10-10) I can't reproduce your failure. What are the exact commands you are using? CFLAGS='-O3 -mtune=native -msse2 -pipe' CXXFLAGS=$C

Re: Syntax question

2009-10-10 Thread Benjamin Peterson
Helmut Jarausch skynet.be> writes: > As I said, it's 'make' in Python's source directory > (SVN revision 75309 Last Changed Date: 2009-10-10) I can't reproduce your failure. What are the exact commands you are using? -- http://mail.python.org/mailman/listinfo/python-list

Re: Syntax question

2009-10-10 Thread Helmut Jarausch
Benjamin Peterson wrote: Helmut Jarausch skynet.be> writes: Hi, I'm trying to build the recent Python-3.2a (SVN). It fails in Lib/tokenize.py (line 87) How are you invoking it? As I said, it's 'make' in Python's source directory (SVN revision 75309 Last Changed Date: 2009-10-10) If it

Re: Syntax question

2009-10-10 Thread Benjamin Peterson
Helmut Jarausch skynet.be> writes: > > Hi, > > I'm trying to build the recent Python-3.2a (SVN). > It fails in > Lib/tokenize.py (line 87) How are you invoking it? -- http://mail.python.org/mailman/listinfo/python-list

Syntax question

2009-10-10 Thread Helmut Jarausch
Hi, I'm trying to build the recent Python-3.2a (SVN). It fails in Lib/tokenize.py (line 87) 85 def group(*choices): return '(' + '|'.join(choices) + ')' 86 def any(*choices): return group(*choices) + '*' 87 def maybe(*choices): return group(*choices) + '?' with: TypeError: group() argument

Re: Python syntax question

2008-10-21 Thread Gabriel Genellina
En Mon, 13 Oct 2008 13:50:03 -0300, Daniel <[EMAIL PROTECTED]> escribió: RPyC is use in pyscripter to provide remote debugging. I was having trouble getting the RPyC module working, and the reason is that the RPyC site only provides a download for Python 3 (not sure why, since I suspect that

Re: quick newbie syntax question

2008-10-20 Thread Steven D'Aprano
On Mon, 20 Oct 2008 12:24:14 -0700, Robocop wrote: > oops! Sorry about that, i should have just copied my code directly. I > actually did specify an int in range: >> > year = '2008' >> > month = '09' >> > limit = '31' >> > for i in range(1,int(limit)): > > The code is currently failing due to t

Re: quick newbie syntax question

2008-10-20 Thread Robocop
date = "%s-%s-%s" % (year, month, i) is exactly what i'd like to do. The Table object will just be a mysql table, and the filter function will yield a list filtered for those dates. For my purposes the limit variable will not be static, depending on which day of the month it is i will only want it

Re: quick newbie syntax question

2008-10-20 Thread Larry Bates
Robocop wrote: oops! Sorry about that, i should have just copied my code directly. I actually did specify an int in range: year = '2008' month = '09' limit = '31' for i in range(1,int(limit)): The code is currently failing due to the syntax in the filter, particularly the section "date = yea

Re: quick newbie syntax question

2008-10-20 Thread Robocop
oops! Sorry about that, i should have just copied my code directly. I actually did specify an int in range: > > year = '2008' > > month = '09' > > limit = '31' > > for i in range(1,int(limit)): The code is currently failing due to the syntax in the filter, particularly the section "date = year'-

Re: quick newbie syntax question

2008-10-20 Thread Chris Rebert
On Mon, Oct 20, 2008 at 12:08 PM, Robocop <[EMAIL PROTECTED]> wrote: > Is it possible to do something like this syntactically: > > year = '2008' > month = '09' > limit = '31' > for i in range(1,limit): This previous line will fail. range() takes numbers, not strings. Change 'limit' to an int. >

quick newbie syntax question

2008-10-20 Thread Robocop
Is it possible to do something like this syntactically: year = '2008' month = '09' limit = '31' for i in range(1,limit): temp = Table.objects.filter(date = year'-'month'-'i)

Re: Python syntax question

2008-10-13 Thread Daniel
> > David Blubaugh > > -Original Message- > From: Daniel [mailto:[EMAIL PROTECTED] > Sent: Wednesday, October 08, 2008 3:11 PM > To: [EMAIL PROTECTED] > Subject: Re: Python syntax question > > On Oct 8, 12:07 pm, Marc 'BlackJack' Rintsch <[EMAIL PRO

Re: Python syntax question

2008-10-08 Thread Diez B. Roggisch
Blubaugh, David A. schrieb: Sir, I was just wondering that the module that you are utilizing (Rpyc) is a remote process call module for python? Is this what you are developing with at this time? Are you internetically challenged? http://www.google.de/search?q=rpyc&ie=utf-8&oe=utf-8&aq=t&rls

RE: Python syntax question

2008-10-08 Thread Blubaugh, David A.
, 2008 3:11 PM To: python-list@python.org Subject: Re: Python syntax question On Oct 8, 12:07 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Wed, 08 Oct 2008 11:02:49 -0700, Daniel wrote: > > Here is one error I get when I try to import it: > > >&

Re: Python syntax question

2008-10-08 Thread Daniel
On Oct 8, 12:07 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Wed, 08 Oct 2008 11:02:49 -0700, Daniel wrote: > > Here is one error I get when I try to import it: > > import Rpyc > > Traceback (most recent call last): > >   File "", line 1, in > >   File "C:\Python25\lib\site-pa

Re: Python syntax question

2008-10-08 Thread Marc 'BlackJack' Rintsch
On Wed, 08 Oct 2008 11:02:49 -0700, Daniel wrote: > Here is one error I get when I try to import it: > import Rpyc > Traceback (most recent call last): > File "", line 1, in > File "C:\Python25\lib\site-packages\Rpyc\__init__.py", line 7, in > > from Rpyc.Lib import rpyc_excepthook

Python syntax question

2008-10-08 Thread Daniel
I hope this question is OK for this list. I've downloaded Rpyc and placed it in my site packages dir. On some machines it works fine, on others not so much. Here is one error I get when I try to import it: >>> import Rpyc Traceback (most recent call last): File "", line 1, in File "C:\Pyth

Re: Syntax Question - list multiplication

2007-08-19 Thread James Stroud
MC wrote: > Classic Thanks Michel, but maybe this bit of programming jargon needs some translation for the uninitiated: Classic \Clas"sic\ (kl[a^]s"s[i^]k), Classical \Clas"sic*al\, a. 0. Read the FAQ 1. First rate 2. Greek 3. Refined James -- James Stroud UCLA-DOE Institute for Genomics and

Re: Syntax Question - list multiplication

2007-08-19 Thread Duncan Smith
Roel Schroeven wrote: > Pablo Torres schreef: > >> Hi guys! >> >> I am working on Conway's Game of Life right now and I've run into a >> little problem. >> I represent dead cells with 0s and live ones with 1s. Check this out: >> >> >>> grid = [[0] * 3] * 3 >> >>> grid >> [[0, 0, 0], [0

Re: Syntax Question - list multiplication

2007-08-19 Thread Pablo Torres
Thanks everyone. Now I see why every row in my grid were actually the same object. Pablo -- http://mail.python.org/mailman/listinfo/python-list

Re: Syntax Question - list multiplication

2007-08-19 Thread Roel Schroeven
Pablo Torres schreef: > Hi guys! > > I am working on Conway's Game of Life right now and I've run into a > little problem. > I represent dead cells with 0s and live ones with 1s. Check this out: > > >>> grid = [[0] * 3] * 3 > >>> grid > [[0, 0, 0], [0, 0, 0], [0, 0, 0]] >

Re: Syntax Question - list multiplication

2007-08-19 Thread Thomas Jollans
On Sunday 19 August 2007, Pablo Torres wrote: > Hi guys! > > I am working on Conway's Game of Life right now and I've run into a > little problem. > > I represent dead cells with 0s and live ones with 1s. Check this out: > >>> grid = [[0] * 3] * 3 > >>> grid > > [[0, 0, 0], [0, 0,

Re: Syntax Question - list multiplication

2007-08-19 Thread MC
Classic -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Syntax Question - list multiplication

2007-08-19 Thread Pablo Torres
Hi guys! I am working on Conway's Game of Life right now and I've run into a little problem. I represent dead cells with 0s and live ones with 1s. Check this out: >>> grid = [[0] * 3] * 3 >>> grid [[0, 0, 0], [0, 0, 0], [0, 0, 0]] >>> grid[0][0] = 1 [[1, 0,

PyLint syntax question

2006-11-29 Thread Brendon
Hi, This may seem like a stupid question, but I'd like to know anyway. How do I used pylint's --ignore option to prevent it from looking at some files? The documentation says you have to use a base name. What the heck is a base name? Are there any other ways to stop it looking at certain files

Newbie ZSI / syntax question

2006-03-06 Thread mrstephengross
I'm getting started working with ZSI. I have a client script that looks like this: === import ZSI.client b = ZSI.client.Binding() b.Send('http://...', 'verifyUserRegistered', '00:00:00:00:00:00') === When I run it, I get the following error: ==

Re: syntax question - if 1:print 'a';else:print 'b'

2005-10-28 Thread Christopher Subich
Steve Holden wrote: >> On Thu, 2005-10-27 at 14:00, Gregory Piñero wrote: >> >>> Not quite because if something(3) fails, I still want something(4) to >>> run. > Then the obvious extension: > > for i in range(20): >... > > but I get the idea that Gregory was thinking of different statement

Re: syntax question - if 1:print 'a';else:print 'b'

2005-10-27 Thread James Stroud
On Thursday 27 October 2005 11:16, Carsten Haese wrote: > On Thu, 2005-10-27 at 14:00, Gregory Piñero wrote: > > Not quite because if something(3) fails, I still want something(4) to > > run. > > def something_ignore_exceptions(x): > try: something(x) > except: pass > > something_ignore_excepti

Re: syntax question - if 1:print 'a';else:print 'b'

2005-10-27 Thread Steve Holden
Carsten Haese wrote: > On Thu, 2005-10-27 at 14:00, Gregory Piñero wrote: > >>Not quite because if something(3) fails, I still want something(4) to >>run. > > > def something_ignore_exceptions(x): > try: something(x) > except: pass > > something_ignore_exceptions(1) > something_ignore_exc

Re: syntax question - if 1:print 'a';else:print 'b'

2005-10-27 Thread Carsten Haese
On Thu, 2005-10-27 at 14:00, Gregory Piñero wrote: > Not quite because if something(3) fails, I still want something(4) to > run. def something_ignore_exceptions(x): try: something(x) except: pass something_ignore_exceptions(1) something_ignore_exceptions(2) # etc... HTH, Carsten Haese

Re: syntax question - if 1:print 'a';else:print 'b'

2005-10-27 Thread Gregory Piñero
Not quite because if something(3) fails, I still want something(4) to run.  On 10/27/05, Micah Elliott <[EMAIL PROTECTED]> wrote: If you just want to ignore the exceptions while saving space/typing,you could equivalently do::try:something(1)something(2)# ...except: 

Re: syntax question - if 1:print 'a';else:print 'b'

2005-10-27 Thread Micah Elliott
On Oct 27, Gregory Piñero wrote: > >my goal really was to do: >try:something(1);except:pass >try:something(2);except:pass >try:something(3);except:pass >... >for about 20 lines. If you just want to ignore the exceptions while saving space/typing, you could equivalently do:

  1   2   >