Ah, go on then @holdenweb, here's the tripe I was talking about. Link is to a pdf, most egregious phrases on first page of text tinyurl.com/gvemw7j Hashtag_D_M_U_G_l_o_b_a_l ...
a significantly lighter book on the tech...it's quite fluffy, but it was enjoyable. I got through both books very quickly, were two from Daniel Suarez: First was Daemon, second was Freedom.
I cant even remember how freedom ended but i thought it kinda set it up for some kind of expanded universe ... (hell with oculus rift or microsoft hololens they could probably make some kind of kick ass mmo type thing)
my wife and I would absolutely love the opportunity to go to that restaurant. Japan is on our list of places to travel to and eat all the things inside of it.
heh python's ranges are not inclusive endpoints, so they help avoid off-by-one errors - except when people unfamiliar with python assume they are inclusive :(
@DSM true but can you guarantee that the cooking utensils won't have been used to cook shellfish at all recently? Plus a lot of sauces (even non-fish based) will use oyster/fish sauce as a kind of base IIRC.
@holdenweb: ehh. You can have a language which doesn't allow inheritance (you can't derive a class from another) but allows you to push methods from one class into another.
@enderland: Python ranges and slices are the way they are to avoid all the subtle off-by-one errors that languages like Basic generate. For all i < len(s), s[:i]+s[i:] == s, for example. So one of Guido's (the inventor of Python) key insights was to use half-open ranges (one endpoint is included, the other is excluded)
I probably could implement super if I wanted... I give it a 3/10 on the difficulty scale. Requires some magic to peek at the state of the calling scope, but nothing requiring new infrastructure.
def super(scopes):
calling_scope = scopes[-1]
assert isinstance(calling_scope, class_method), "super can only be called from within a method"
return calling_scope.class.parent
I mean, it's technically okay, but there's no reason to.
Most answers are at least a little collaborative anyway, but the person who put in most of the work to come up with the algorithm should gets the points.
@jayeshkv and just to twist your head as far as it will go, d["itm1"][0][1][2] gets you the character '.' - the third character of the second item of the first list indexed from the dict by "itm1" (because strings are also sequence containers)
When you see [...], work out the value expression immediately preceding the brackets, then apply the indexing operation. In the expression above, there are four levels of indexing, applied one after the other (and recursively described in English starting with the last one, which may not be entirely helpful)
@MorganThrapp it would fail for "blah blah @someone.", because my solution recognizes "@someone." (with dot) as a valid mention. The question states that "A ping to another user is defined as an @ followed by 3 or more letters". My solution doesn't perform such checks. Is it really okay?
ok dumb question, I have a huge blob of text that comes in from subprocess with a bunch of \n characters - when I print this to stdout I see... a huge long string - is it nontrivial to print this via splitting somehow? I can't seem to get str().split() to work
it comes back as a tuple, so I have to cast as a string
@enderland https://channel9.msdn.com/Events/GoingNative/GoingNative-2012/Keynote-Bjarne-Stroustrup-Cpp11-Style C++ is a good language when you care about effective resource management.
@QuestionC Don't want to diss Bjarne but I don't find C++ useful for anything. If I want a "high-level" language with garbage collectors and stuff, I have no reason to pick C++ over Java. If I want to write low level code, why do I need garbage collectors that comes with C++?
To the bigger point, Python can't be a 'better' language than C++. They're too different. They solve and create different problems.
C++ vs Java is at least a meaningful comparison.
If you write a Raytracer in Python and I write a Raytracer in C++, I can pretty much guarantee the C++ one is going to be better because nobody wants to wait 10 minutes for a basic picture.
Let's not get too down on smart pointers either - isn't that what Python's context managers are after all? There are more resources that you want to manage than just allocated memory.