Re: Which class method is being called when we declare below expression?

2018-09-27 Thread Ben Finney
Ajay Patel writes: > L = [1,2,3] That's not an expression; it is an assignment statement. The right-hand side is an expression. It will (at the top level) create a list. To create a new instance of the 'list' type, Python will call the type's '__new__' method. This is termed the constructor fo

Re: How to change '\\' to '\'

2018-09-27 Thread Gregory Ewing
Jach Fong wrote: I get a string item, for example path[0], from path = os.get_exec_path() It's something like "\\Borland\\Bcc55\\Include" It doesn't actually have double backslashes in it, that's just a result of how the string is being displayed. No conversion is needed. -- Greg -- https://ma

How to change '\\' to '\'

2018-09-27 Thread Jach Fong
I get a string item, for example path[0], from path = os.get_exec_path() It's something like "\\Borland\\Bcc55\\Include", a Python string. I want to use this "string" in a subprocess command as a parameter. Obviously this command can only recognize "\Borland\Bcc55\Include". I know there must have

Re: clever exit of nested loops

2018-09-27 Thread Gregory Ewing
Neal Becker wrote: but it does violate the principle "Exceptions should be used for exceptional conditions). Python doesn't really go in for that philosophy. Exceptions are often used for flow control, e.g. StopIteration. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: ipython and prompt-toolkit

2018-09-27 Thread Thomas Jollans
On 27/09/2018 07:14, Cecil Westerhof wrote: For a long time I cannot update prompt-toolkit, because ipython requires a version lower as 2. That is why I still use 1.0.15 instead of 2.0.4. Any chance that ipython will be updated concerning this dependency? Well this is an interesting coincidenc

Re: Which class method is being called when we declare below expression?

2018-09-27 Thread Chris Angelico
On Fri, Sep 28, 2018 at 8:52 AM Ajay Patel wrote: > > Hello gauys, > > Which list class method will call for below codes? > > L = [1,2,3] > And > L =[] None. Simple assignment does not call any methods. It just takes the value on the right hand side and says, hey, "L", you now mean that thing, k?

Which class method is being called when we declare below expression?

2018-09-27 Thread Ajay Patel
Hello gauys, Which list class method will call for below codes? L = [1,2,3] And L =[] Thanks, Ajay -- https://mail.python.org/mailman/listinfo/python-list

ipython and prompt-toolkit

2018-09-27 Thread Cecil Westerhof
For a long time I cannot update prompt-toolkit, because ipython requires a version lower as 2. That is why I still use 1.0.15 instead of 2.0.4. Any chance that ipython will be updated concerning this dependency? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/ceci

Re: JPEGImage() hangs

2018-09-27 Thread Brian Oney via Python-list
Could you please try another tool like `convert'? E.g. $ convert 102_PANA/P1020466.JPG test.png What does that say? -- https://mail.python.org/mailman/listinfo/python-list

JPEGImage() hangs

2018-09-27 Thread Chris Green
I have a program which uses jpegtran-cffi 0.5.2 and, while it seems to work OK most of the time it's hanging very solidly on one jpeg file which seems to be OK when viewed with other programs. I'm simply doing:- img = JPEGImage(srcFullFn) I have checked that that srcFullFn points to a real j

Re: What's needed for jpegtran in Python 3?

2018-09-27 Thread John Ladasky
On Thursday, September 27, 2018 at 10:48:16 AM UTC-7, Chris Green wrote: > I think that must be what I have already installed, it doesn't make > the module available in Python 3, it just says this when I try and > install it:- > > root@t470:~# pip install jpegtran-cffi > Requirement alread

Re: What's needed for jpegtran in Python 3?

2018-09-27 Thread Chris Angelico
On Fri, Sep 28, 2018 at 3:51 AM Chris Green wrote: > > Chris Angelico wrote: > > On Fri, Sep 28, 2018 at 2:51 AM Chris Green wrote: > > > > > > I'm converting an existing Python2 program to Python3, it uses > > > jpegtran and I can't find what to install to get this in Python3. > > > > > > Can a

Re: What's needed for jpegtran in Python 3?

2018-09-27 Thread Chris Green
Chris Angelico wrote: > On Fri, Sep 28, 2018 at 2:51 AM Chris Green wrote: > > > > I'm converting an existing Python2 program to Python3, it uses > > jpegtran and I can't find what to install to get this in Python3. > > > > Can anyone advise what I need to install in Python3? > > > > Do you mean

Re: What's needed for jpegtran in Python 3?

2018-09-27 Thread Chris Angelico
On Fri, Sep 28, 2018 at 2:51 AM Chris Green wrote: > > I'm converting an existing Python2 program to Python3, it uses > jpegtran and I can't find what to install to get this in Python3. > > Can anyone advise what I need to install in Python3? > Do you mean this? https://pypi.org/project/jpegtran

What's needed for jpegtran in Python 3?

2018-09-27 Thread Chris Green
I'm converting an existing Python2 program to Python3, it uses jpegtran and I can't find what to install to get this in Python3. Can anyone advise what I need to install in Python3? -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: clever exit of nested loops

2018-09-27 Thread Thomas Jollans
On 2018-09-26 21:06, Mark Lawrence wrote: > > To me the Ned Batchelder presentation > https://www.youtube.com/watch?v=EnSu9hHGq5o "Loop like a Native" is the > definitive way on how to deal with loops in Python. > Hear, hear. Great talk. -- https://mail.python.org/mailman/listinfo/python-list

Re: clever exit of nested loops

2018-09-27 Thread Neal Becker
Christian Gollwitzer wrote: > Am 26.09.18 um 12:28 schrieb Bart: >> On 26/09/2018 10:10, Peter Otten wrote: >>> class Break(Exception): >>> pass >>> >>> try: >>> for i in range(10): >>> print(f'i: {i}') >>> for j in range(10): >>> print(f'\tj: {j}') >>> for k in range(10): >>> print(f'\t\tk: {k}')

Re: clever exit of nested loops

2018-09-27 Thread Christian Gollwitzer
Am 26.09.18 um 12:28 schrieb Bart: On 26/09/2018 10:10, Peter Otten wrote: class Break(Exception): pass try: for i in range(10): print(f'i: {i}') for j in range(10): print(f'\tj: {j}') for k in range(10):   

Re: clever exit of nested loops

2018-09-27 Thread John Ladasky
On Wednesday, September 26, 2018 at 12:50:20 AM UTC-7, vito.d...@gmail.com wrote: > I have "abused" the "else" clause of the loops to makes a break "broke" more > loops I did this once upon a time. In recent years, when I start writing tricky nested loops, I frequently find myself reaching fo