Re: PEP 450 Adding a statistics module to Python

2013-08-10 Thread Stefan Behnel
Ben Finney, 10.08.2013 07:05: > Skip Montanaro writes: >> Given that installing numpy or scipy is generally no more difficult >> that executing "pip install (scipy|numpy)" I'm not really feeling the >> need for a battery here... > > See the Rationale of PEP 450 for more reasons why “install NumPy”

Re: Get filename using filefialog.askfilename

2013-08-10 Thread cheirasacan
Sarcastic what the kcuf ¿?¿?¿? My english is SO bad? Do you know me? I can not understand this paranoia i only was giving thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3 and SSH Tunnel

2013-08-10 Thread D. Xenakis
What about the security though? To be specific, i need to create an application (python 3.3 strictly) where users will save/load their settings online to a remote hosted database. I do not wish to change the database from listening to any other thing than localhost for security reasons, so i a

Python 3.3 + QtSql + ssh tunnel - Connection problem

2013-08-10 Thread D. Xenakis
Im using python 3.3 on win7 64bit and trying to connect to a MySQL database on a remote server through a putty ssh tunnel. Running the script below im getting "Physical connection to the database did not activate!". What im i doing wrong?! I tried to find a working example but couldnt find one.

Re: ftplib returns EOFError

2013-08-10 Thread Dorian MJ
print "\t\tUploading file %s..." % newname try: self.ftp.storbinary("STOR %s" % newname, open(file)) except EOFError: # yep?? self.ftp.connect(self.ftpServ) # reconnecting self.ftp.login(ftpUser, ftpPass) self.ftp.storbinary("STOR %s" % newname, open(file)) print "\t\tFile %s uploaded" % newname -

Re: PEP 450 Adding a statistics module to Python

2013-08-10 Thread Roy Smith
In article , Skip Montanaro wrote: > Given that installing numpy or scipy is generally no more difficult > that executing "pip install (scipy|numpy)" I'm not really feeling the > need for a battery here... I just tried installing numpy in a fresh virtualenv on an Ubuntu Precise box. I ran "pi

Re: Get filename using filefialog.askfilename

2013-08-10 Thread Joshua Landau
On 10 August 2013 11:37, wrote: > Sarcastic what the kcuf ¿?¿?¿? > > My english is SO bad? > > Do you know me? > > I can not understand this paranoia i only was giving thanks. Sarcasm and a lack thereof is very hard to see over the Internet. It's probably just a misunderstanding :).

Re: PEP 450 Adding a statistics module to Python

2013-08-10 Thread Oscar Benjamin
On 10 August 2013 12:50, Roy Smith wrote: > In article , > Skip Montanaro wrote: > >> Given that installing numpy or scipy is generally no more difficult >> that executing "pip install (scipy|numpy)" I'm not really feeling the >> need for a battery here... > > I just tried installing numpy in a

Re: PEP 450 Adding a statistics module to Python

2013-08-10 Thread Roy Smith
Skip Montanaro wrote: > >> installing numpy or scipy is generally no more difficult > >> that executing "pip install (scipy|numpy)" I described the problems I had trying to follow that advice. In article , Oscar Benjamin wrote: > You should use apt-get for numpy/scipy on Ubuntu. Although > un

Re: PEP 450 Adding a statistics module to Python

2013-08-10 Thread Oscar Benjamin
On 10 August 2013 13:43, Roy Smith wrote: > > In article , > Oscar Benjamin wrote: > >> You should use apt-get for numpy/scipy on Ubuntu. Although >> unfortunately IIRC this doesn't work as well as it should since Ubuntu >> doesn't install the appropriate BLAS/LAPACK libraries by default >> (lea

Calling Py_Main() and parsing the output from C

2013-08-10 Thread Gisle Vanem
Hello Python & C-experts. I'm trying to embed python27.dll in a C-program written in MingW-gcc 4.7.2. I've successfully done these initial steps: typedef int (*Py_Main_t) (int argc, char **argv); handle = LoadLibrary ("python27.dll"); py_main = (Py_Main_t) GetProcAddress (handle, "Py_Main");

Python Basic Doubt

2013-08-10 Thread Krishnan Shankar
Hi Fellow Python Friends, I am new to Python and recently subscribed to the mailing list.I have a doubt regarding the basics of Python. Please help me in understanding the below concept. So doubt is on variables and their contained value. Why does in the below example from Interpreter exploratio

Re: Python Basic Doubt

2013-08-10 Thread Tim Chase
On 2013-08-10 21:03, Krishnan Shankar wrote: > >>> a=10 > >>> id(a) > 21665504 > >>> b=a > >>> id(b) > 21665504 > >>> c=10 > >>> id(c) > 21665504 > > I am actually assigning new value to c. But from the value of id() > all three variables take same location. With variables a and b it > is ok. But

Re: Python Basic Doubt

2013-08-10 Thread Roy Smith
In article , Krishnan Shankar wrote: > Hi Fellow Python Friends, > > I am new to Python and recently subscribed to the mailing list.I have a > doubt regarding the basics of Python. Please help me in understanding the > below concept. > > So doubt is on variables and their contained value. > >

Re: Python Basic Doubt

2013-08-10 Thread Chris Angelico
On Sat, Aug 10, 2013 at 4:33 PM, Krishnan Shankar wrote: > Hi Fellow Python Friends, > > I am new to Python and recently subscribed to the mailing list.I have a > doubt regarding the basics of Python. Please help me in understanding the > below concept. > > So doubt is on variables and their conta

Re: Python Basic Doubt

2013-08-10 Thread Terry Reedy
On 8/10/2013 11:33 AM, Krishnan Shankar wrote: Hi Fellow Python Friends, I am new to Python and recently subscribed to the mailing list.I have a doubt regarding the basics of Python. Please help me in understanding the below concept. So doubt is on variables and their contained value. It woul

Re: Python Basic Doubt

2013-08-10 Thread Xavi
Hello, El 10/08/2013 18:40, Tim Chase escribió: Generally, if you are using the "is" operator to compare against anything other than None, you're doing it wrong. There are exceptions to this, but it takes knowing the particulars. Now I have one doubt, I use 'is' to compare basic types in pytho

The meaning of "doubt", was Re: Python Basic Doubt

2013-08-10 Thread Peter Otten
Terry Reedy wrote: > On 8/10/2013 11:33 AM, Krishnan Shankar wrote: >> Hi Fellow Python Friends, >> >> I am new to Python and recently subscribed to the mailing list.I have a >> doubt regarding the basics of Python. Please help me in understanding >> the below concept. >> >> So doubt is on variabl

Re: The meaning of "doubt", was Re: Python Basic Doubt

2013-08-10 Thread Roy Smith
In article , Peter Otten <__pete...@web.de> wrote: > Quoting http://en.wikipedia.org/wiki/Indian_English > > """ > doubt = question or query; e.g. one would say, 'I have a doubt' when one > wishes to ask a question. > """ > > I'd say if Brits can cope (hard as it may be) with the American vari

Re: Python 3 and SSH Tunnel

2013-08-10 Thread Veritatem Ignotam
I think I missed an earlier thread of this and I'm not quite sure what your application is, but properly allocating user permissions on your databases should eliminate any security concerns there. Also, for the tunnel, whether you're using one account or multiple (one for each user), those acco

Re: Python Basic Doubt

2013-08-10 Thread Steven D'Aprano
On Sat, 10 Aug 2013 20:00:58 +0200, Xavi wrote: > Now I have one doubt, I use 'is' to compare basic types in python 3, for > example .- > > v = [] > if type(v) is list: > print('Is list...') No, do not do this. This is unnecessarily restrictive. > Because I think it is more clear and faste

Re: The meaning of "doubt", was Re: Python Basic Doubt

2013-08-10 Thread Alister
On Sat, 10 Aug 2013 20:36:52 +0200, Peter Otten wrote: > Terry Reedy wrote: > >> On 8/10/2013 11:33 AM, Krishnan Shankar wrote: >>> Hi Fellow Python Friends, >>> >>> I am new to Python and recently subscribed to the mailing list.I have >>> a doubt regarding the basics of Python. Please help me in

Re: Python Basic Doubt

2013-08-10 Thread Terry Reedy
On 8/10/2013 2:00 PM, Xavi wrote: Hello, El 10/08/2013 18:40, Tim Chase escribió: Generally, if you are using the "is" operator to compare against anything other than None, you're doing it wrong. There are exceptions to this, but it takes knowing the particulars. Now I have one doubt, I use '

Re: The meaning of "doubt", was Re: Python Basic Doubt

2013-08-10 Thread Terry Reedy
On 8/10/2013 2:36 PM, Peter Otten wrote: Terry Reedy wrote: On 8/10/2013 11:33 AM, Krishnan Shankar wrote: Hi Fellow Python Friends, I am new to Python and recently subscribed to the mailing list.I have a doubt regarding the basics of Python. Please help me in understanding the below concept.

How many times does unittest run each test?

2013-08-10 Thread Josh English
I am working on a library, and adding one feature broke a seemingly unrelated feature. As I already had Test Cases written, I decided to try to incorporate the logging module into my class, and turn on debugging at the logger before the newly-broken test. Here is an example script: # - #!/u

Re: How many times does unittest run each test?

2013-08-10 Thread Roy Smith
In article , Josh English wrote: > I am working on a library, and adding one feature broke a seemingly unrelated > feature. As I already had Test Cases written, I decided to try to incorporate > the logging module into my class, and turn on debugging at the logger before > the newly-broken te

Re: Python Basic Doubt

2013-08-10 Thread Roy Smith
In article , Dennis Lee Bieber wrote: > Because id(n) is not giving you the address of the NAME. It is giving > you the address of the "10" Actually, it is giving you the id of the int(10) object. Maybe it's an address, maybe it's not. Only your implementation knows for sure. -- http://mail

Re: The meaning of "doubt", was Re: Python Basic Doubt

2013-08-10 Thread Cousin Stanley
Peter Otten wrote: > > doubt > Oh bother, said Pooh, what's in a word ? http://en.wikipedia.org/wiki/Curry https://pypi.python.org/pypi/curry/ http://en.wikipedia.org/wiki/Currying -- Stanley C. Kitching Human Being Phoenix, Arizona -- http://mail.python.org/mailm

Re: Python Basic Doubt

2013-08-10 Thread Chris Angelico
On Sat, Aug 10, 2013 at 7:00 PM, Xavi wrote: > Now I have one doubt, I use 'is' to compare basic types in python 3, for > example .- > > v = [] > if type(v) is list: > print('Is list...') > > Because I think it is more clear and faster than .- > type(v) == [].__class__ ... or ... isinstance(v

Re: Python Basic Doubt

2013-08-10 Thread Gary Herron
On 08/10/2013 11:00 AM, Xavi wrote: Hello, El 10/08/2013 18:40, Tim Chase escribió: Generally, if you are using the "is" operator to compare against anything other than None, you're doing it wrong. There are exceptions to this, but it takes knowing the particulars. Now I have one doubt, I use

Re: Python Basic Doubt

2013-08-10 Thread Chris Angelico
On Sat, Aug 10, 2013 at 10:48 PM, Gary Herron wrote: > This is an oversimplification, but generally useful for all beginner (and > most advanced) programmers: > Don't use "is" for comparisons. Use "==". > It 20 years of programming Python, I've *needed* to use "is" ... only once > or twice.

Re: How many times does unittest run each test?

2013-08-10 Thread Josh English
On Saturday, August 10, 2013 1:40:43 PM UTC-7, Roy Smith wrote: > In article , > > Josh English wrote: > The first thing to do is get this down to some minimal amount of code > that demonstrates the problem. > > > > For example, you drag in the logging module, and do some semi-complex > con

Re: How many times does unittest run each test?

2013-08-10 Thread Josh English
Aha. Thanks, Ned. This is the answer I was looking for. I use logging in the real classes, and thought that turning setting the level to logging.DEBUG once was easier than hunting down four score of print statements. Josh On Sat, Aug 10, 2013 at 3:52 PM, Ned Batchelder wrote: > On 8/10/13 4:40

Re: How many times does unittest run each test?

2013-08-10 Thread Roy Smith
On Saturday, August 10, 2013 1:40:43 PM UTC-7, Roy Smith wrote: > > For example, you drag in the logging module, and do some semi-complex > > configuration. Are you SURE your tests are getting run multiple times, > > or maybe it's just that they're getting LOGGED multiple times. Tear out > > a

Re: How many times does unittest run each test?

2013-08-10 Thread Chris Angelico
On Sun, Aug 11, 2013 at 12:14 AM, Roy Smith wrote: > Maybe you've got two different handlers which are both getting the same > logging events and somehow they both end up in your stderr stream. > Likely? Maybe not, but if you don't have any logging code in the test > at all, it becomes impossible

Re: How many times does unittest run each test?

2013-08-10 Thread Ned Batchelder
On 8/10/13 4:40 PM, Roy Smith wrote: In article , Josh English wrote: I am working on a library, and adding one feature broke a seemingly unrelated feature. As I already had Test Cases written, I decided to try to incorporate the logging module into my class, and turn on debugging at the log

Re: How many times does unittest run each test?

2013-08-10 Thread Josh English
On Saturday, August 10, 2013 4:14:09 PM UTC-7, Roy Smith wrote: > > > I don't understand the whole SimpleChecker class. You've created a > class, and defined your own __call__(), just so you can check if a > string is in a list? Couldn't this be done much simpler with a plain > old function

Re: Python Basic Doubt

2013-08-10 Thread Gary Herron
On 08/10/2013 03:09 PM, Chris Angelico wrote: On Sat, Aug 10, 2013 at 10:48 PM, Gary Herron wrote: This is an oversimplification, but generally useful for all beginner (and most advanced) programmers: Don't use "is" for comparisons. Use "==". It 20 years of programming Python, I've *neede

Re: How many times does unittest run each test?

2013-08-10 Thread Josh English
On Saturday, August 10, 2013 4:21:35 PM UTC-7, Chris Angelico wrote: > On Sun, Aug 11, 2013 at 12:14 AM, Roy Smith <> wrote: > > > Maybe you've got two different handlers which are both getting the same > > loggingvents and somehow they both end up in your stderr stream. > > Likely? Maybe not, bu

Re: Python Basic Doubt

2013-08-10 Thread Chris Angelico
On Sun, Aug 11, 2013 at 1:42 AM, Gary Herron wrote: > On 08/10/2013 03:09 PM, Chris Angelico wrote: >> _notpassed = object() >> def frob(appendage, device=_notpassed): >> """Use some appendage to frob some device, or None to frob nothing. >> Omit device to frob whatever is currently held

Re: How many times does unittest run each test?

2013-08-10 Thread Chris Angelico
On Sun, Aug 11, 2013 at 1:52 AM, Josh English wrote: > I'm using logging for debugging, because it is pretty straightforward and can > be activated for a small section of the module. My modules run long (3,000 > lines or so) and finding all those dastardly print statements is a pain, and > litt

Re: Python Basic Doubt

2013-08-10 Thread Terry Reedy
On 8/10/2013 8:42 PM, Gary Herron wrote: But for each of your examples, using "==" is equivalent to using "is". Each of if something == None if device == _not passed if device != None would all work as expected. In none of those cases is "is" actually needed. class EqualAll:

Re: Python Basic Doubt

2013-08-10 Thread Chris Angelico
On Sun, Aug 11, 2013 at 2:25 AM, Terry Reedy wrote: > On 8/10/2013 8:42 PM, Gary Herron wrote: > >> But for each of your examples, using "==" is equivalent to using "is". >> Each of >> if something == None >> if device == _not passed >> if device != None >> would all work as expecte

Am I not seeing the Error?

2013-08-10 Thread Devyn Collier Johnson
I am checking my 1292-line script for syntax errors. I ran the following commands in a terminal to check for errors, but I do not see the error. collier@Nacho-Laptop:/media/collier/AI/Pysh$ python3 -m py_compile ./beta_engine File "./beta_engine", line 344 JOB_WRITEURGFILES = multiproce

Re: Am I not seeing the Error?

2013-08-10 Thread Chris Angelico
On Sun, Aug 11, 2013 at 3:19 AM, Devyn Collier Johnson wrote: > am checking my 1292-line script for syntax errors. I ran the following > commands in a terminal to check for errors, but I do not see the error. > > collier@Nacho-Laptop:/media/collier/AI/Pysh$ python3 -m py_compile > ./beta_engine >

Re: Am I not seeing the Error?

2013-08-10 Thread Roy Smith
In article , Chris Angelico wrote: > When you get a syntax error you can't understand, look at the previous > line of code. Perhaps something there is incomplete; maybe you have > mismatched parentheses, so this line is considered to be part of the > same expression. > > Next thing to do is spl

Re: Am I not seeing the Error?

2013-08-10 Thread Chris Angelico
On Sun, Aug 11, 2013 at 3:43 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> When you get a syntax error you can't understand, look at the previous >> line of code. Perhaps something there is incomplete; maybe you have >> mismatched parentheses, so this line is considered to be

Re: Am I not seeing the Error?

2013-08-10 Thread Terry Reedy
On 8/10/2013 10:19 PM, Devyn Collier Johnson wrote: I am checking my 1292-line script for syntax errors. I ran the following commands in a terminal to check for errors, but I do not see the error. collier@Nacho-Laptop:/media/collier/AI/Pysh$ python3 -m py_compile ./beta_engine File "./beta_en

Re: Python Basic Doubt

2013-08-10 Thread Krishnan Shankar
Thanks Tim, This takes me to one more question. 'is' operator is used to compare objects and it should not be used to compare data. So can it be compared with 'False'. i.e. Is this code possible if a is False: print 'Yes' if b is False: print 'No' Because i recommended this should not

Re: Python Basic Doubt

2013-08-10 Thread Chris Angelico
On Sun, Aug 11, 2013 at 4:09 AM, Krishnan Shankar wrote: > i.e. Is this code possible > > if a is False: > print 'Yes' > if b is False: > print 'No' You would use that if you want to check if a/b is the exact bool value False. Normally you would simply spell it thus: if not a: print

Re: Python Basic Doubt

2013-08-10 Thread Gary Herron
On 08/10/2013 08:09 PM, Krishnan Shankar wrote: Thanks Tim, This takes me to one more question. 'is' operator is used to compare objects and it should not be used to compare data. So can it be compared with 'False'. i.e. Is this code possible if a is False: print 'Yes' if b is False:

Re: Python Basic Doubt

2013-08-10 Thread Gary Herron
On 08/10/2013 06:00 PM, Chris Angelico wrote: On Sun, Aug 11, 2013 at 1:42 AM, Gary Herron wrote: On 08/10/2013 03:09 PM, Chris Angelico wrote: _notpassed = object() def frob(appendage, device=_notpassed): """Use some appendage to frob some device, or None to frob nothing. Omit dev

Re: Python Basic Doubt

2013-08-10 Thread Michael Torrie
On 08/10/2013 09:09 PM, Krishnan Shankar wrote: > i.e. Is this code possible > > if a is False: > print 'Yes' > if b is False: > print 'No' > > Because i recommended this should not be done. But my colleagues say it is > correct. You are probably correct in your believe that this idiom

Elegant compare

2013-08-10 Thread Jason Friedman
class my_class: def __init__(self, attr1, attr2): self.attr1 = attr1 #string self.attr2 = attr2 #string def __lt__(self, other): if self.attr1 < other.attr1: return True else: return self.attr2 < other.attr2 I will run into problems i

Re: Python Basic Doubt

2013-08-10 Thread Chris Angelico
On Sun, Aug 11, 2013 at 4:21 AM, Gary Herron wrote: > On 08/10/2013 06:00 PM, Chris Angelico wrote: >> Wrong. If you do equality comparisons, it's entirely possible for >> something to be passed in that compares equal to the RHS without >> actually being it, so "is" is precisely what's wanted. (Pl

Re: Elegant compare

2013-08-10 Thread Chris Angelico
On Sun, Aug 11, 2013 at 4:41 AM, Jason Friedman wrote: > class my_class: > def __init__(self, attr1, attr2): > self.attr1 = attr1 #string > self.attr2 = attr2 #string > def __lt__(self, other): > if self.attr1 < other.attr1: > return True > else:

Re: Python Basic Doubt

2013-08-10 Thread Joshua Landau
On 11 August 2013 04:43, Chris Angelico wrote: > On Sun, Aug 11, 2013 at 4:21 AM, Gary Herron > wrote: >> On 08/10/2013 06:00 PM, Chris Angelico wrote: >>> All it takes is a slightly odd or buggy __eq__ implementation and the >>> == versions will misbehave. To check if an argument is something, y

Re: Python Basic Doubt

2013-08-10 Thread Gary Herron
On 08/10/2013 08:43 PM, Chris Angelico wrote: On Sun, Aug 11, 2013 at 4:21 AM, Gary Herron wrote: On 08/10/2013 06:00 PM, Chris Angelico wrote: Wrong. If you do equality comparisons, it's entirely possible for something to be passed in that compares equal to the RHS without actually being it,

Re: Python Basic Doubt

2013-08-10 Thread Chris Angelico
On Sun, Aug 11, 2013 at 5:04 AM, Joshua Landau wrote: > On 11 August 2013 04:43, Chris Angelico wrote: >> The >> distinction between the two is important when the objects are mutable >> (so they have an identity that's distinct from their current values). > > I don't follow this argument. Tuples

Re: Python Basic Doubt

2013-08-10 Thread Chris Angelico
On Sun, Aug 11, 2013 at 5:29 AM, Gary Herron wrote: > A beginner, on his first program or two, can understand 1, and perhaps > parrot 2 without understanding (or needing to). But the step from there to > 3 is huge. It's folly to dump that on a first-time programmer. (It's > probably even folly

Re: Paramiko Help. Execute command to Interactive Shell which is opened by SSHClient()

2013-08-10 Thread sagar varule
On Thursday, August 8, 2013 12:50:25 PM UTC+5:30, sagar varule wrote: > Hi All, > > > > Im using Paramiko for my SSH automation. Im using method that is shown in > demo_simple.py example which comes with Paramiko. Below is code from > demo_simple.py. > > > > As you can make out, below code

Re: Paramiko Help. Execute command to Interactive Shell which is opened by SSHClient()

2013-08-10 Thread Joshua Landau
On 11 August 2013 06:18, sagar varule wrote: > Can any one comment on this.. If you don't get replies here it's probably because no-one knows Paramiko. I suggest posting elsewhere to see if there are any Paramiko users in other places willing to help. There might be a Paramiko mailing list. You

Could you verify this, Oh Great Unicode Experts of the Python-List?

2013-08-10 Thread Joshua Landau
Basically, I think Twitter's broken. For my full discusion on the matter, see: http://www.reddit.com/r/learnpython/comments/1k2yrn/help_with_len_and_input_function_33/cbku5e8 Here's the first post of mine, ineffectually edited for this list: """ The obvious solution [to getting the length of a t