|
| 1 | +A disorganized collection of TODOs, bug reports, and suggestions from friends |
| 2 | +--- |
| 3 | + |
| 4 | +Ideas for programming tutorials |
| 5 | + - Could do a track on more advanced Python concepts for people who are |
| 6 | + already pretty comfortable with programming ... an intro to Python |
| 7 | + for programmers |
| 8 | + |
| 9 | + |
| 10 | +Don't display boilerplate code when classes are being initialized |
| 11 | + |
| 12 | + |
| 13 | +Rob Miller's suggestions for handling aliasing: |
| 14 | + |
| 15 | +''' |
| 16 | +Incidentally, for the aliasing example, it might help if you strive to |
| 17 | +have one object be the "official" one, in a sense, and make the aliases |
| 18 | +to it look different. For example, the x list would be displayed |
| 19 | +normally, but the y list might be displayed faded out (with a little |
| 20 | +note that says "this is the same object as x above"). Mousing over the |
| 21 | +x list or y list might highlight its aliases. |
| 22 | + |
| 23 | +That would reinforce the fact that there's only one object in memory. |
| 24 | +We usually do that on the blackboard -- draw only one object, and have |
| 25 | +arrows from x and y pointing to that single object. |
| 26 | +''' |
| 27 | + |
| 28 | + |
| 29 | +Hubert's suggestions for permalinks: |
| 30 | +''' |
| 31 | +Hubert: 1) It would be cool to have the ability to link directly to an |
| 32 | +execution point, so that when I send you a link, you could see the code |
| 33 | +I'd written and the point in execution that I want to discuss. |
| 34 | + |
| 35 | +me: good suggestion. that also requires me to save your code in |
| 36 | +something other than a regular POST variable, which i'm not doing right |
| 37 | +now. then i could send links of the following form: |
| 38 | + |
| 39 | + http://python.pgrind.com/code_id=20#4 (for line 4 of code snippet 20) |
| 40 | + |
| 41 | +Hubert: yup, yeah the problem lies in storing the code, which brings in |
| 42 | +a whole can of worms. but suppose you did, consider a RESTful approach |
| 43 | +(which I am drilling into deeply, hence it's on my mind): |
| 44 | + |
| 45 | +http://python.pgrind.com/pg/code/20#4 |
| 46 | + |
| 47 | +...quite easy to do and manage in a framework like Django. |
| 48 | +''' |
| 49 | + |
| 50 | + |
| 51 | +Cory: 'Might be nice to be able to automatically jump to particular step |
| 52 | +# rather than just inc/decrement and jump to ends, particular if the |
| 53 | +number of steps executed is significant.' |
| 54 | + |
| 55 | + |
| 56 | +Maybe integrate in this snazzy code EditArea, if it doesn't look too ugly: |
| 57 | + (ugh kinda cheesy tho) |
| 58 | + http://www.cdolivet.com/index.php?page=editArea&sess=3a3d89b7ef37aa5f74d6d4682aeda876 |
| 59 | + |
| 60 | + |
| 61 | +Deployment on Google App Engine for scalability |
| 62 | + http://code.google.com/appengine/docs/python/runtime.html |
| 63 | + - the main issue is whether their restricted Python will allow us to |
| 64 | + run 'import bdb' and other necessary modules |
| 65 | + - could try to get Sal Khan to pay for my hosting if I host it |
| 66 | + alongside Khan Academy |
| 67 | + - could store analytics and user data in Google's db |
| 68 | + |
| 69 | + |
| 70 | +Related work: |
| 71 | + - PyWhip: http://pywhip.appspot.com/ |
| 72 | + - also powered by Google App Engine |
| 73 | + - Crunchy: http://code.google.com/p/crunchy/ |
| 74 | + |
| 75 | + |
| 76 | +From Hubert, regarding rendering linked structures vs. using |
| 77 | +containment: |
| 78 | +''' |
| 79 | +i totally agree with the sentiment that if you're not ever going to use it (for |
| 80 | +any binding of "it"), don't add the complexity. i sympathize with the laziness |
| 81 | +argument, that it's easy to do HTML tables than arrowheads, but if you change |
| 82 | +your mind, consider using HTML5's canvas -- many browsers support it. |
| 83 | +regarding the aliasing, from an epistemological standpoint, do you foresee that |
| 84 | +you'll have to cover the difference between passing by reference vs by value? |
| 85 | +this was a rather big stumbling block for me when learning Python, having come |
| 86 | +from C where the different passing styles are syntactically explicit. i |
| 87 | +recognize that the current visualizations don't depict argument passing, so it |
| 88 | +may be moot. but one cheap trick you can explore is to "color" identical |
| 89 | +objects with the same color, so that if a data structure appears in multiple |
| 90 | +places, it is colored differently, if they are indeed different objects. |
| 91 | +''' |
| 92 | + |
| 93 | +--- |
| 94 | +2010-09-05 |
| 95 | + |
| 96 | +From an email from Peter Wentworth ( [email protected]) |
| 97 | + |
| 98 | +''' |
| 99 | +I'd like to see the heap explicitly represented, so that mutable |
| 100 | +structures like lists are created in the heap rather than "in the stack |
| 101 | +frame". Passing a list as an argument then becomes "pass the |
| 102 | +reference". |
| 103 | + |
| 104 | +I appreciate that you do have the id tags to indicate which are the |
| 105 | +aliases, but I think the instructional value would be even more |
| 106 | +compelling to see some pointers referencing the same underlying object. |
| 107 | +''' |
| 108 | + |
| 109 | +--- |
| 110 | +From Hacker News feedback: |
| 111 | + |
| 112 | +- support for raw_input() sounds like something reasonable to include, |
| 113 | + though, since it could simply pop up a text box and ask the user to |
| 114 | + input a string e.g., javascript:alert("hello, " + prompt("what is your |
| 115 | + name?")) |
| 116 | + |
| 117 | +--- |
| 118 | +2010-09-29 |
| 119 | + |
| 120 | +Chas Leichner ( [email protected]) emailed me to show me his related |
| 121 | +project: |
| 122 | + |
| 123 | + http://www.youtube.com/watch?v=ZiS4MZF5eDQ |
| 124 | + http://code.google.com/p/idlecarpentry/ |
| 125 | + |
| 126 | +He had an interesting idea of annotating lines of code with special |
| 127 | +comments, and those comments would display when those lines were being |
| 128 | +executed. That way, you can have sorta like 'literate programming |
| 129 | +tutorials' that intermix code and comments. I could think about |
| 130 | +implementing something similar within my Online Python Tutor. |
| 131 | + |
| 132 | +e.g., |
| 133 | + |
| 134 | +#> declare a variable |
| 135 | +x = 5 |
| 136 | + |
| 137 | +#> an if statement tests a condition |
| 138 | +if x < 5: |
| 139 | + y = x + 5 |
| 140 | +else: |
| 141 | + y = x - 5 |
| 142 | + |
| 143 | +the appropriate annotations would display when you stepped through the |
| 144 | +line of code immediately below each annotation. |
| 145 | + |
| 146 | +--- |
| 147 | +2011-01-16 |
| 148 | + |
| 149 | +Bug report from Peter Wentworth |
| 150 | + |
| 151 | +''' |
| 152 | +I also have what I think is a bug report: your front-end javascript treats variables with the value None as if they are undefined. (They are reflected in the trace that we get from the server.) |
| 153 | + |
| 154 | +X = 123 |
| 155 | +z = 'hello' |
| 156 | +x = None |
| 157 | +y = 123 |
| 158 | + |
| 159 | +del y |
| 160 | +print(x) |
| 161 | +print(type(x)) |
| 162 | + |
| 163 | +--- |
| 164 | +I changed your script - around line 293 of edu-python.js, you have a condition checking for undefined (search for the comment containing “which is OKAY!”). I just eliminated the check, and can’t figure out which cases I might have broken it for! |
| 165 | +''' |
| 166 | + |
| 167 | +--- |
| 168 | +2011-05-23 |
| 169 | + |
| 170 | +Bug report from Peter Wentworth |
| 171 | + |
| 172 | +''' |
| 173 | +Hi Philip |
| 174 | + |
| 175 | +I hope you are keeping well! |
| 176 | + |
| 177 | +Scripts fail in the visualizer when the user has a variable called “length”, because somehow the front-end jquery is doing something wrong. It happens both when used as a local or as a global variable. See my image of what is happening on your site. (Tried in both Firefox and Internet Explorer). |
| 178 | + |
| 179 | +It looks like a jquery bug (I haven’t tried moving to a newer version – I’m using 1.3.2 that I got from your version). |
| 180 | + |
| 181 | +The iterators + lambda functions appear to be misbehaving when varname has the value “length”. |
| 182 | +So I’ve had to rip out the iterators and gone for vanilla javascript loops, which has solved it for me. |
| 183 | + |
| 184 | +I’ve done changes similar to this in 4 places in function updateOutput in file edu_python.js |
| 185 | + |
| 186 | + |
| 187 | +// $.each(curTrace[i].globals, function(varname, val) { |
| 188 | +// // eliminate duplicates (act as an ordered set) |
| 189 | +// if ($.inArray(varname, orderedGlobals) == -1) { |
| 190 | +// orderedGlobals.push(varname); |
| 191 | +// curGlobalFields[varname] = undefined; // 'unset it' |
| 192 | +// } |
| 193 | +// }); |
| 194 | + |
| 195 | + for (varname in curTrace[i].globals) { |
| 196 | + // eliminate duplicates (act as an ordered set) |
| 197 | + if ($.inArray(varname, orderedGlobals) == -1) { |
| 198 | + orderedGlobals.push(varname); |
| 199 | + curGlobalFields[varname] = undefined; // 'unset it' |
| 200 | + } |
| 201 | + } |
| 202 | + |
| 203 | +Regards |
| 204 | + |
| 205 | +Peter |
| 206 | +''' |
| 207 | + |
0 commit comments