Coder Social home page Coder Social logo

Comments (6)

kongscn avatar kongscn commented on April 27, 2024 12

I would expect a more normal kind of python at least in the fastai package. Being easy to read and understand is more import than making it some lines shorter, the mental model decides how long or difficult a script is. But it looks like a new language at first glance 😢.

With import * I don't know something comes from which file, or from another package like torch. It's really more difficult to get a quick picture of a file even with IDE. and feels fragile.

from fastai.

jph00 avatar jph00 commented on April 27, 2024 3

Configure your editor or IDE to display this info and/or jump to the token. That's a computer's job, not a human's :)

If you're just browsing the code online thru github, install the sourcetree chrome extension to get the same functionality (in-project only).

from fastai.

jeremyjordan avatar jeremyjordan commented on April 27, 2024 2

@macsermkiat i'm sorry, but you can elaborate on why import * can improve the data science workflow? it severely hinders readability.

for example, suppose you have a file which has many import statements at the top.

from module_a import *
from module_b import *
from module_c import *
from module_d import *
from module_e import *

later in the code, a function some_random_function() is used but is not defined anywhere in the file. to trace the origins of this function, you would need to go search through each module until you find it.

compare that with readable import statements:

from module_a import some_function
from module_b import another_function
from module_c import some_random_function
...

you can quickly figure out where the function was defined.

from fastai.

dbook-kkbrandt avatar dbook-kkbrandt commented on April 27, 2024 1

Wow, thank you for pointing us to this chrome extension - this is seriously the most useful Chrome extension I've ever seen, and it works wonderfully!
https://chrome.google.com/webstore/detail/sourcegraph-for-github/dgjhfomjieaadpoljlnidmbgkdffpack

from fastai.

macsermkiat avatar macsermkiat commented on April 27, 2024

Jeremy had pointed that out somewhere in the VDO. Import *might be bad generally. But for datascience work, it helps in better workflow.

from fastai.

iskode avatar iskode commented on April 27, 2024

Jeremy plans to make the lib more documented, but he showed some tip to know where a class or function comes from:
?unknown_function + Enter
Alternatively you can put the cursor in the first bracket of the function and type Alt + Tab to see the docs.

from fastai.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.