mirror of
https://github.com/not-kennethreitz/convore.json.git
synced 2026-06-05 23:20:19 +00:00
1 line
9.9 KiB
JSON
1 line
9.9 KiB
JSON
[{"user_id": 4156, "stars": [], "topic_id": 13026, "date_created": 1300120138.869374, "message": "Ruby's yield and Python's yield are not actually for the same thing, they're sort of the inverse of each other :) Pretty sure the overall effect can be duplicated in both languages, been a while since I used Ruby yield however.", "group_id": 292, "id": 348902}, {"user_id": 1629, "stars": [], "topic_id": 13026, "date_created": 1300119364.084585, "message": "1) I know I'm risking flamewar.", "group_id": 292, "id": 348797}, {"user_id": 1629, "stars": [], "topic_id": 13026, "date_created": 1300119384.4113641, "message": "2) While we're at it, what are some neat tricks python have impressed you?", "group_id": 292, "id": 348803}, {"user_id": 2810, "stars": [], "topic_id": 13026, "date_created": 1300119891.257946, "message": "Flamewar? Sure - here :)", "group_id": 292, "id": 348855}, {"user_id": 2810, "stars": [], "topic_id": 13026, "date_created": 1300120007.73913, "message": "Otherwise look here http://docs.python.org/reference/simple_stmts.html#yield ;)", "group_id": 292, "id": 348870}, {"user_id": 1629, "stars": [], "topic_id": 13026, "date_created": 1300130072.0445869, "message": "@theblacklion I appreciate it, but that's not the same. Check out what ruby's yield does: http://www.tutorialspoint.com/ruby/ruby_blocks.htm", "group_id": 292, "id": 349929}, {"user_id": 1736, "stars": [], "topic_id": 13026, "date_created": 1300130057.5723879, "message": "Isn't there something in withhacks that works like Ruby's yield?", "group_id": 292, "id": 349925}, {"user_id": 5778, "stars": [], "topic_id": 13026, "date_created": 1300132628.6168511, "message": "def test(fake_yield):\n print fake_yield(5)\n print 'You are in the method test'\n print fake_yield(100)\n\ntest(lambda i: 'You are in the block %s' % i)", "group_id": 292, "id": 350337}, {"user_id": 1736, "stars": [], "topic_id": 13026, "date_created": 1300132655.293515, "message": "@codekoala But you can use the print function! :-)", "group_id": 292, "id": 350346}, {"user_id": 5778, "stars": [], "topic_id": 13026, "date_created": 1300132738.3233449, "message": "you and your 2.x+ magic...", "group_id": 292, "id": 350358}, {"user_id": 5778, "stars": [], "topic_id": 13026, "date_created": 1300132712.5269749, "message": "def derp(i):\n print 'You are in the block %s' % i\n\ndef test(fake_yield):\n fake_yield(5)\n print 'You are in the method test'\n fake_yield(100)\n\ntest(derp)", "group_id": 292, "id": 350356}, {"user_id": 1629, "stars": [], "topic_id": 13026, "date_created": 1300133114.772218, "message": "Thanks @codekoala. I'm trying out django, rails, and nodejs simultaneously. I'm feeling around, trying to find one, pick it, and stick with it.", "group_id": 292, "id": 350447}, {"user_id": 5778, "stars": [], "topic_id": 13026, "date_created": 1300132483.6140549, "message": "looks like Ruby's yield is basically just like passing a callable (maybe a lambda) to a function, then executing the callable within that function", "group_id": 292, "id": 350312}, {"user_id": 5778, "stars": [], "topic_id": 13026, "date_created": 1300133050.5405719, "message": "but you might also consider approaching problems differently if you find yourself using them as the yield is used in the article you linked to", "group_id": 292, "id": 350432}, {"user_id": 5778, "stars": [], "topic_id": 13026, "date_created": 1300133021.5378511, "message": "@evan based on what I saw in the link you provided earlier, I think lambdas might well do what you're after", "group_id": 292, "id": 350424}, {"user_id": 1736, "stars": [], "topic_id": 13026, "date_created": 1300132704.5724361, "message": "@codekoala http://docs.python.org/release/3.0.1/whatsnew/3.0.html#print-is-a-function", "group_id": 292, "id": 350355}, {"user_id": 5778, "stars": [], "topic_id": 13026, "date_created": 1300132745.9021521, "message": "/me is still stuck with pre-3", "group_id": 292, "id": 350360}, {"user_id": 1736, "stars": [], "topic_id": 13026, "date_created": 1300132832.6955709, "message": "@codekoala In 2.x it is veyr common to see def print_(x): print x", "group_id": 292, "id": 350382}, {"user_id": 1736, "stars": [], "topic_id": 13026, "date_created": 1300133313.5066891, "message": "But you can declare functions (or anything else for that matter) in any scope", "group_id": 292, "id": 350491}, {"user_id": 1736, "stars": [], "topic_id": 13026, "date_created": 1300133330.5554121, "message": "so you can use local temporary function object to do what you want", "group_id": 292, "id": 350492}, {"user_id": 1736, "stars": [], "topic_id": 13026, "date_created": 1300133387.5510681, "message": "@evan Not quite the same and much shorter, but you might want to look at trypython.org", "group_id": 292, "id": 350501}, {"user_id": 5778, "stars": [], "topic_id": 13026, "date_created": 1300132859.9793479, "message": "@coderanger somehow I feel fortunate to not be exposed to that ....", "group_id": 292, "id": 350394}, {"user_id": 5778, "stars": [], "topic_id": 13026, "date_created": 1300132729.3259759, "message": "@coderanger haha, good call", "group_id": 292, "id": 350357}, {"user_id": 8649, "stars": [{"date_created": 1300132446.735307, "user_id": 5778}], "topic_id": 13026, "date_created": 1300132281.6724229, "message": "ugh. I'm not a language zealot, but based on that tutorial description, I have to say that \"yield\" seems to be a poor choice of name.", "group_id": 292, "id": 350296}, {"user_id": 5778, "stars": [], "topic_id": 13026, "date_created": 1300132666.666523, "message": "@coderanger teach me ;)", "group_id": 292, "id": 350348}, {"user_id": 5778, "stars": [], "topic_id": 13026, "date_created": 1300133146.26352, "message": "feel free to ask more questions too :)", "group_id": 292, "id": 350454}, {"user_id": 5778, "stars": [], "topic_id": 13026, "date_created": 1300132637.591357, "message": "you can't use a print statement in a lambda", "group_id": 292, "id": 350341}, {"user_id": 5778, "stars": [], "topic_id": 13026, "date_created": 1300132653.986948, "message": "if you really want to print inside the \"yield\" thinger, you could do this instead", "group_id": 292, "id": 350344}, {"user_id": 1629, "stars": [], "topic_id": 13026, "date_created": 1300132979.124892, "message": "So is what I need to be looking at is lambdas in Python? I just thought what I was seeing in Ruby was a really neat feature, and wanted to know if Python had it to. (since I believe I'll be sticking with Python for the long term.)", "group_id": 292, "id": 350410}, {"user_id": 1736, "stars": [], "topic_id": 13026, "date_created": 1300133169.3650341, "message": "@evan Functions and labdas are both just special cases of callable objects in Python", "group_id": 292, "id": 350460}, {"user_id": 1736, "stars": [], "topic_id": 13026, "date_created": 1300133186.4471469, "message": "You can also declare __call__ on any class to make its instances callable", "group_id": 292, "id": 350467}, {"user_id": 5778, "stars": [], "topic_id": 13026, "date_created": 1300133226.83393, "message": "callable classes are fun :)", "group_id": 292, "id": 350475}, {"user_id": 1736, "stars": [], "topic_id": 13026, "date_created": 1300133285.991318, "message": "Python very specifically lacks an anonymous callable block syntax a la Ruby/Smalltalk/JavaScript, and GvR is adamant it will remain that way permanently", "group_id": 292, "id": 350485}, {"user_id": 1629, "stars": [], "topic_id": 13026, "date_created": 1300133349.037863, "message": "@coderanger Reading about that now... very neat.", "group_id": 292, "id": 350496}, {"user_id": 1629, "stars": [], "topic_id": 13026, "date_created": 1300133208.084446, "message": "@codekoala It has been a bumpy ride. I plowed through rubykoans, rails for zombies, and a few rails tutorials, now I'm turning to python and django. I wish there was a pythonkoans. Such a nice way to learn a language.", "group_id": 292, "id": 350470}, {"user_id": 5778, "stars": [], "topic_id": 13026, "date_created": 1300133359.63533, "message": "@evan that would have probably been quite useful for me a few years ago ;)", "group_id": 292, "id": 350499}, {"user_id": 1629, "stars": [], "topic_id": 13026, "date_created": 1300133431.990325, "message": "I've been doing projecteuler.net problems in python to get used to the language. I <3 it so far, but I need to be \"forced\" to learn the neat little pieces of the language.", "group_id": 292, "id": 350509}, {"user_id": 5778, "stars": [], "topic_id": 13026, "date_created": 1300133139.23207, "message": "@evan that's a lot to pick up all at once! good luck ;)", "group_id": 292, "id": 350453}, {"user_id": 1629, "stars": [], "topic_id": 13026, "date_created": 1300133248.64307, "message": "@coderanger Neat! I love python's magic methods. (Or whatever you call them.)", "group_id": 292, "id": 350478}, {"user_id": 5778, "stars": [], "topic_id": 13026, "date_created": 1300133273.9896009, "message": "@evan it's been a while since I played with Ruby/Rails, but I haven't heard of rubykoans or rails for zombies... might have to take a look :)", "group_id": 292, "id": 350483}, {"user_id": 1629, "stars": [], "topic_id": 13026, "date_created": 1300133333.850528, "message": "@codekoala http://rubykoans.com/ is the site for the koans. Basically a huge unit test. You solve problems, learn zen, and go through *ALL* of ruby systematically. Pretty awesome.", "group_id": 292, "id": 350493}, {"user_id": 1629, "stars": [], "topic_id": 13026, "date_created": 1300133404.0881569, "message": "@coderanger Ooh. Looking at it now...", "group_id": 292, "id": 350505}, {"user_id": 20745, "stars": [{"date_created": 1300187877.9761341, "user_id": 9262}], "topic_id": 13026, "date_created": 1300146926.782464, "message": "http://python-koans.appspot.com/", "group_id": 292, "id": 352140}, {"user_id": 1629, "stars": [], "topic_id": 13026, "date_created": 1300147901.2321401, "message": "@Davidblewett Oh. My. Goodness. Thank you so much!", "group_id": 292, "id": 352216}, {"user_id": 20745, "stars": [], "topic_id": 13026, "date_created": 1300192953.8148291, "message": "np. Ran across that at PyOhio last year I think.", "group_id": 292, "id": 355288}] |