7 ms·
PythonMonk – Learn Python in the browser
- pekk 13y agoIt is 2013. Why are you teaching Python 2?
- metaphorm 13y agowhile I agree that we should be more proactive about migrating to Python 3, if you're trying to be pragmatic it is most useful to teach Python 2.7 since that is the most widely used version.
- pekk 13y agoPython 3, in 2013, is not lacking in pragmatism. It's not new, or experimental. Someone just learning today is going to have to immediately turn around and relearn things because they started out with an old version.
- anandology 13y agoI'm teach Python professionally. People come to learn Python so that they can go back and use it at their work place. And almost all Python installations in productions are in Python 2. I'm sure it is going to change soon once Linux distributions make Python 3 their default version. P.S. I'm the author of Python Primer on pythonmonk.com
- jace 13y agoI don't know anyone who uses Python 3 in production. It's still seen as an experimental implementation.
- emidln 13y agoI've seen more installs of pypy in production than python3.
- kracekumar 13y agoIn Arch linux python 3 is default, https://www.archlinux.org/news/python-is-now-python-3/ https://www.archlinux.org/news/python-is-now-python-3/
- melling 13y agoI dont' know Python but I'm thinking about learning it. What's experimental about Python 3? I don't have any legacy reasons to start with 2.7. Why wouldn't I just start with 3?
- metaphorm 13y agothere's nothing experimental about Python 3. its a stable release version and I think its already up to sub version 3.3. HOWEVER, there are many important 3rd party libraries that have not yet been migrated to be fully compatible with Python 3. these libraries are far more important to writing real applications than the ability to use some newer syntactic constructs in Python 3.
- callahad 13y ago> HOWEVER, there are many important 3rd party libraries that have not yet been migrated to be fully compatible with Python 3. Are there any particular libraries blocking you? Numpy / SciPy, IPython, Requests, Django, Pyramid, Bottle, etc. have all been ported to Python 3.
- wodow 13y agoThe Python 3 Wall of Superpowers / Shame lists them for you in order of downloads: http://python3wos.appspot.com/ http://python3wos.appspot.com/
- packetslave 13y agoTo be fair, Django only supports Python 3 as of 1.5, which was released a bit more than a month ago.
- metaphorm 13y agoSouth (database migration for django). Until django core has its own migration tool I won't be using it with Python 3. PIL as well. similar reasons. django image fields are dependent on PIL. Celery is still on Python 2 also, and while there are other message queues available, none of them is as easy to integrate with for an app that's already written in Python.
- msellout 13y agoNot experimental, just that there are good libraries that aren't Py3k yet.
- lawnchair_larry 13y agoClearly you are not a python developer. This isn't correct at all. First, there is nearly nothing to relearn if you target 2.7. http://docs.python.org/3/howto/pyporting.html#use-same-source http://docs.python.org/3/howto/pyporting.html#use-same-sourc... Second, most software of any complexity will have dependencies. Although progress has been made, several packages that many projects depend upon are still red: http://python3wos.appspot.com/ http://python3wos.appspot.com/
- reinhardt 13y ago"immediately"? Try again in two-three years, if that.
- teach 13y ago"A programmer may try to get you to install Python 3 and learn that. You should tell them, 'When all of the python code on your computer is Python 3, then I'll try to learn it.' That should keep them busy for about 10 years." - Zed Shaw, "Learn Python the Hard Way"
- aroberge 13y agoTried the test to define unique. Wrote def unique(s): return list(set(s)) and it gave assertion errors. Nice presentation ... but incorrect Python implementation.
- metaphorm 13y agomaybe you had a typo? or they have corrected this in the meantime? I just tried this problem and it was error free. def unique(values): """Finds all unique elements of a list. >>> unique([]) [] >>> unique([1, 2, 1]) [1, 2] >>> unique([1, 2, 1, 3, 4, 2]) [1, 2, 3, 4] """ # your code here return list(set(values)) it also works without the coercion to list. return set(values) is fine.
- anandology 13y agoThanks for pointing the mistake. Corrected the tests now. Solution to that problem is correct. Sets weren't introduced yet.
- deleted 13y ago[deleted]
- gkoberger 13y agoInteresting, however I feel like learning to code in a browser (even if it's JavaScript) doesn't work. Sure, you may learn how to do a for loop or how variables work. But, you don't learn how to actually use the language. Setting up a development environment, and understanding how everything is connected is much more important. Let's say you ace everything here, on CodeAcademy, etc. You still can't actually build anything. (For more on this, see this article from HN a few days ago: http://blog.zackshapiro.com/want-to-learn-to-code-start-here http://blog.zackshapiro.com/want-to-learn-to-code-start-here)
- kaiwren 13y agoWe're building our way up to this. For now, we are focussing on helping more people teach how to think in a particular language. We'll get to the rest fairly quickly, though that would likely be in the form of screencasts. PS: I'm on the CodeMonk team, the folks that are behind PythonMonk.com and RubyMonk.com
- lostnet 13y agoThe next step would be an ipython notebook verses showing the student the debugger console with prepopulated state in Javascript.. In fact, later lessons as modules to interact with in a notebook would be kind of cool. I really don't buy the "you have to own a car to drive one arguments" and the whole point of modern software engineering is to pull you away from the assumption of full system control and the ability to make problems go away with shell skills. But, I would like more immediate source code management integration. That is the essential reality I always see lacking.. A non-programmer that understood git basics would be more helpful to me as a colleague than a competent programmer that doesn't.
- metaphorm 13y agothis kind of thing is a good resource for people who already know how to code, but need a fast and elegant syntax guide. its not useful for teaching beginners because, as you've said, it doesn't deal with the tool chain or project organization, etc. but if you know Ruby and want to learn Python, this is a great resource.
- azakai 13y agoLooks like it sends each command to run on a server - I'm curious why not execute it in the browser? (There are a few solutions for that?)
- kracekumar 13y agoI tried llvm based project https://github.com/kracekumar/test-empythoned(empythoned https://github.com/kracekumar/test-empythoned(empythoned: https://github.com/replit/empythoned https://github.com/replit/empythoned). There are few limitation I am facing, `import` system don't work(compilation issue). From my experience more effort is required.
- mmwanga 13y agoI think this is a great way to get beginners / students coding, but the end product might be what we now know as "bolt-on" engineers. They put components together and build beautiful functional products, until it breaks and they have no idea what's "under the hood"
- niels_olson 13y agoThis is really cool. I think the assertions that this learn-in-the-browser thing doesn't work is because folks on HN have seen so many entry-level courses at this point. More interestingly, can I get transfer credits from Codecademy instead?
- phleet 13y agoThe first thing I always try on sites like these is stuff like this: __import__('commands').getstatusoutput('ls /') or __import__('subprocess').call(["ls", "-l"]) which gets blocked by the interpreter somehow with exceptions.OSError - [Errno 11] Resource temporarily unavailable I'm curious as to how you managed to do this - I've always been interested in how to sandbox something like this.
- emillon 13y agoThis particular behaviour can occur because the process is disallowed to call fork() and can be done with setrlimit() (see RLIMIT_NPROC). There should be other protections, though, because forking a "ls" is not the only way to access the filesystem.
- phleet 13y agoAh, interesting. File system access isn't blocked completely: __import__("os").listdir("/evaluate") open("/evaluate/test.py").readlines()
- emillon 13y agoExecv'ing processes is OK as long as you don't fork: __import__("os").execv("/usr/bin/uname", ["uname", "-a"]) Linux ip-10-196-3-111 2.6.32-amazon-xen-r3 #1 SMP Mon Jan 16 21:03:16 PST 2012 i686 GNU/Linux As for the actual files, there are a few clues that a chroot is created for every request : /proc is not mounted, /etc is minimal (root + 1 user in passwd) and "ls -id /" returns a new inode number every time.
- tdinkar 13y agoYeah, we are using chroot (along with other things) to sandbox things on a per request basis. - Tejas from Team PythonMonk (I built the sandboxing stuff)
- SEJeff 13y ago__import__("os").execv("/usr/bin/env", ["env"]) Gives you a few clues as well
- xbryanx 13y agoThis is beautiful and the usability is great. But can anyone recommend some online interactive Python learning that starts at the intermediate level? I need Pai Mei to whip my sorry skills into shape, starting with OOP, sockets, image handling, and maybe data persistence?
- kaiwren 13y agoWe already support teaching most of these - if you know anyone that would like to create courseware around any of these topics please let us know. Our courseware marketplace is still in a private alpha, but we are actively soliciting awesome hackers that would like to teach online.
- pc86 13y agoBoth GitHub and Google signins failed for me and I lost progress in the first section. May just be the work network; I'll try it at home.
- cglace 13y ago"Your turn now - go on and change the following code to compute the sum of the numbers 1 through 5." If you input 15 and submit, it says the answer is correct. Do all online code courses just check for the retured value? How do these services deal with someone running sum(i for i in xrange(1000000000000000000))?
- wodow 13y agoBut of course that is a valid piece of code! "15" completely matches the specification you give.
- smonff 13y agoVery far away from Perl Monks.
- deleted 13y ago[deleted]
- r0h4n 13y agoSeems like there is a bug over here http://pythonmonk.com/learning/books/17-python-primer/chapters/98-conditional-expressions/lessons/240-conditional-expressions http://pythonmonk.com/learning/books/17-python-primer/chapte... "Evaluates to True when age is 40 and name is "Bob" , which should be fine i think.
- lsiebert 13y agoThis probably isn't for experienced developers, but it looks gorgeous.