Importing modules

Add a reply

Posted by carldr 832 days ago:
Hi all,

Firstly, I should point out I'm not a Python coder by any means, so when I included Python as one of the supported languages, I didn't realise the below was a potential problem.

As stated in the help, you are unable to import any modules. It turns out that since 'sys' is a builtin module, you can import it just fine, but I don't know what other modules this applied to.

One module that it doesn't apply to is 're'. Now, the regular expression syntax in Python is fairly verbose, but I'm pretty sure that they'll come in useful on some of the challenges, and since the other languages support them as part of their core, I feel Python is at a disadvantage here.

I'm going to find a way of allowing importing of 're', allowing you to use it.

Are there other modules which give Python functionality that is included by default in the other languages' core? I'll look to include those too.
Posted by carldr 800 days ago:
A quick message to say that the re, zlib and most encode codecs are now all available.

If there are other modules that you feel would be useful and would add functionality you find in other languages, let us know and we'll see what we can do.
Posted by jackdied 793 days ago:
decimal!
I signed up in order to upload a digits-of-Pi implementation (a bit chunky at 198 chars) and was greeted with a traceback.
Posted by gsakkis 792 days ago:
I didn't know about the "no-import" rule but I found out when I imported 'math' in the prime factors challenge. If 're' is included, 'math' should be included too (unless we have to implement square root approximation as part of the solution:) ).
Posted by mad4j 791 days ago:
two requests just for fun:
1. the 'hex' codec
2. and the 'random' module
Posted by carldr 716 days ago:
Due to the very low overhead required to use the zlib module, it has been removed from both PHP and Python (Which were the only two languages which had it available.)

This followed a discussion in the IRC channel where the prevailing view was that it was an unfair advantage to those languages, and detracted from the fun of golfing.

To keep the current challenges fair, we’re working on removing entries which have used this module, although this might take some time.

Thanks for your understanding.
Posted by hallvabo 176 days ago:
See this post for a list of allowed/disallowed modules and encodings.

Add a reply