-
Notifications
You must be signed in to change notification settings - Fork 924
/
TODO
223 lines (160 loc) · 6.68 KB
/
TODO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
A disorganized collection of TODOs, bug reports, and friends' suggestions
---
January/Feb 2010 (notes from initial release)
Maybe don't display boilerplate code when classes are being initialized?
Hubert's suggestions for permalinks:
'''
Hubert: 1) It would be cool to have the ability to link directly to an
execution point, so that when I send you a link, you could see the code
I'd written and the point in execution that I want to discuss.
me: good suggestion. that also requires me to save your code in
something other than a regular POST variable, which i'm not doing right
now. then i could send links of the following form:
http://python.pgrind.com/code_id=20#4 (for line 4 of code snippet 20)
Hubert: yup, yeah the problem lies in storing the code, which brings in
a whole can of worms. but suppose you did, consider a RESTful approach
(which I am drilling into deeply, hence it's on my mind):
http://python.pgrind.com/pg/code/20#4
...quite easy to do and manage in a framework like Django.
'''
Cory McLean: 'Might be nice to be able to automatically jump to particular step
# rather than just inc/decrement and jump to ends, particular if the
number of steps executed is significant.'
Related work:
- PyWhip: http://pywhip.appspot.com/
- also powered by Google App Engine
- Crunchy: http://code.google.com/p/crunchy/
---
2010-09-05
From Hacker News feedback:
- support for raw_input() sounds like something reasonable to include,
though, since it could simply pop up a text box and ask the user to
input a string e.g., javascript:alert("hello, " + prompt("what is your
name?"))
---
2010-09-29
Chas Leichner (chaoslichen@gmail.com) emailed me to show me his related
project:
http://www.youtube.com/watch?v=ZiS4MZF5eDQ
http://code.google.com/p/idlecarpentry/
He had an interesting idea of annotating lines of code with special
comments, and those comments would display when those lines were being
executed. That way, you can have sorta like 'literate programming
tutorials' that intermix code and comments. I could think about
implementing something similar within my Online Python Tutor.
e.g.,
#> declare a variable
x = 5
#> an if statement tests a condition
if x < 5:
y = x + 5
else:
y = x - 5
the appropriate annotations would display when you stepped through the
line of code immediately below each annotation.
---
2011-09-15
- Integrate Peter's Python 3 fork into one unified application, and
perhaps deploy online on WebFaction, since they offer both Python 2.X
and Python 3.X on their servers.
---
2011-09-23
- The BACKEND can easily print out a nice list of variables in each
stack frame (and globals) by order of their APPEARANCE in the original
program execution ... that way, the front-end doesn't have to "guess"
an optimal order and can simply use the order that the backend has
pre-computed. e.g., list local stack variables by their order of
definition in the original program execution.
---
2011-09-24
Ron's suggestion:
Ron Yeh - Feedback: It'd be nice if (for longer programs) the text
window would auto scroll to the current line. For your "Philip's
10-minute intro to Python" example, I was stepping through your code but
then the current line went off screen. I had to manually scroll down a
few times.
Philip Guo - great idea! do you know if there's any jQuery or other js
tricks to do this sort of scrolling?
Ron Yeh - Pretty sure I've done this before, a while back. Basicaly you
just need a named div or anchor in your document, and then you can
scroll to it. This page might help:
http://css-tricks.com/snippets/jquery/smooth-scrolling/
(also auto-scroll the program's stdout output as well as the code
display ... that one is easy --- always auto-scroll to BOTTOM!)
---
2011-09-26
A subset of the suggestions from MIT folks (see more in my private notes
file):
- what if the user accidentally (or purposefully) creates a HUGE list or
other data structure? how will the visualization handle this? right
now it might croak.
- one idea is to LIMIT the size of the returned JSON data from the
back-end???
- to make it easier to jump to certain points in execution rather than
tediously single-step through execution. e.g., could imagine adding a
scrubber (like for video playback) combined with pointing at line of
code to jump to the NEXT or PREV time that line of code as executed.
---
2011-09-29
Upgrade to Python 2.7 after moving over to Webfaction, so that I can use
the default standard library "import json"
---
2011-10-05 feedback from Imran:
'''
ok, here's a super artificial example that actually is really confusing
in the standard Python REPL as well:
cA = type("A",(object,),{})
cA2 = type("A",(object,),{})
a=cA()
a2=cA2()
If you visualize this program, it's actually better than CPython because
it shows that the two class objects have different ids even though they
have the same __name__, but then a and a2 are just shown as instances of
"A", which is now ambiguous.
you're well within your rights to call this example bad code (because
holy hell, it is) and out of the scope of your project, but one way to
handle it might be to keep a separate column for type objects, or to
include the class id along with the class __name__ when identifying the
type of an object.
also, if you modify the OOP example to make A and B new-style classes
inheriting from object, the class visualization shows the __dict__ and
__weakref__ fields in the A and B type objects, with no useful repr for
them. Do you really want those shown?
can you tell i've been doing crazy python oop stuff recently?
ps here's an even more painful instance of the bug report:
x=[1,2,3]
wtfpwn = type('list',(list,),{})
INCEPTION = [wtfpwn()]
print x
which "list" is which???
'''
---
2011-10-12
Code snippets from Adam Hartz for time-limiting a Python child process:
def setlimits():
"""
Helper to set CPU time limit for check_code, so that infinite loops
in submitted code get caught instead of running forever.
"""
resource.setrlimit(resource.RLIMIT_CPU, (10, 10))
def check_python_code(code):
#TODO: Investigate pypy for sandboxing
"""
Run the given code; outputs a tuple containing:
the program's output (stdout), error messages (stderr)
"""
python = subprocess.Popen(["python"],stdin=subprocess.PIPE,\
stdout=subprocess.PIPE,\
stderr=subprocess.PIPE,\
preexec_fn=setlimits)
PY_PROCESS_LOCK.acquire()
output = python.communicate(code)
PY_PROCESS_LOCK.release()
return output
---
2011-10-17
Bug report from user ... problems with utf-8 in non-commented code:
# coding = utf-8
x = [1, 2, 3] # čęė - OK
y = x
y = u"asdęė" # problem