-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Demo and Tools need to be tested and pruned #52210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Try a demo in the source distribution's Demo/ directory and report here if it doesn't work. Many are unmaintained and should be deleted in favor of examples in the documentation. |
Why only Python 3.2, why not python 2.7 ? |
There's only so much free time developers can spend on Python. Also, most demos still work in 2.x, even if they are unmaintained, ugly or demonstrate old concepts. In contrast, most demos weren't tested after porting to 3.x, so many of them don't even run there (and nobody runs them, otherwise we'd have got at least some reports in the tracker). |
While I was checking 2.7, /Demo/scripts, some of the codes followed the most naive approach (unoptimized) like /Demo/scripts/fact.py which calculate factors and /Demo/scripts/prime.py which calculates prime. Shall I write the optimized version(if no-one have issues), or the rudimentary working versions are good as of now ? |
Well, these demos are not meant to demonstrate the fastest algorithms, but to demonstrate how easy and readable simple algorithms can be written in Python. That said, if you can write better versions that are also very readable, they'll make a good addition. |
I've started going through the demos. So far I've gone through cgi and classes. If this is what you're looking for I'll try and go through the rest in the next week or so. Python 3.2a0 /cgi /classes 1 and Complex(0, 10) -> <class 'TypeError'>
Traceback (most recent call last):
File "Complex.py", line 314, in <module>
test()
File "Complex.py", line 310, in test
checkop(*(t+item))
File "Complex.py", line 235, in checkop
ok = abs(result - value) <= fuzz
File "Complex.py", line 184, in __rsub__
return other - self
File "Complex.py", line 180, in __sub__
return Complex(self.re - other.re, self.im - other.im)
TypeError: unsupported operand type(s) for -: 'type' and 'int'
Dates.py - fail
Traceback (most recent call last):
File "Dates.py", line 227, in <module>
test(1850, 2150)
File "Dates.py", line 185, in test
if (not a < b) or a == b or a > b or b != b:
TypeError: unorderable types: Date() < Date()
Dbm.py - fail
{}
key: "myKey"
Traceback (most recent call last):
File "Dbm.py", line 66, in <module>
test()
File "Dbm.py", line 49, in test
if key in d:
File "Dbm.py", line 25, in __getitem__
return eval(self.db[repr(key)])
KeyError: '0'
|
Does “tested” in the title of this issue mean “run” or “unit-tested”? Regarding the 2.7 branch, is this still relevant? |
I'm assuming tested means "run", and that a good demo is one that "works" for some nominal input. |
I’m making this a meta-bug to record the evaluation of demos and tools, in followup with the thread “Signs of neglect?” started on http://mail.python.org/pipermail/python-dev/2010-June/101092.html. Some of them have already been adopted or deleted. Please add yourself to Misc/maintainers.rst when you adopt one. I also propose adding either a section in the README or a new README.removed file to list the deletions; there are probably people out there using these tools (maybe not demos, though), so it’s more polite to tell them “metaclasses is removed, see this doc for modern built-in metaclasses” than to just remove the file. Regarding testing, please comment on bpo-9153. |
I fixed Dates.py. See bpo-9151. I also committed a minimal fix for Complex.py in r82524. |
I fixed Rev.py in r82550, but I don't think it is worth keeping in the current form. Maybe it can be replaced with a pure python reimplementation of builtins.reversed. Note that slicing does not work for Rev: >>> r = Rev([1,2,3])
>>> r[:]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "Demo/classes/Rev.py", line 69, in __getitem__
return self.forw[-(j + 1)]
TypeError: unsupported operand type(s) for +: 'slice' and 'int' |
Fixed Range.py in r82551. |
I should note here that I fixed Demo/md5test/md5driver.py in r82351 (py3k) and r82352 (release31-maint). |
I wonder if it would be possible as a part of Demo and Tools clean-up to move them into packages under Lib. I would really like to be able to do $ python -m demo.turtle instead of (on a Mac) $ cd /Applications/Python\ 2.6/Extras/Demo/turtle/
$ python turtleDemo.py and I still cannot find where Apple decided to put Tools. |
"instead of (on a Mac) $ cd /Applications/Python\ 2.6/Extras/Demo/turtle/
$ python turtleDemo.py and I still cannot find where Apple decided to put Tools." This has nothing to do with Apple. "/Applications/Python x.y" is created by the python.org OS X installer, not supplied by Apple. See Mac/BuildScript/build-installer.py for the details. AFAIK, the Tools directory is currently not installed by the OS X installer. Should it be? |
On Mon, Jul 26, 2010 at 11:58 PM, Ned Deily <report@bugs.python.org> wrote:
Does this mean that Apple distributes neither Tools nor Demo? That
Probably not all of it. Moving to "tools" package would give an |
I believe that neither are included in the Apple-supplied Python in OS X, which resides primarily in /System/Library/Frameworks/Python.framework. In recent OS releases, Apple seems to have taken their cue from the python.org installer framework layouts but tweaked things somewhat. Ronald may have more insight and/or an opinion on this. He's also had some contact with the people inside Apple. |
What Apple does and doesn't ship is not important for this discussion. FWIW: Apple doesn't ship any of the GUI wrappers installed in /Applications, although they seem to ship Applet Builder as part of Developer tools (beets my why the bother). They don't ship any of the examples or tools, and don't ship documentation as well. Our OSX installer does install most of these, on the assumption that anything that is part of the source distribution might be of interest for users. |
On Tue, Jul 27, 2010 at 1:49 AM, Ronald Oussoren <report@bugs.python.org> wrote:
I agree. I used Apple as an example because I happened to post from However they do ship Lib/test. This tells me that they don't try to
Installing some of the tools (and I don't think any demos are |
It looks like turtle was not the best example for msg111682 because it is already in Lib and python -m turtle runs demo. I am not sure what the relationship between Demo/turtle and the turtle module is. |
Removed Demo and some of the Tools in a series of commits starting with r87579. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: