As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/
Options

How to learn python?

SerpentSerpent Sometimes Vancouver, BC, sometimes Brisbane, QLDRegistered User regular
Hey! Just wondering what everyone / anyone thinks is the best starting point for learning python?

For reference, I have a strong programming background (pascal C C++ Fortran Java C# etc), advanced mathematics (publishing papers), statistical things (R), cloud (AWS), SQL... data warehousing... machine learning data science blah blah insert more buzzwords here.

I just don't use python cause I never need to cause I can do everything else. Just time to fill the hole. Every once in awhile I came across an application where I feel python would be the appropriate tool to use but I and my team don't have expertise there, and the barrier to entry compared to just using what we already use is higher.

Posts

  • Options
    ArbitraryDescriptorArbitraryDescriptor changed Registered User regular
    I got started with python by having a problem to solve and figuring that was as good a time as any to check out python. Now I use it in all kinds of ways and places.

    Everything I know about python, I learned from a Google search or directly hitting up http://docs.python.org. Skimming the latter should serve all your initial syntax and "can it do X by default" questions.

    There isn't much you can't use python for, so for someone as familiar with general programming concepts as you are, I suspect it's more a question of learning what modules are available and identifying targets of opportunity, and not a matter of learning how to write it.

    So I would suggest just diving in. Take some task you do, write a script to facilitate some aspect of it, and go from there.

    As jars are to dlls, pys are to jars. So you can just keep building on your (or anyone's) existing utility libraries without any linking headaches, and they're just text files you don't ever compile.

    If it helps, general usage examples:

    - Batch file system operations (batch console operations in general)

    - Smoothing over rough spots in a workflow; ex: automating simple tasks prone to human error; checking if simple humans made a task error.

    - One-shot data processing; like translating a bunch of disparate data into some standard format to be fed into some other system

    - A temporary bridge between different data systems that wind up becoming permanent, because, hey, it works and I have shit to do

    - General kludgery, like writing scripts that write other scripts then run those scripts because sometimes ridiculous problems don't deserve non-ridiculous solutions. (Or allow them..)

  • Options
    DarkewolfeDarkewolfe Registered User regular
    If you've already got a decent background, there's a reasonably not shitty humble bundle for python going right now that you might as well $15 and tinker with. At least one of the tiers has some starter projects that should be enough to get you rolling.

    What is this I don't even.
  • Options
    JusticeJustice Registered User regular
    I always wanted to do this: http://www.roguebasin.com/index.php?title=Complete_Roguelike_Tutorial,_using_python+libtcod

    Except I have no interest in Python.

  • Options
    schussschuss Registered User regular
    I've heard good things about datacamps offerings and pluralsight has some good stuff. EdX also has a good offering centered around pyspark.
    It also depends on what you're doing with it, as python for data science will use different libraries than application focused python.

  • Options
    credeikicredeiki Registered User regular
    If you're a machine learning person, you might choose scikit-learn as a good entry to python. Choose a dataset you've already analyzed with your usual, and do the same with python instead--by the time you're done, you'll end up familiar with the scipy stack (numpy, scipy, matplotlib for graphs)

    Steam, LoL: credeiki
  • Options
    ArbitraryDescriptorArbitraryDescriptor changed Registered User regular
    schuss wrote: »
    I've heard good things about datacamps offerings and pluralsight has some good stuff. EdX also has a good offering centered around pyspark.
    It also depends on what you're doing with it, as python for data science will use different libraries than application focused python.

    Question about application focused python:

    Whats the use case for hanging an application on python over Java/C/Etc?

    Its developer-facing benefits are clear to me, but, as a delivered product, does it offer any computational advantages over the above?

  • Options
    ArbitraryDescriptorArbitraryDescriptor changed Registered User regular
    Darkewolfe wrote: »
    If you've already got a decent background, there's a reasonably not shitty humble bundle for python going right now that you might as well $15 and tinker with. At least one of the tiers has some starter projects that should be enough to get you rolling.

    Well thats a handy coincidence! Why not. *clicky*

  • Options
    MugsleyMugsley DelawareRegistered User regular
    Question: could I write a python script that would scrape data from a given webpage and deposit said data into a delimited file? Because right now I have to Copy All, and paste into a *.txt before importing into Excel. Why these people never included the option to output the data to a usable format is beyond my understanding.

  • Options
    credeikicredeiki Registered User regular
    Mugsley wrote: »
    Question: could I write a python script that would scrape data from a given webpage and deposit said data into a delimited file? Because right now I have to Copy All, and paste into a *.txt before importing into Excel. Why these people never included the option to output the data to a usable format is beyond my understanding.

    Yeah for sure; I use it to do that sort of thing all the time. Check out urllib for a start to webscraping, and/or just type in your problem followed by 'python' and see what stackoverflow has to offer in terms of solutions or other libraries.

    Steam, LoL: credeiki
  • Options
    PowerpuppiesPowerpuppies drinking coffee in the mountain cabinRegistered User regular
    Advent of code is a fun way to learn a new language

    sig.gif
  • Options
    TofystedethTofystedeth Registered User regular
    credeiki wrote: »
    Mugsley wrote: »
    Question: could I write a python script that would scrape data from a given webpage and deposit said data into a delimited file? Because right now I have to Copy All, and paste into a *.txt before importing into Excel. Why these people never included the option to output the data to a usable format is beyond my understanding.

    Yeah for sure; I use it to do that sort of thing all the time. Check out urllib for a start to webscraping, and/or just type in your problem followed by 'python' and see what stackoverflow has to offer in terms of solutions or other libraries.
    Just remember to never try to parse HTML with regex. That way lies madness.

    steam_sig.png
  • Options
    ArbitraryDescriptorArbitraryDescriptor changed Registered User regular
    edited May 2018
    Just remember to never try to parse HTML with regex. That way lies madness.

    That I have only one agree to give...

    It seems pretty straight forward, but it's the nested tags that get you. Then theres the tags inside js strings

    And all those freak occurences where the text mentions that "b<a and a>c"

    *shudders*

    lxml is a solid xml/html parser. lXml is your friend.
    credeiki wrote: »
    Mugsley wrote: »
    Question: could I
    write a python script that would scrape data from a given webpage and deposit said data into a delimited file? Because right now I have to Copy All, and paste into a *.txt before importing into Excel. Why these people never included the option to output the data to a usable format is beyond my understanding.

    Yeah for sure; I use it to do that sort of thing all the time. Check out urllib for a start to webscraping, and/or just type in your problem followed by 'python' and see what stackoverflow has to offer in terms of solutions or other libraries.

    On scraping
    If you're using 2, I read good things about Scrapy; but I don't, so idk.

    ArbitraryDescriptor on
  • Options
    SerpentSerpent Sometimes Vancouver, BC, sometimes Brisbane, QLDRegistered User regular
    These are some great resources. Helps me on where to look.

    I was kinda hoping there was a surefire 'this is the best starting point', because I'm poor and time and didn't feel like doing my usual google stuff, but it sounds like there's lots of good resources...

  • Options
    OrcaOrca Also known as Espressosaurus WrexRegistered User regular
    edited May 2018
    I've found Python enormously helpful as a free replacement for Matlab and a glue language for anything I want done quick on my PC. The barrier to entry is extremely low, and you can basically "import airplane; airplane.fly()" it's so much like pseudocode.

    By way of example, I picked up enough for it to be useful in a weekend.

    It's basically programming in psuedocode so long as you're doing the basic stuff.

    So I guess my suggestion is to pick something you want done, do some basic research on available packages, and chances are you'll be able to do whatever it is you want in less time than you anticipated.

    Orca on
  • Options
    furbatfurbat Registered User regular
    edited May 2018
    Some of the discussion here is beyond my pay grade. I feel that python is very easy to lean if you already know java or C. I was able to sit down and make tetris the day I learned python. As was said above, it a lot like psuedocode.

    There are some things I found strange like dynamic data types and for loops. Declaring a fixed size nd array was a struggle for example. ++ and -- doesn't increment/decrement a variable. White space is used for grouping. But these things are so minor.

    If you have a good deal of experience programming, python should be very easy to learn.

    For what it's worth, I teach python in an entry level CS course. I think the dynamic data types (and other things) make it harder as a first language simply because so much is just done for you.

    furbat on
Sign In or Register to comment.