neemspees / tragic-methods Goto Github PK
View Code? Open in Web Editor NEWA collection of script depicting the strange quirks of programming languages.
A collection of script depicting the strange quirks of programming languages.
Would it be all-right to also add brief comments on workaround to language quirks for the curious in the directories of problems. For instance, this python quirk can be worked around by changing the function from a default like:
class Demo:
"""A class representing a demo object with an ID"""
def __init__(self,id = generate_id(6)):
"""Instantiate the demo object with the ID from the 'id' parameter."""
self.id = id
to instead take a function as an argument:
class Demo:
"""A class representing a demo object with an ID"""
def __init__(self, id_func = generate_id, id_arg = 6):
"""Instantiate the demo object with the ID from the 'id' parameter."""
self.id = id_func(id_arg)
Hi. I love this repo!
I created this gist to show the issues of TypeScript generic types being covariant: https://gist.github.com/pedropedruzzi/30612deae94b2e840fb2faeb7443e106
I don't have time to put together a PR adding this to the right format. But if anybody wants to, feel free to use my code as you wish.
Thanks.
I think it would be a good idea to require a readme.md for every subfolder. That makes it easier to find interesting examples without needing to dive into the full code to learn what it's about from the comments.
GitHub renders readme.md files on its website for every folder, not just the root folder, so that would be an easy way to make the examples more accessible.
The line with the code that "does not work as intended" in the example is:
funcs = [lambda: i for i in range(10)]
IMHO it is hard to get what is intended there, even for someone with a lot
of Python experience (at which point they will immediately figure out
the problem, due to have falling for this a couple of times already :-) )
Just adding a pair parentheses fore readability there might make things better:
funcs = [(lambda: i) for i in range(10)]
According to the contribution guidelines, each script should be placed in a separate sub-folder. This means the folder will be empty except for a single file, defeating the purpose of folders. Can we get rid of this layer of nesting and place the scripts directly in the language folder?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.