Re: [Tutor] Regex ^$ not behaving as expected

2016-12-08 Thread Edmund Butterworth via Tutor
Dear Danny, That was great, just the information I wanted and very prompt too. I've tried the /f//lags =/ and it works. Thank you so much. I had been banging my head against this for the last two days, googling the universe and even considering going back to PERL, but for a lot of reasons I

Re: [Tutor] function argument unpacking

2016-12-08 Thread Danny Yoo
On Thu, Dec 8, 2016 at 1:11 AM, Alan Gauld via Tutor wrote: > On 08/12/16 06:04, Palanikumar wrote: >> #Function Argument unpacking >> def myfunc(x, y, z): >> print(x. v. z) >> > > Please always send the actual code that generates > the error, do not retype as it causes us to chase > phantom

Re: [Tutor] Regex ^$ not behaving as expected

2016-12-08 Thread Danny Yoo
Following up: drats! Detecting this conceptual TypeError is not feasible under the current design, due to the choice of data representation used in this API. The reason is because the flags are being represented as integers, and we're using bitwise operations to define the union of flags. That i

Re: [Tutor] Regex ^$ not behaving as expected

2016-12-08 Thread Danny Yoo
> I'm still somewhat confused as to what the regexp module is doing when > passing a non-numeric count parameter. That looks like it should > raise a TypeError to me, so perhaps someone needs to file a bug > against the standard library? Unsure. Ok, I'm filing a bug to the Python developers so

Re: [Tutor] Regex ^$ not behaving as expected

2016-12-08 Thread Danny Yoo
Hi Edmund, For each of the cases that surprise you, next time, can you also say what you expected to see? That can help us see where the confusion lies; as it stands, if we have the same mental model as what's happening in Python, then the results look correct to us. :P I can guess at what you

Re: [Tutor] 1 to 49 numbered grid

2016-12-08 Thread Bob Gailer
On Dec 8, 2016 8:52 AM, "M Ali" wrote: > > Hi Team > > I was wondering if you can help me, as I am struggling to create a numbered grid in Python. I am trying to be able to create a snakes and ladders game in Python and it must have a numbered grid and involve 2 players. I would appreciate it if y

Re: [Tutor] 1 to 49 numbered grid

2016-12-08 Thread boB Stepp
Please respond to the entire Tutor list. Also, note that Tutor is a plain text only list so your image is not going to show up. On Thu, Dec 8, 2016 at 9:21 AM, M Ali wrote: > > Hi Bob > > > > Thank you ever so much in getting in touch. I have been given an exemplar work of what I am suppose do b

Re: [Tutor] FW: 1 to 49 numbered grid

2016-12-08 Thread boB Stepp
Forwarding this to the Tutor list. Please note that your formatting will be lost. Again, this is a plain text list. Also, please don't top-post. On Thu, Dec 8, 2016 at 9:38 AM, M Ali wrote: > Hi Bob > > > > I am trying to create the below and wanted an idea as to how I can start it > off. I am

Re: [Tutor] 1 to 49 numbered grid

2016-12-08 Thread boB Stepp
Apologies! My ever friendly Gmail reset my font preferences along the way and put me on a non-monospace font. However, I hope the OP can determine my intent below despite the misalignment of my big one. Cheers! boB On Thu, Dec 8, 2016 at 8:51 AM, boB Stepp wrote: > Greetings! > > On Thu, Dec 8

Re: [Tutor] 1 to 49 numbered grid

2016-12-08 Thread boB Stepp
Greetings! On Thu, Dec 8, 2016 at 4:00 AM, M Ali wrote: > > I was wondering if you can help me, as I am struggling to create a numbered > grid in Python. I am trying to be able to create a snakes and ladders game in > Python and it must have a numbered grid and involve 2 players. I would > app

[Tutor] 1 to 49 numbered grid

2016-12-08 Thread M Ali
Hi Team I was wondering if you can help me, as I am struggling to create a numbered grid in Python. I am trying to be able to create a snakes and ladders game in Python and it must have a numbered grid and involve 2 players. I would appreciate it if you can help me or guide me to create this ga

[Tutor] Regex ^$ not behaving as expected

2016-12-08 Thread Edmund Butterworth via Tutor
Hello, I am new to Python and trying to get to grips with the re regex module. I’m running Python 3.4 under Debian Jessie with a Cinnamon desktop. My understanding is that when the re.M flag is raised, |^| will match at the beginning of the string and also at the beginning of each line withi

Re: [Tutor] function argument unpacking

2016-12-08 Thread Alan Gauld via Tutor
On 08/12/16 06:04, Palanikumar wrote: > #Function Argument unpacking > def myfunc(x, y, z): > print(x. v. z) > Please always send the actual code that generates the error, do not retype as it causes us to chase phantom bugs. In this case the fact that the v in the print statement should be a

Re: [Tutor] function argument unpacking

2016-12-08 Thread Peter Otten
Palanikumar wrote: > File "func.py", line 8 > tuple_vec = {1, 0, 1) > ^ > SyntaxError: invalid syntax The opening and the closing parenthesis have to match. To get a tuple: tuple_vec = (1, 0, 1) To get a set (with two values in undefined order, so not a good match

[Tutor] function argument unpacking

2016-12-08 Thread Palanikumar
#Function Argument unpacking def myfunc(x, y, z): print(x. v. z) tuple_vec = {1, 0, 1) dict_vec = {'x':1, 'y':0, 'z':1} myfunc(*tuple_vec) myfunc(*dict_vec) It returns following error File "func.py", line 8 tuple_vec = {1, 0, 1) ^ SyntaxError: invalid syntax