Thanks for reporting, should be fixed now.
comments
Yeah, I wrote code and pressed get URL, but then I copied what was shown in the window
The clipboard content:
https://memory-graph.com/#code=+%23+What+is%2Bthe+output+of+this+Python+program%3F%0A+++%0Adef+fun%28a+%3D+%5B%5D%29%3A+%0A++++a+%2B%3D+%5B1%5D%0A++++return+a%0Afun%28%29+print%28fun%28%29%29
The window text:
The following URL has been copied to your clipboard with:
The current code
Set breakpoints
Playback timestep
Play/Pause state
https://memory-graph.com/#code=+%23+What+is+the+output+of+this+Python+program? +++ def+fun(a+=+[]):+ ++++a++=+[1] ++++return+a fun()+print(fun())
The latter doesn't work, and I didn't think of checking the former
You can just write your code and then press "Get URL" to get the link: https://memory-graph.com/#code=def+fun%28a+%3D+%5B%5D%29%3A%0A++++a+%2B%3D+%5B1%5D%0A++++return+a%0A%0Afun%28%29%0Aprint%28fun%28%29%29+%23+%5B1%2C+1%5D
DuckDuckGo problem, thanks for reporting.
There's also a gotcha with default parameters:
def fun(a = []):
a += [1]
return a
fun()
print(fun()) # [1, 1]
issues I had with the tool you linked
I tried to make a link to this code in this visual debugger, but a link is made broken and can't be used without urlencoding spaces (I guess). Also the tool doesn't produce visual output in DuckDuckGo browser on Android
To be fair, I had to read the linked question on SO to understand what was the possible alternative. I do expect that if I use += it is in place.
On the other hand with Python and Java I always keep forgetting if everything is by value or by reference, I really miss some extra clarity of the languages where you can see if something is mutable when passed to a function
The "Solution" link gives the solution to the exercise, the "Explanation" link explains the Python data model concepts behind the exercise. If some parts are hard to understand let me know.
Yes, that is a surprise to many, in other languages 'x+=y' and 'x=x+y' are the same.
The fact that x += y modifies lists in place might be surprising if you're expecting it to be exactly equivalent to x = x + y.
Thanks, glad it helps you.
Wow, nice project!β― I'm a 'visual person', I understand better when I see what's happening.
That can help me a lot! :)
Looks like this whole post is an ad for someone's project. The links hardly have to do with the post.
As I would expect. Does the result surprise people?
If so, rename the arguments to fun() to be r, s, t, and u. Just inside the function. Does the obvious two scopes now make it clearer?
Anaconda who? Isn't that only used by students. Why in duh faulk throw a survey at us? Teach us why we should care at all about Anaconda. We are here to learn. It's a lost opportunity.
And whomever posts surveys should pay participants. It's an industry.
Glad you like it. Sketching by hand should remain standard practice, but for beginners that might be difficult. First they need to learn the right mental model to think about Python data, and I hope memory_graph can help with that.
Thanks for adding. The link I posted should give people a quick animation to directly see what is possible instead of having to read through things first. That GitHub repo link is also on hat page. But you are right that some would probably want to start with the repo, thanks for feedback.
My programming has become extremely rusty (not a euphemism) and this might be something I could benefit from. Very interesting work
Although itβs hard to beat just sketching these out by hand. Maybe seeing whatβs actually being set up in the code could be add new dimension to that.
I love this, thank you for sharing. It would be nice if you linked directly to your repository next time instead whatever
https://memory-graph.com/#codeurl=https%3A%2F%2Fraw.githubusercontent.com%2Fbterwijn%2Fmemory_graph%2Frefs%2Fheads%2Fmain%2Fsrc%2Fbin_tree.py×tep=0.2&play=
this link was. I'll add it below just for others.
Nice job!
What I was wondering about is the possibility to just chuck in any kind of data anywhere, or have gaping holes in some, which SQL isn't suspecting/allowing but NoSQL does.
Ha ha I have worked with MongoDB and I dhad mixed feelings about the researcher who set up the database (just mix anything in anywhere) πΈ
You're gonna hate/love learning about how Documentdb works (it's postgres with extensions).
Appreciated!
Thanks, I'm pretty stoked about it myself.
What you said is the old concept of relational databases. SQLite, years ago, added native JSON and JSON operations such as JSON_EXTRACT, JSON_EACH, JSON_SET, etc., which blurred the line between SQL and NoSQL. However, not many developers utilize it, so I'm trying to bring it to the easiness of PyMongo APIs. If you read the examples and test cases in my repo, you will no longer mention subsets. While it's true, I've already addressed most of them and am still progressing.
Why would you want to use No-SQL on an SQL database? Like for convenience only or are there some other benefits? They are wildly incompatible so do you only get the subset or is there some transformative magic done in the API?