Python Forum
file extension for python
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
file extension for python
#1
python already uses .py and .pyc and .pyo ... are there any others:  i've started using these:

.pyi - insertable (not necessarily importable) snippets of code that can be useful to inserted while creating a .py file.

.pyd - insertable or importable files that are data being added to a program, such as a list of US states.

.pyt - insertable or importable files that are text being added to a program, such as different licenses.

your thoughts?

*** ducks behind the big blue couch ***
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
Hm... I would use some file name prefix or suffix. And I am doing it like that. The programs and the systems depend on file extension when it comes to text files. If the file is executable ( a script ), the shebang line will work regardless of the file extension. But this is valid for Linux/Unix systems. Don't know about Mac OS.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#3
You forgot .pyw (though that may apply only to Windows).

Sounds like you're just reinventing the wheel and making life just a little more complicated.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#4
I don't see the point to invent your own extensions. Who else, but you will know what they mean. Not to mention that
pyd - https://docs.python.org/3.6/faq/windows....e-as-a-dll
pyt -  http://desktop.arcgis.com/en/arcmap/10.3...lboxes.htm
Reply
#5
this started for me when i had some files that were snippets of code i could insert into python code.  at first i used the extension .py for everything.  but that was getting them mixed up with python code that was suppose to be a complete command or module.  it first it seemed i needed to read each file to see if it began with #! which was making a lot of my commands big and complex.  at least the ones without #! were short so grep didn't need to read so much.  i started writing a command to detect these (the file command did not ... in some cases it said it was ascii text and in others it said it was python source) then got the idea of an extension (.pyi) as i could get emacs to recognize then that way a lot easier, and recognize them in big one-time commands a lot easier (for example, a one-time command to upload all python-insertable files to a specific location).  so, i started doing it that way.  i have solved similar issues with other things not involving python, before, with general good luck.  then i realized i had some files that were data or text assignments (can import) or quote encodings (inserted after a dangling assignment) and decided .pyi was not enough for these.  too bad Linux did not have meta-attributes for files.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#6
It sounds like a database is what you need
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#7
there would be too much interfacing the database to other things ... i think extensions keeps it simple.
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
  IDLEX Extension - A Promising IDE For Python. adt 2 2,759 Sep-27-2019, 09:58 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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