Differences between revisions 3 and 4
Revision 3 as of 2014-04-20 11:10:17
Size: 588
Editor: techtonik
Comment: add __abs_file__, __abs_dir__
Revision 4 as of 2014-04-20 11:11:06
Size: 599
Editor: techtonik
Comment: better version support
Deletions are marked like this. Additions are marked like this.
Line 9: Line 9:
 - name: with import (28 compatible)  - name: with import (27,33 compatible)
Line 15: Line 15:
 - name: auto global  - name: auto global (28,35)

FILE, DIR

inspired by: PHP __DIR__, __FILE__ [1]
status:
  python34: __file__ is absolute [2]
  discussion: [3], status: Sep 28 18:51:29 CEST 2013

variants:
 - name: with import (27,33 compatible)
   set:
    - from os.path import FILE, DIR
    - from hacks import FILE, DIR
    - from future import FILE, DIR

 - name: auto global (28,35)
   set:
    - FILE, DIR
    - __file__, __dir__
    - __abs_file__, __abs_dir__ (MRAB, Philipp A.)
  1. http://www.php.net/manual/en/language.constants.predefined.php

  2. https://docs.python.org/3.5/whatsnew/3.4.html

techtonik/ideas (last edited 2025-03-16 15:48:39 by elena)

Unable to edit the page? See the FrontPage for instructions.