Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
what does # -*- mean?
#1
i see this a lot and even use it myself:
# -*- coding: utf-8 -*-
i would like to know what the -*- part means, or at least the first one. can it be used for other things? how are these things defined? is it part of the formal language despite being in comments?

i have something like this of my own i was to put in my code. i am wondering if doing that could interfere with other things. what i want to do is set up begin and end markers for files i have included inside another larger file. the marker would identify what was included. a begin marker would precede the included content and an end marker would follow. a script can be run on the larger file to update everything that is included this way.

for example:

# -*- include: somecode.py -*-
# this is data:
blocksize = 4096
buffersize = 32768
# -*- include end: somecode.py -*-
some day it might be changed. then i just re-run that update script on the larger file.

# -*- include: somecode.py -*-
# this is data:
blocksize = 4096
buffersize = 1048576
# -*- include end: somecode.py -*-
so can i use -*- or do i need to make up my own thing?
Tradition is peer pressure from dead people

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


Messages In This Thread
what does # -*- mean? - by Skaperen - Apr-06-2019, 02:10 AM
RE: what does # -*- mean? - by ichabod801 - Apr-06-2019, 02:23 AM
RE: what does # -*- mean? - by Skaperen - Apr-07-2019, 03:26 AM
RE: what does # -*- mean? - by ichabod801 - Apr-07-2019, 12:49 PM
RE: what does # -*- mean? - by DeaD_EyE - Apr-07-2019, 12:53 PM
RE: what does # -*- mean? - by Skaperen - Apr-09-2019, 01:49 AM

Forum Jump:

User Panel Messages

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