Why do I have to use "global" so much when using Turtle?

2013-09-21 Thread John Ladasky
Hi, folks, Some of you may remember that I am teaching some high school students how to program. Because they all love graphics, I have been investigating the turtle module, which I gather is built on top of Tk. I can see that real-time applications are possible. I'm writing a classic "bounc

Re: Sphinx Doctest: test the code without comparing the output.

2013-09-21 Thread Chris Angelico
On Sun, Sep 22, 2013 at 2:09 PM, Luca Cerone wrote: >> but if you're using this for a >> >> tutorial, you risk creating a breed of novice programmers who believe >> >> their first priority is to stop the program crashing. Smoke testing is > > Hi Chris, > actually my priority is to check that the c

Re: Sphinx Doctest: test the code without comparing the output.

2013-09-21 Thread Luca Cerone
> > That is not how doctest works. That test fails because its output is: ok.. is there a tool by which I can test if my code runs regardless the output? > > The only wild-card output that doctest recognises is ellipsis, and like > > all wild-cards, can match too much if you aren't careful. I

Re: Sphinx Doctest: test the code without comparing the output.

2013-09-21 Thread Luca Cerone
> but if you're using this for a > > tutorial, you risk creating a breed of novice programmers who believe > > their first priority is to stop the program crashing. Smoke testing is Hi Chris, actually my priority is to check that the code is correct. I changed the syntax during the development,

Re: reload and work flow suggestions

2013-09-21 Thread Westley Martínez
On Saturday, September 21, 2013 2:43:13 PM UTC-7, Peter Cacioppi wrote: > This is an idea brought over from another post. > > > > When I write Python code I generally have 2 or 3 windows open simultaneously. > > > > 1) An editor for the actual code. > > 2) The interactive interpreter. > > 3

Re: Sphinx Doctest: test the code without comparing the output.

2013-09-21 Thread Steven D'Aprano
On Sat, 21 Sep 2013 09:25:26 -0700, Luca Cerone wrote: >> And if you ignore the output, the error won't be caught either. What's >> the difference? >> >> >>> 1 + 1 #doctest:+IGNORE_OUTPUT (not a real directive) >> 1000 >> >> > The difference is that in that case you want to check whether the

Re: Sphinx Doctest: test the code without comparing the output.

2013-09-21 Thread Chris Angelico
On Sun, Sep 22, 2013 at 2:25 AM, Luca Cerone wrote: > The difference is that in that case you want to check whether the result is > correct or not, because you expect a certain result. > > In my case, I don't know what the output is, nor care for the purpose of the > tutorial. What I care is bei

Re: Making it a MultiThread!

2013-09-21 Thread Chris Angelico
On Sun, Sep 22, 2013 at 11:00 AM, Piet van Oostrum wrote: > Now if your GUI actions are starting some actions that last more than a > few tenths of a second, you should run these actions in another thread... Hmm. When I first learned GUI programming (on OS/2), the advice was one tenth of a second

Re: Making it a MultiThread!

2013-09-21 Thread Piet van Oostrum
stas poritskiy writes: >> I am working on integration of multiple GUI (Tkinter) elements, such >> a progress bar, label update, etc, and throughout my research i >> discovered that i need to have Threading modules used to distribute >> the calls for GUI update and processing of my main App. In g

Re: reload and work flow suggestions

2013-09-21 Thread Terry Reedy
On 9/21/2013 5:43 PM, Peter Cacioppi wrote: This is an idea brought over from another post. When I write Python code I generally have 2 or 3 windows open simultaneously. 1) An editor for the actual code. 2) The interactive interpreter. 3) An editor for the unit tests. (Sometimes skipped for qui

reload and work flow suggestions

2013-09-21 Thread Peter Cacioppi
This is an idea brought over from another post. When I write Python code I generally have 2 or 3 windows open simultaneously. 1) An editor for the actual code. 2) The interactive interpreter. 3) An editor for the unit tests. (Sometimes skipped for quick one-off scripts) My work flow tends to inv

Re: building an online judge to evaluate Python programs

2013-09-21 Thread Jabba Laci
Hi Ned, Could you please post here your AppArmor profile for restricted Python scripts? Thanks, Laszlo On Sat, Sep 21, 2013 at 12:46 AM, Ned Batchelder wrote: > On 9/20/13 6:26 PM, Jabba Laci wrote: >> >> I just found Docker ( http://docs.docker.io/en/latest/faq/ ). It seems >> sandboxing coul

Re: building an online judge to evaluate Python programs

2013-09-21 Thread Ned Batchelder
On 9/21/13 3:57 PM, Jabba Laci wrote: Hi Ned, Could you please post here your AppArmor profile for restricted Python scripts? Laszlo, the instructions are in the README, including the AppArmor profile. It isn't much: #include /bin/python { #include #include /** mr, # If

Re: Code suggestions?

2013-09-21 Thread MRAB
On 21/09/2013 15:00, Benjamin Schollnick wrote: Folks, I am re-writing an image gallery application that I wrote in Twisted. As part of this rewrite, I am attempting to simplify the process of managing the directory listings. Would anyone have any suggestions on streamlining or optimizing this

Code suggestions?

2013-09-21 Thread Benjamin Schollnick
Folks, I am re-writing an image gallery application that I wrote in Twisted. As part of this rewrite, I am attempting to simplify the process of managing the directory listings. Would anyone have any suggestions on streamlining or optimizing this code? The raw version of this file, is availabl

Re: Why does it have red squiggly lines under it if it works perfectly fine and no errors happen when I run it?

2013-09-21 Thread Dave Angel
On 21/9/2013 12:18, MRAB wrote: > On 21/09/2013 13:53, Dave Angel wrote: > [snip] >> Taking Steven's suggested code, and changing it so it uses a COPY of the >> global list; >> >> def median(): >> # Relies on the global variable called List. >> # assumes there is at least one number in t

Re: Sphinx Doctest: test the code without comparing the output.

2013-09-21 Thread Luca Cerone
> And if you ignore the output, the error won't be caught either. What's > > the difference? > > >>> 1 + 1 #doctest:+IGNORE_OUTPUT (not a real directive) > > 1000 > > The difference is that in that case you want to check whether the result is correct or not, because you expect a certain r

Re: Why does it have red squiggly lines under it if it works perfectly fine and no errors happen when I run it?

2013-09-21 Thread MRAB
On 21/09/2013 13:53, Dave Angel wrote: [snip] Taking Steven's suggested code, and changing it so it uses a COPY of the global list; def median(): # Relies on the global variable called List. # assumes there is at least one number in that list numbers = List.sorted() That should

Re: How to send an anonymous mail via Python script

2013-09-21 Thread Joel Goldstick
On Sat, Sep 21, 2013 at 6:41 AM, Chris Angelico wrote: > On Sat, Sep 21, 2013 at 8:15 PM, Νίκος wrote: > > On 21/9/2013 1:04 μμ, Chris Angelico wrote: > >> > >> On Sat, Sep 21, 2013 at 7:58 PM, Νίκος wrote: > >>> > >>> Can you please tell me what alternation must be made in order to send > >>>

Re: Sphinx Doctest: test the code without comparing the output.

2013-09-21 Thread Steven D'Aprano
On Sat, 21 Sep 2013 05:44:09 -0700, Luca Cerone wrote: > If you use a SKIP > directive on code that contains a typo, or maybe you changed the name of > a keyword to make it more meaningful and forgot to update your > docstring, then the error won't be caught. And if you ignore the output, the err

THE MORAL SYSTEM IN ISLAM

2013-09-21 Thread bv4bv4bv4
THE MORAL SYSTEM IN ISLAM Islam has laid down universal fundamental rights for humanity that are to be observed and respected under all circumstances. In order to realise these rights in one's everyday social life, Islam provides both legal safeguards and a very effective moral system. In

Re: Tryign to send mail via a python script by using the local MTA

2013-09-21 Thread William Ray Wing
On Sep 21, 2013, at 5:21 AM, Νίκος wrote: > On 18/9/2013 2:29 πμ, Dennis Lee Bieber wrote: >> On Tue, 17 Sep 2013 18:17:43 +0300, Ferrous Cranus >> declaimed the following: >> >>> So cant this be done in python or not? >>> or is a mtetr of configuring the MTA? conf file? >> >> You can't..

Re: Beginner - GUI devlopment in Tkinter - Any IDE with drag and drop feature like Visual Studio?

2013-09-21 Thread Dave Angel
On 21/9/2013 03:19, shubhx...@gmail.com wrote: > i am very confuse about gui development in python .. > i installed qt creator .. but it has no option for python.. > how can i bulit any app using drag n drop facilities ... > i am trying wxpython .. > plz help me . > how i use wxpython .. > plzz

Re: Why does it have red squiggly lines under it if it works perfectly fine and no errors happen when I run it?

2013-09-21 Thread Dave Angel
On 21/9/2013 02:07, William Bryant wrote: In addition to Steven's comments: > > def median(): > medlist = List > medlist.sort() You have just altered the original list. Perhaps sorting it is harmless, but below you actually remove elements from it. One way to avoid that is to use the s

Re: Sphinx Doctest: test the code without comparing the output.

2013-09-21 Thread Luca Cerone
Dear Steven, thanks for the help. I am aware that I might have used the SKIP directive (as I hinted in my mail). Even if the fine manual suggests to do so I don't agree with it, though. The reason is simple: SKIP as the name suggests causes the code not to be run at all, it doesn't ignore the out

Re: Sphinx Doctest: test the code without comparing the output.

2013-09-21 Thread Steven D'Aprano
On Sat, 21 Sep 2013 03:47:26 -0700, Luca Cerone wrote: > Dear all, > I am writing the documentation for a Python package using Sphinx. > > I have a problem when using doctest blocks in the documentation: I > couldn't manage to get doctest to run a command but completely ignoring > the output. >

Re: building an online judge to evaluate Python programs

2013-09-21 Thread Modulok
On Fri, Sep 20, 2013 at 11:28 AM, Jabba Laci wrote: > Hi, > > In our school I have an introductory Python course. I have collected a > large list of exercises for the students and I would like them to be > able to test their solutions with an online judge ( > http://en.wikipedia.org/wiki/Online_j

Re: TypeError: only length-1 arrays can be converted to Python

2013-09-21 Thread Oscar Benjamin
On Sep 21, 2013 7:40 AM, "D.YAN ESCOLAR RAMBAL" wrote: > > Traceback (most recent call last): > File "D:\Yan\Documents\Aptana Studio 3 Workspace\DIF1DMEDYER\SOLUCION NUMERICA PARA LA ECUACION DE LA DIFUSION EN 1D DYER", line 34, in > C=(Cdifuana(M,A,D,x,tinicial)) > File "D:\Yan\Documents

Sphinx Doctest: test the code without comparing the output.

2013-09-21 Thread Luca Cerone
Dear all, I am writing the documentation for a Python package using Sphinx. I have a problem when using doctest blocks in the documentation: I couldn't manage to get doctest to run a command but completely ignoring the output. For example, how can I get a doctest like the following to run correct

Re: How to send an anonymous mail via Python script

2013-09-21 Thread Chris Angelico
On Sat, Sep 21, 2013 at 8:15 PM, Νίκος wrote: > On 21/9/2013 1:04 μμ, Chris Angelico wrote: >> >> On Sat, Sep 21, 2013 at 7:58 PM, Νίκος wrote: >>> >>> Can you please tell me what alternation must be made in order to send >>> this >>> anonymously? >>> >>> that is my question. There must be a way.

Re: Why does it have red squiggly lines under it if it works perfectly fine and no errors happen when I run it?

2013-09-21 Thread Steven D'Aprano
On Fri, 20 Sep 2013 23:07:57 -0700, William Bryant wrote: > I am 13 year old beginner in > python and i am trying to finish the tutorial on code academy and read > the docs. :) Hi William, I think this is about the fifth or sixth time you've told us this. I'm really pleased that a youngster li

Re: How to send an anonymous mail via Python script

2013-09-21 Thread Νίκος
On 21/9/2013 1:04 μμ, Chris Angelico wrote: On Sat, Sep 21, 2013 at 7:58 PM, Νίκος wrote: Can you please tell me what alternation must be made in order to send this anonymously? that is my question. There must be a way. No, there isn't. The nearest you could come to anonymous mail would be s

Re: How to send an anonymous mail via Python script

2013-09-21 Thread Chris Angelico
On Sat, Sep 21, 2013 at 7:58 PM, Νίκος wrote: > Can you please tell me what alternation must be made in order to send this > anonymously? > > that is my question. There must be a way. No, there isn't. The nearest you could come to anonymous mail would be sending via a botnet (to hide your IP addr

Re: In Python language, what is (void) referring to?

2013-09-21 Thread Steven D'Aprano
On Sat, 21 Sep 2013 02:10:49 -0700, Don Sylvia wrote: > void...? In Python, void doesn't mean anything. [steve@ando ~]$ python Python 2.7.2 (default, May 18 2012, 18:25:10) [GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2 Type "help", "copyright", "credits" or "license" for more informa

How to send an anonymous mail via Python script

2013-09-21 Thread Νίκος
I'll have to ask this atgain because i got no proper reply: Here is the code i wrote to try tos end anonymous mail: # = # if html form is submitted then send user mail #

Re: In Python language, what is (void) referring to?

2013-09-21 Thread Chris Angelico
On Sat, Sep 21, 2013 at 7:10 PM, Don Sylvia wrote: > void...? > -- > https://mail.python.org/mailman/listinfo/python-list That looks like a C-style cast, though casting to void is unusual. If you're looking at the source code to CPython, you might find something like that. In C it usually

Re: Tryign to send mail via a python script by using the local MTA

2013-09-21 Thread Νίκος
On 18/9/2013 2:29 πμ, Dennis Lee Bieber wrote: On Tue, 17 Sep 2013 18:17:43 +0300, Ferrous Cranus declaimed the following: So cant this be done in python or not? or is a mtetr of configuring the MTA? conf file? You can't... Those headers get added by the ISP and any other host the ma

Re: In Python language, what is (void) referring to?

2013-09-21 Thread Chris “Kwpolska” Warrick
On Sat, Sep 21, 2013 at 11:10 AM, Don Sylvia wrote: > void...? > -- > https://mail.python.org/mailman/listinfo/python-list void does not exist in Python, unless you named a variable “void”. In that case, it means whatever you set it to. -- Chris “Kwpolska” Warrick

In Python language, what is (void) referring to?

2013-09-21 Thread Don Sylvia
void...? -- https://mail.python.org/mailman/listinfo/python-list

Re: Beginner - GUI devlopment in Tkinter - Any IDE with drag and drop feature like Visual Studio?

2013-09-21 Thread Aseem Bansal
You need to install PySide for GUI development. You don't need Qt Creator. When you have PySide installed there is a Qt Designer in your python installation directory. You use that for drag and drop GUI development. Search google for PySide and you'll find tutorials for that. -- https://mail.py

Re: Beginner - GUI devlopment in Tkinter - Any IDE with drag and drop feature like Visual Studio?

2013-09-21 Thread shubhxx54
i am very confuse about gui development in python .. i installed qt creator .. but it has no option for python.. how can i bulit any app using drag n drop facilities ... i am trying wxpython .. plz help me . how i use wxpython .. plzz help me.. -- https://mail.python.org/mailman/listinfo/pyth