Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
import vs inserting code
#11
(Jun-23-2024, 12:02 PM)AdamHensley Wrote: Hey, interesting question! Generally, the result should be the same whether you insert code directly or import it, as long as both files are in the same directory and the code is unchanged.

one big issue can be the indents. i realized this when i was copying some code into different places in a current project (i have too many little projects). i have to change the indentation, sometimes. importing avoids because parsing is done in a separate context which starts at a new beginning. it may be possible to work around this by requiring the "insert" directive be at the proper indent and convert all the inserted indents by the amount that makes the first inserted like take the indent of that "insert".
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  visual studio code python how to get source code of import module definitian umen 2 4,196 Jun-13-2020, 06:20 PM
Last Post: umen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020