Fix importing packages in Lib/site-packages

Suppose you have the following package (or folder) inside
Lib/site-packages/:

mypackage/
    __init__.py   -> with only a print(“On init”)
    hello.py        -> with only a print(“On hello”)

The most common way to import my package.hello is:

“from mypackage import hello”.

However, this imports correctly mypackage/__init__.py (printing the “On
init”), but then it is not able to import hello.py. This happens
because a flag that says that “mypackage” is a real package is not set
to true. Then, the importing code does not continue to the importing of
“hello.py”.

This patch sets the $package flag of a package in site-packages to
‘true’ when Brython was successfully able to import a
packagename/__init__.py file.

It fixes the problem and is working fine on Firefox 32, Chrome 38 and
Safari 7.1.
Fix the slice bug described in issue #55

The previous code was not taking into account that a developer can use
‘strange’ slice indexes, like [0:200] when a list has only [1,2,3].
Therefore,  there were some bounds that were not respected, like
limiting the “stop” argument to the maximum length of the list.

The previous code, for [1,2,3][1:200] would return [1,2,3,None……197x
None] .

This patch is based on the CPython code at
https://hg.python.org/cpython/file/3d4d52e47431/Objects/sliceobject.c#l1
32. The following answer at stackoverflow was also relevant for the
problem:
http://stackoverflow.com/questions/12173856/implementing-python-slice-no
tation?answertab=votes#tab-top

This patch only fixes issues related with retrieving items from a list.
There are still issues with slices for deleting and assignment, but
that will be handled later.
Fixes issue #56 (number of replacements in string)

Brython is not respecting the ‘count’ argument to replace only a few
occurrences on a string. This patch fixes that by implementing a loop
instead of using Regular Expressions.

Regular expressions are slow in current browser implementations, and
this loop is at least 400% faster than using Regex in pure javascript
as can be seen in this jsperf:
http://jsperf.com/string-replace-comparison.
Merge pull request #54 from joaoventura/master

Fix importing packages in Lib/site-packages