[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Overwhelmed by the Simplicity of Python. Any Recommendation?

On 2018-10-12 11:44, Rhodri James wrote:
> On 12/10/18 17:12, Rob Gaddi wrote:
>> On 10/11/2018 11:29 PM, Kaan Taze wrote:
>>> Hi everyone,
>>> Since this is my first post to mail-list I'm kind of hesitant to ask 
>>> this
>>> question here but as many of you spend years working with Python 
>>> maybe some
>>> of you can guide me.
>>> What I trouble with is not a logical error that exist on a program I 
>>> wrote.
>>> It's the Python itself. Well, I'm 22 years old CS student -from 
>>> Turkey- and
>>> what they showed us at university was C Language and Java but I 
>>> mainly use
>>> C in school projects etc. So it's been few months that I started to use
>>> Python for my personal side-projects. There are lots of resources to 
>>> learn
>>> language. I do what I need to do with Python too but I was kinda 
>>> shocked
>>> when I solve Python questions at Hackerrank. Even with list 
>>> comprehensions
>>> you can implement in very smart way to get things done and easy.
>>> Iterations, string operations. The codes I see on the Internet using 
>>> basics
>>> in a very clever way which I couldn't come up with the same solution 
>>> if I
>>> tried to for some time. I do understand this ways but coming from 
>>> ANSI C
>>> makes it hard to see this flexibility. I probably do things in a both
>>> inefficient and hard way in my projects.
>>> How do I get used to this? Is this just another "practice, practice,
>>> practice" situation? Anything you can recommend?
>>> All the best.
>>> Kaan.
>> A) Yes, it's practice practice practice.
>> B) Don't get hung up on finding the clever solution. Comprehensions 
>> and generators and lots of other things are great under some 
>> circumstances for making the code clearer and easier to read, but 
>> they too can become the hammer that makes everything look like a 
>> nail.? The most important thing is that your code is logical, clean, 
>> and easy to understand.? If it doesn't take full advantage of the 
>> language features, or if the performance isn't optimized to within an 
>> inch of its life, well so be it.
> I completely agree.? I too have come from a background in C, and still 
> do most of my day job in C or assembler.? It took a while before I was 
> writing idiomatic Python, never mind efficient Python (arguably I 
> still don't, but as Rob says, who cares?).? Don't worry about it; at 
> some point you will discover that the "obvious" Python you are writing 
> looks a lot like the code you are looking at now and thinking "that's 
> really clever, I'll never be able to to that."

I suggest two things:

 ????? 1.? Document your work as you do it in something like Jupyter 
Notebooks that were discussed in another recent thread.? I use "R 
Markdown Documents" in RStudio.? This allows me to mix Python code with 
text and code for other languages (including R, C, SQL, and others).? I 
tried installing Jupyter using Ananconda Navigator and failed -- under 
both Windows 7 and macOS 10.14.[1]? One consulting gig I had involved 
spending roughly a week creating an "R Markdown Document" mixing text 
with code and results analyzing a client's data, followed by months 
replying to questions by asking, "Did you look at p. ___ in the R 
Markdown Document I gave you" -- plus a few extensions to that 
document.? An article in The Atlantic last April claimed, "The 
scientific research paper is obsolete" and is being replaced by Jupyter 
Notebooks.[2]? I'd like to see a serious comparison of "R Markdown 
Documents" with "Jupyter Notebooks":? The latter may be better, but I 
was unable to even started with them after two days of effort.

 ????? 2.? Find a reasonable "Introduction to Python" on the web. Others 
on this list should be able to suggest several.? I just found 
"https://docs.python.org/2/tutorial/introduction.html";.? A web search 
for "an introduction to Python" identified several others. I'd also be 
interested in reference(s) others might suggest for "creating python 

 ????? Hope this helps.
 ????? Spencer Graves

[1] RStudio offers a free "Desktop" version, which I have used routinely 
for the past three years.? It's available at 
"www.rstudio.com/products/rstudio/download".? Creating "R Markdown 
Documents" (File > "New File" > "R Markdown..." in RStudio) made a 
dramatic improvement in my productivity in many ways similar to those 
described by Paul Romer in 
(I also experimented with File > "New File" > "R Notebook" in RStudio 
and encountered bazaar errors I could not understand -- and no benefits 
that I could see that would push me to spend more time trying to get 
past the problems I encountered.? I've used "R Markdown Documents" 
extensively for three years -- with R -- and I found it easy to use with 
Python once I learned I could do that. See