What do you call in English the state after lunch, when all your blood is working in your gastro-intestinal tract and no blood is left for operating the brain?
And I still dream about a python with TCO and argument pattern matching... sigh... The expressive strength of recursion coupled with the syntactic beauty of python... sigh...
@Ffisegydd steady Stewie... you may be introducing @ExoticBirdsMerchant to radical new concepts by throwing around that "Google" word... where'd we be with more spare time not pointing these things out!? :p
@ExoticBirdsMerchant: FYI, it's a little unusual to use "her" to refer to libraries or modules. Not unheard of (I do it sometimes when explaining how a piece of mathematical software is behaving: "She then tries X..") but relatively rare.
I can think of a way to do this... But if your follow up question is going to be, "now how do I combine only values that are neighbors and are equal to one another?", the technique will be totally unsuitable
@Sab: if you don't want to use zip for some reason, then loop over every row and column by index. And don't trust Kevin, he's trying to rip you off. I'll do it for 48.
@DSM wasn't any code to start with, then there was just poorly copied from a linked answer... but - we got there.... as least it's not now viewed by me as a complete vampire anyway...
There's nothing wrong with complex code, and similarly there's nothing holy with simple code. Code should be as simple as it needs to be and no simpler.
@Sab If you want to work without numpy, what's wrong with [sum(x) for x in zip(*a)] (columns) and [sum(x) for x in a] (rows)? As long as the matrix is not ragged, you don't even need to know its size...
Sometimes I enter phrases into google to see how long it takes for autocorrect to guess what I'm thinking. I smile when it happens in like three letters
How can I be off by a game in terms of what it sparked in my head? I remember having a conversation with a student once and I was telling him that I liked the colourful gems more so than diamonds. He insisted that I was wrong. I replied, "Wait, what? How can I be wrong about what I like?"
Guys another thing happened in the trenches: i type python setup.py and i take this message in the cmd : Documentation production by Sphinx is not available: No module named sphinx.setup_command so i located this module ( code.google.com/p/sphinx/source/browse/trunk/sphinx/…) but my i cannot figure out if i need to put it inside the arelle file (the prgram i am trying to install/setup ) or not....any ideas?
Guys this is confusing i have downloaded the raw code(sphinx.googlecode.com/svn-history/r7/trunk/sphinx/…) as stored it with a py suffix and then i put that inside arelle on the Sphinx file but it is still telling me that : Documentation production by Sphinx is not available: No module named sphinx.setup_command what mistake have i made?
I'm not in a good position to complain about other people doing insufficient testing of code.. too often there's only a short turnaround between the moment I finish something and the moment it has to go out. I really need to do something about that.
#size of matrix
width = 4
height = 4
def in_range(x,y):
if x < 0 or x >= width: return False
if y < 0 or y >= height: return False
return True
#returns True if any element of the matrix is equal to its neighbor.
def any_neighbors_are_equal(matrix):
for i in range(width):
for j in range(height):
value = matrix[j][i]
if in_range(i+1,j) and matrix[j][i+1] == value: return True
if in_range(i-1,j) and matrix[j][i-1] == value: return True
if in_range(i,j+1) and matrix[j+1][i] == value: return True
So @Kevin posted this before and I'm not sure but it's not really working.
@JonClements I probably do something very basic wrong, but I just can't figure it out, I thought I tried everything but nope.. and the funny thing it is still very nondeterministic: it is a true mystery when and why ID jumps (like in the example output I posted where between 128 and 256 there is only one number..)
@Peter I can't remember the precedence of *, but sizeof(void*)*resources->instances_len) even if it doesn't make a difference, is probably better written as sizeof(void*) * (resources->instances_len))
Guys? Just a question of curiosity purely what is the difference between python setup.py which was WRONG and python setup.py install which was right? I read the solution in this post in SO (stackoverflow.com/questions/12324601/…)
@petervaro makes it more clear you don't indeed *resources->instances_len and depending on precedence it might be fine, or an error... as (*resources)->instancs_len isn't what you want