[docs] [issue21784] __init__.py can be a directory

abraithwaite report at bugs.python.org
Tue Jun 17 04:48:32 CEST 2014

New submission from abraithwaite:

Is this expected?  It was very confusing when I cloned a repo that didn't have the __init__.py there when I had just made it, but of course git doesn't track files, only directories.  I had accidentaly done mkdir instead of touch.

$ mkdir pkg/__init__.py
$ touch pkg/foobar.py
$ python
Python 3.4.1 (default, May 19 2014, 17:23:49) 
[GCC 4.9.0 20140507 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pkg import foobar
>>> foobar
<module 'pkg.foobar' from '/home/abraithwaite/pkg/foobar.py'>

assignee: docs at python
components: Documentation
messages: 220787
nosy: abraithwaite, docs at python
priority: normal
severity: normal
status: open
title: __init__.py can be a directory
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

Python tracker <report at bugs.python.org>

More information about the docs mailing list