Re: [Tutor] Pythonic way

2018-11-20 Thread Steven D'Aprano
On Tue, Nov 20, 2018 at 08:22:01PM +, Alan Gauld via Tutor wrote: > I think that's a very deliberate feature of Python going back > to its original purpose of being a teaching language that > can be used beyond the classroom. I don't think that is correct -- everything I've read is that

Re: [Tutor] Pythonic way

2018-11-20 Thread Mark Lawrence
On 20/11/2018 18:08, Avi Gross wrote: We have two completely separate ways to format strings that end up with fairly similar functionality. Actually, there is an implicit third way  You could argue five ways :-) 1. C printf style formatting

Re: [Tutor] Pythonic way

2018-11-20 Thread Alan Gauld via Tutor
On 20/11/2018 18:08, Avi Gross wrote: > ... So there isn’t really ONE pythonic way for many things. That's true and, I think, inevitable for anything developed in the open source world. If you compare it to a language entirely controlled by a single mind - like Oberon or Eiffel say - then there

[Tutor] Pythonic way

2018-11-20 Thread Avi Gross
This is not a question or reply. Nor is it short. If not interested, feel free to delete. It is an observation based on recent experiences. We have had quite a few messages that pointed out how some people approach solving a problem using subconscious paradigms inherited from their

Re: [Tutor] how to print lines which contain matching words or strings

2018-11-20 Thread Avi Gross
Asad, Thank you for the clarification. I am glad that you stated (albeit at the end) that you wanted a better idea of how to do it than the code you display. I stripped out the earlier parts of the discussion for storage considerations but they can be found in the archives if needed. There are

Re: [Tutor] how to print lines which contain matching words or strings

2018-11-20 Thread Mats Wichmann
On 11/19/18 8:15 PM, Asad wrote: > Hi Avi Gross /All, > > Thanks for the reply. Yes you are correct , I would like to to > open a file and process a line at a time from the file and want to select > just lines that meet my criteria and print them while ignoring the rest. i > have

Re: [Tutor] how to print lines which contain matching words or strings

2018-11-20 Thread Asad
Hi Avi Gross /All, Thanks for the reply. Yes you are correct , I would like to to open a file and process a line at a time from the file and want to select just lines that meet my criteria and print them while ignoring the rest. i have created the following code : import re