To whom he want to set breakpoint on negative line number in pdb

2020-12-12 Thread Jach Feng
I use .pdbrc file to help debugging. To avoid editing this file frequently when source was modified, I need this feature. I modify the checkline function in pdb.py from ... line = linecache.getline(filename, lineno, globs) if not line: to ... lines = linecache.get

Re: Unable to pass dict from json.

2020-12-12 Thread MRAB
On 2020-12-13 00:01, Bischoop wrote: Here https://bpa.st/YBVA I've working code with dictionary only if used dict from the code (it's commented now) but when I load it I can print it from load function (line 14) but at all have not a clue how to pass the data so could use them. I've learnt a

Re: Unable to pass dict from json.

2020-12-12 Thread Dan Stromberg
On Sat, Dec 12, 2020 at 4:05 PM Bischoop wrote: > > Here https://bpa.st/YBVA I've working code with dictionary only if used > dict from the code > (it's commented now) but when I load it I can print it from load > function (line 14) but at all have not a > clue how to pass the data so could use

Re: To check if number is in range(x,y)

2020-12-12 Thread Bischoop
On 2020-12-12, Tim Chase wrote: > > Hopefully this gives you the hints that you need to troubleshoot. > > -tkc > > > > Yes it explains a lot. Thanks -- https://mail.python.org/mailman/listinfo/python-list

Unable to pass dict from json.

2020-12-12 Thread Bischoop
Here https://bpa.st/YBVA I've working code with dictionary only if used dict from the code (it's commented now) but when I load it I can print it from load function (line 14) but at all have not a clue how to pass the data so could use them. I've learnt a lot when making it but here I'm comple

Re: Returning from a multiple stacked call at once

2020-12-12 Thread Greg Ewing
On 13/12/20 5:46 am, ast wrote: Here is a code where it would be useful. This code looks for a path in a graph. Recursion is probably not the best way to solve this problem in CPython, because it imposes a limit on the number of nested calls (in order to detect runaway recursion). By default th

Re: Returning from a multiple stacked call at once

2020-12-12 Thread Cameron Simpson
On 12Dec2020 17:46, ast wrote: >Le 12/12/2020 à 09:18, Cameron Simpson a écrit : >>On 12Dec2020 07:39, ast wrote: >>>In case a function recursively calls itself many times, >>>is there a way to return a data immediately without >>>unstacking all functions ? >> >>Not really. Do you have an example

Re: Returning from a multiple stacked call at once

2020-12-12 Thread dn via Python-list
On 13/12/2020 05:46, ast wrote: Le 12/12/2020 à 09:18, Cameron Simpson a écrit : On 12Dec2020 07:39, ast wrote: In case a function recursively calls itself many times, is there a way to return a data immediately without unstacking all functions ? Not really. Do you have an example where this

Re: Function returns old value

2020-12-12 Thread Joe Pfeiffer
Bischoop writes: > On 2020-12-12, Joe Pfeiffer wrote: >> Bischoop writes: >> >>> I've function asking question and comparing it, if is not matching 'yes' >>> it does call itself to ask question again. The problem is that when >>> function is called second time it returns old value or with addit

Re: To check if number is in range(x,y)

2020-12-12 Thread 2QdxY4RzWzUUiLuE
On 2020-12-12 at 10:51:00 -0600, Tim Chase wrote: > If you want numeric-range checks, Python provides the lovely > double-comparison syntax: > > >>> x = 5 > >>> 2 < x < 10 > True Not just numbers: >>> 'm' < 'n' < 'o' True >>> 'one' < 'one point five' < 'two' True Okay,

RE: Returning from a multiple stacked call at once

2020-12-12 Thread Avi Gross via Python-list
As always, it may be useful to know WHY the questioner wants to skip intermediate functions already in progress and jump back to some unspecified earlier level. There is a reason why functions are "stacked" and there are data structures that really may need to be unwound. But if the question is no

Re: Returning from a multiple stacked call at once

2020-12-12 Thread Dieter Maurer
ast wrote at 2020-12-12 07:39 +0100: >In case a function recursively calls itself many times, >is there a way to return a data immediately without >unstacking all functions ? Python does not have "long jump"s (out of many functions, many loop incarnations). In some cases, you can use exceptions to

Re: To check if number is in range(x,y)

2020-12-12 Thread Tim Chase
On 2020-12-12 15:12, Bischoop wrote: > I need to check if input number is 1-5. Whatever I try it's not > working. Here are my aproaches to the problem: https://bpa.st/H62A > > What I'm doing wrong and how I should do it? A range is similar to a list in that it contains just the numbers listed:

Re: Returning from a multiple stacked call at once

2020-12-12 Thread Tim Chase
On 2020-12-12 07:39, ast wrote: > In case a function recursively calls itself many times, > is there a way to return a data immediately without > unstacking all functions ? Not that I'm aware of. If you use recursion (and AFAIK, Python doesn't support tail-recursion), you pay all the pushes & pa

Re: Returning from a multiple stacked call at once

2020-12-12 Thread ast
Le 12/12/2020 à 09:18, Cameron Simpson a écrit : On 12Dec2020 07:39, ast wrote: In case a function recursively calls itself many times, is there a way to return a data immediately without unstacking all functions ? Not really. Do you have an example where this is inconvenient? There are alte

Re: Returning from a multiple stacked call at once

2020-12-12 Thread ast
Le 12/12/2020 à 17:10, Oscar a écrit : In article <5fd465b5$0$8956$426a7...@news.free.fr>, ast wrote: Hello In case a function recursively calls itself many times, is there a way to return a data immediately without unstacking all functions ? If you are referring to your "are you ok?" probl

Re: To check if number is in range(x,y)

2020-12-12 Thread Bischoop
Got it solved here: https://bpa.st/BFJA -- https://mail.python.org/mailman/listinfo/python-list

Re: To check if number is in range(x,y)

2020-12-12 Thread Oscar
In article , Bischoop wrote: > >I need to check if input number is 1-5. Whatever I try it's not working. >Here are my aproaches to the problem: https://bpa.st/H62A > >What I'm doing wrong and how I should do it? You need to learn about types. ;-) Input returns a string. That string is not in th

To check if number is in range(x,y)

2020-12-12 Thread Bischoop
I need to check if input number is 1-5. Whatever I try it's not working. Here are my aproaches to the problem: https://bpa.st/H62A What I'm doing wrong and how I should do it? -- Thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: To check if number is in range(x,y)

2020-12-12 Thread Bischoop
I've also convert the choice to int() but doesn't help. -- https://mail.python.org/mailman/listinfo/python-list

Re: Returning from a multiple stacked call at once

2020-12-12 Thread Oscar
In article <5fd465b5$0$8956$426a7...@news.free.fr>, ast wrote: >Hello > >In case a function recursively calls itself many times, >is there a way to return a data immediately without >unstacking all functions ? If you are referring to your "are you ok?" problem, please read up on recursion and wh

Re: To check if number is in range(x,y)

2020-12-12 Thread Bischoop
On 2020-12-12, Oscar wrote: > In article , > Bischoop wrote: >>I've also convert the choice to int() but doesn't help. > > Oh.. did not read this yet. How did you do this? In both places after > the input or during the comparison? If so, in which version? Only the > first version would work. The

Re: To check if number is in range(x,y)

2020-12-12 Thread Oscar
In article , Bischoop wrote: >I've also convert the choice to int() but doesn't help. Oh.. did not read this yet. How did you do this? In both places after the input or during the comparison? If so, in which version? Only the first version would work. The other two are just plain wrong. -- [J|O

Re: Letter replacer - suggestions?

2020-12-12 Thread Cameron Simpson
On 12Dec2020 01:49, Bischoop wrote: >On 2020-12-07, Grant Edwards wrote: >> On 2020-12-07, MRAB wrote: >>> Avoid a 'bare' except unless you _really_ mean it, which is >>> virtually never. Catch only those exceptions that you're going to >>> handle. >> >> And sometimes "handling" is just printing

Re: Returning from a multiple stacked call at once

2020-12-12 Thread Cameron Simpson
On 12Dec2020 07:39, ast wrote: >In case a function recursively calls itself many times, >is there a way to return a data immediately without >unstacking all functions ? Not really. Do you have an example where this is inconvenient? There are alternatives, for example passing in a Queue and put()