Re: Everything is an object in python - object class and type class

2015-06-03 Thread BartC
On 03/06/2015 17:29, Mark Lawrence wrote: On 03/06/2015 17:00, BartC wrote: On 03/06/2015 13:08, Marko Rauhamaa wrote: BartC b...@freeuk.com: To 'variable' and 'type', you might need to add 'value' to make it more complete. 'Value' and 'object' are indeed synonymous as long as you keep in

Re: Keypress Input

2015-06-03 Thread Gary Herron
On 06/03/2015 11:22 AM, John McKenzie wrote: Hello. Very new to Python and looking for some basic help. Would like a set-up where something happens when a key is pressed. Not propose a question, have the user type something, then hit return, then something happens, but just the R key is

Re: Multiple thread program problem

2015-06-03 Thread MRAB
On 2015-06-03 21:41, Mohan Mohta wrote: Hello I am trying to create multiple thread through the below program but I am getting an error #! /usr/bin/python import os import subprocess import thread import threading from thread import start_new_thread def proc(f) : com1=ssh -B

Re: How to access the low digits of a list

2015-06-03 Thread Rustom Mody
On Tuesday, June 2, 2015 at 7:50:58 PM UTC+5:30, Ian wrote: On Tue, Jun 2, 2015 at 6:35 AM, Rustom Mody wrote: For that matter even this works But I am not sure whats happening or that I like it [x[-2:] for x in lines] ['12', '42', '49', '56', '25', '36', '49', '64', '81', '00']

Multiple thread program problem

2015-06-03 Thread Mohan Mohta
Hello I am trying to create multiple thread through the below program but I am getting an error #! /usr/bin/python import os import subprocess import thread import threading from thread import start_new_thread def proc(f) : com1=ssh -B com2=line.strip('\n') com3=

Re: Keypress Input

2015-06-03 Thread Laura Creighton
Tkinter runs on raspberry pi. Get it installed, and then run this program. from Tkinter import * root = Tk() prompt = 'Press any key. Remember to keep your mouse in the cyan box. ' lab = Label(root, text=prompt, width=len(prompt), bg='cyan') lab.pack() def key(event): msg = 'event.char is

[issue24376] xxlimited.c errors when building 32 and 64 bit on Windows

2015-06-03 Thread Mark Lawrence
Mark Lawrence added the comment: Thanks for the comment David. Last time I used any kind of change system in anger was Visual Source Safe 15 years ago, and VAX/VMS CMS/MMF(?) before that. Where do I start with Mercurial? I don't even know what the difference is between setting up the now

[issue24374] Plug refleak in set_coroutine_wrapper

2015-06-03 Thread Yury Selivanov
Changes by Yury Selivanov yseliva...@gmail.com: Added file: http://bugs.python.org/file39611/set_coro.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24374 ___

Re: Retrying to send message

2015-06-03 Thread Mark Lawrence
On 03/06/2015 19:28, Ethan Furman wrote: On 06/03/2015 09:15 AM, Cecil Westerhof wrote: I kept the except. I like to see the message that went wrong. ;-) That's fine, but then add a `raise` after you print the error so you can see the reason that message failed. -- ~Ethan~ Why bother in

[issue22931] cookies with square brackets in value

2015-06-03 Thread Tim Pierce
Changes by Tim Pierce twpie...@gmail.com: -- nosy: +Tim Pierce ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22931 ___ ___ Python-bugs-list

[issue24360] improve argparse.Namespace __repr__ for invalid identifiers.

2015-06-03 Thread paul j3
paul j3 added the comment: An alternative would be to wrap a non-identifier name in 'repr()': def repr1(self): def fmt_name(name): if name.isidentifier(): return name else: return repr(name) type_name =

Re: Keypress Input

2015-06-03 Thread Gary Herron
On 06/03/2015 11:22 AM, John McKenzie wrote: Hello. Very new to Python and looking for some basic help. Would like a set-up where something happens when a key is pressed. Not propose a question, have the user type something, then hit return, then something happens, but just the R key is

Re: fork/exec close file descriptors

2015-06-03 Thread random832
On Wed, Jun 3, 2015, at 10:43, Marko Rauhamaa wrote: However, the child process needs to be prepared for os.close() to block indefinitely because of an NFS problem or because SO_LINGER has been specified by the parent, for example. Setting the close-on-exec flag doesn't help there. Out of

Re: fork/exec close file descriptors

2015-06-03 Thread random832
On Wed, Jun 3, 2015, at 09:32, Chris Angelico wrote: Write an editor that opens a file and holds it open until the user's done with it. Have something that lets you shell out for whatever reason. Then trigger the shell-out, and instantly SIGSTOP the child process, before it does its work - or

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Mark Lawrence
On 03/06/2015 19:59, BartC wrote: Does anyone need to understand CPython for anything? No you (plural) don't. If people were to spend more time writing code and less time on hypothetical claptrap the amount of noise on this list would probably be reduced by 99%. Then knock out those

Re: Multiple thread program problem

2015-06-03 Thread Mohan Mohta
On Wednesday, June 3, 2015 at 4:01:13 PM UTC-5, Sam Raker wrote: proc(f) isn't a callable, it's whatever it returns. IIRC, you need to do something like 'start_new_thread(proc, (f,))' If I execute something like t=thread.start_new_thread(proc,(f)) I get: Traceback (most recent call last):

Re: How to access the low digits of a list

2015-06-03 Thread Ian Kelly
On Wed, Jun 3, 2015 at 3:08 PM, Rustom Mody rustompm...@gmail.com wrote: On Tuesday, June 2, 2015 at 7:50:58 PM UTC+5:30, Ian wrote: On Tue, Jun 2, 2015 at 6:35 AM, Rustom Mody wrote: For that matter even this works But I am not sure whats happening or that I like it [x[-2:] for x in

[issue24338] In argparse adding wrong arguments makes malformed namespace

2015-06-03 Thread paul j3
paul j3 added the comment: http://bugs.python.org/issue15125 argparse: positional arguments containing - in name not handled well Discussion on whether positionals 'dest' should translate '-' to '_'. -- ___ Python tracker rep...@bugs.python.org

Re: fork/exec close file descriptors

2015-06-03 Thread Marko Rauhamaa
random...@fastmail.us: On Wed, Jun 3, 2015, at 10:43, Marko Rauhamaa wrote: However, the child process needs to be prepared for os.close() to block indefinitely because of an NFS problem or because SO_LINGER has been specified by the parent, for example. Setting the close-on-exec flag

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-06-03 Thread Petr Viktorin
Petr Viktorin added the comment: I've posted a patch that fixes the remaining refleak in issue24373. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24268 ___

Re: Can Python function return multiple data?

2015-06-03 Thread sohcahtoa82
On Wednesday, June 3, 2015 at 2:57:00 PM UTC-7, Mark Lawrence wrote: On 03/06/2015 22:35, Chris Angelico wrote: On Wed, Jun 3, 2015 at 11:56 PM, Thomas Rachel nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa...@spamschutz.glglgl.de wrote: Am 03.06.2015 um 01:56 schrieb Chris Angelico: and

[issue24360] improve argparse.Namespace __repr__ for invalid identifiers.

2015-06-03 Thread Matthias Bussonnier
Matthias Bussonnier added the comment: Namespace(a=1, 'b=2), Namespace(c'=3) :-) I read that a `prime-b`=2 and `c-prime`=3. I just feel like having a repr which is closer to the constructor signature is better, but I guess it's a question of taste. Anyway, both would be fine. --

Re: Multiple thread program problem

2015-06-03 Thread Mohan Mohta
On Wednesday, June 3, 2015 at 5:34:31 PM UTC-5, Waffle wrote: You think (f) makes a tuple, but it does not. the parentesis is not the tuple constructor, the comma is try: t=thread.start_new_thread(proc,(f,)) Thanks for the pointer waffle. The program executes now but still not the way I want

Re: Everything is an object in python - object class and type class

2015-06-03 Thread BartC
On 03/06/2015 21:58, Mark Lawrence wrote: On 03/06/2015 19:59, BartC wrote: Does anyone need to understand CPython for anything? No you (plural) don't. If people were to spend more time writing code and less time on hypothetical claptrap the amount of noise on this list would probably be

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Mark Lawrence
On 03/06/2015 22:33, BartC wrote: On 03/06/2015 21:58, Mark Lawrence wrote: Not so hypothetical in my case as I have to implement a lot of this stuff. I'm also quite interested in how Python does things. If it's a good idea I'll copy it, if not I'll try and avoid it! Which implementation,

Re: Can Python function return multiple data?

2015-06-03 Thread Mark Lawrence
On 03/06/2015 22:35, Chris Angelico wrote: On Wed, Jun 3, 2015 at 11:56 PM, Thomas Rachel nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa...@spamschutz.glglgl.de wrote: Am 03.06.2015 um 01:56 schrieb Chris Angelico: and it's pretty convenient. In C, the nearest equivalent is passing a number of

Re: Multiple thread program problem

2015-06-03 Thread Joonas Liik
You think (f) makes a tuple, but it does not. the parentesis is not the tuple constructor, the comma is try: t=thread.start_new_thread(proc,(f,)) -- https://mail.python.org/mailman/listinfo/python-list

Re: How to access the low digits of a list

2015-06-03 Thread Mark Lawrence
On 03/06/2015 22:08, Rustom Mody wrote: On Tuesday, June 2, 2015 at 7:50:58 PM UTC+5:30, Ian wrote: On Tue, Jun 2, 2015 at 6:35 AM, Rustom Mody wrote: For that matter even this works But I am not sure whats happening or that I like it [x[-2:] for x in lines] ['12', '42', '49', '56', '25',

Re: Everything is an object in python - object class and type class

2015-06-03 Thread BartC
On 03/06/2015 22:49, Mark Lawrence wrote: On 03/06/2015 22:33, BartC wrote: On 03/06/2015 21:58, Mark Lawrence wrote: Not so hypothetical in my case as I have to implement a lot of this stuff. I'm also quite interested in how Python does things. If it's a good idea I'll copy it, if not I'll

Re: Multiple thread program problem

2015-06-03 Thread sohcahtoa82
On Wednesday, June 3, 2015 at 4:45:52 PM UTC-7, M2 wrote: On Wednesday, June 3, 2015 at 5:34:31 PM UTC-5, Waffle wrote: You think (f) makes a tuple, but it does not. the parentesis is not the tuple constructor, the comma is try: t=thread.start_new_thread(proc,(f,)) Thanks for the

Re: Let's make Python into LISP

2015-06-03 Thread Rustom Mody
On Wednesday, June 3, 2015 at 4:27:39 AM UTC+5:30, Dr. Bigcock wrote: We can make Python like LISP: 1. Make EVERYTHING the same kind of thing (call it object). 2. Let's make a lot of meta functions like super, instead of judicious use of interpreter impositions. 3. Forget *practicality*.

Re: Can Python function return multiple data?

2015-06-03 Thread Chris Angelico
On Wed, Jun 3, 2015 at 11:56 PM, Thomas Rachel nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa...@spamschutz.glglgl.de wrote: Am 03.06.2015 um 01:56 schrieb Chris Angelico: and it's pretty convenient. In C, the nearest equivalent is passing a number of pointers as parameters, and having the

Re: Retrying to send message

2015-06-03 Thread Chris Angelico
On Thu, Jun 4, 2015 at 2:15 AM, Cecil Westerhof ce...@decebal.nl wrote: And I'd also skip the bare except clause. If you get any sort of exception, whether it's a bug, a failure from libturpial, a network error, or anything else, your code will just terminate with a bland and useless message.

Re: fork/exec close file descriptors

2015-06-03 Thread Chris Angelico
On Thu, Jun 4, 2015 at 6:07 AM, random...@fastmail.us wrote: On Wed, Jun 3, 2015, at 09:32, Chris Angelico wrote: Write an editor that opens a file and holds it open until the user's done with it. Have something that lets you shell out for whatever reason. Then trigger the shell-out, and

Re: Multiple thread program problem

2015-06-03 Thread M2
On Wednesday, June 3, 2015 at 6:56:47 PM UTC-5, sohca...@gmail.com wrote: On Wednesday, June 3, 2015 at 4:45:52 PM UTC-7, M2 wrote: On Wednesday, June 3, 2015 at 5:34:31 PM UTC-5, Waffle wrote: You think (f) makes a tuple, but it does not. the parentesis is not the tuple constructor, the

[issue24294] DeprecationWarnings should be visible by default in the interactive REPL

2015-06-03 Thread Matthias Bussonnier
Matthias Bussonnier added the comment: I gave that a shot. Doing it cleanly in C as the warning module is initialized much earlier. Though I'm not super used to CPython internals. Doing just before the repl by using `PyRun_SimpleString` make the patch relatively small. -- keywords:

Re: Multiple thread program problem

2015-06-03 Thread Cameron Simpson
On 03Jun2015 17:04, M2 mohan.mo...@gmail.com wrote: On Wednesday, June 3, 2015 at 6:56:47 PM UTC-5, sohca...@gmail.com wrote: On Wednesday, June 3, 2015 at 4:45:52 PM UTC-7, M2 wrote: On Wednesday, June 3, 2015 at 5:34:31 PM UTC-5, Waffle wrote: You think (f) makes a tuple, but it does not.

Re: Let's make Python into LISP

2015-06-03 Thread Mark Lawrence
On 03/06/2015 22:22, Rustom Mody wrote: On Wednesday, June 3, 2015 at 4:27:39 AM UTC+5:30, Dr. Bigcock wrote: We can make Python like LISP: 1. Make EVERYTHING the same kind of thing (call it object). 2. Let's make a lot of meta functions like super, instead of judicious use of interpreter

[issue24338] In argparse adding wrong arguments makes malformed namespace

2015-06-03 Thread py.user
py.user added the comment: paul j3 wrote: It's an attempt to turn such flags into valid variable names. I'm looking at code and see that he wanted to make it handy for use in a resulting Namespace. args = argparse.parse_args(['--a-b-c']) abc = args.a_b_c If he doesn't convert, he cannot get

Re: Retrying to send message

2015-06-03 Thread Ethan Furman
On 06/03/2015 01:37 PM, Mark Lawrence wrote: On 03/06/2015 19:28, Ethan Furman wrote: On 06/03/2015 09:15 AM, Cecil Westerhof wrote: I kept the except. I like to see the message that went wrong. ;-) That's fine, but then add a `raise` after you print the error so you can see the reason that

[issue24338] In argparse adding wrong arguments makes malformed namespace

2015-06-03 Thread paul j3
paul j3 added the comment: Yes, the '_' makes it accessible as an attribute name. But the presence of '-' in the option name has a UNIX history. That is a flag like '--a-b-c' is typical, '--a_b_c' is not. There is less of precedent for a flag like '@@a@b' or '--a@b'. Here's the relevant

[issue20186] Derby #18: Convert 31 sites to Argument Clinic across 23 files

2015-06-03 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- stage: needs patch - patch review versions: +Python 3.6 -Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20186 ___

[issue20186] Derby #18: Convert 31 sites to Argument Clinic across 23 files

2015-06-03 Thread Tal Einat
Tal Einat added the comment: Should Argument Clinic conversion patches still be against the 'default' branch, and not 3.5, even though they don't include any functionality changes? -- ___ Python tracker rep...@bugs.python.org

[issue18003] lzma module very slow with line-oriented reading.

2015-06-03 Thread Martin Panter
Martin Panter added the comment: Looking at https://bugs.python.org/file39586/decomp-optim.patch, the “closed” property is the first of the three hunks: 1. Adds @property / def closed(self) to Lib/_compression.py 2. Adds def __iter__(self) to Lib/gzip.py 3. Adds def __iter__(self) to

[issue18003] lzma module very slow with line-oriented reading.

2015-06-03 Thread Martin Panter
Martin Panter added the comment: New patch just fixes the spelling error in the comment. -- stage: needs patch - patch review Added file: http://bugs.python.org/file39604/decomp-optim.v2.patch ___ Python tracker rep...@bugs.python.org

[issue18003] lzma module very slow with line-oriented reading.

2015-06-03 Thread Larry Hastings
Larry Hastings added the comment: I don't see anything about closed in the patch you posted. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18003 ___

Re: Everything is an object in python - object class and type class

2015-06-03 Thread BartC
On 03/06/2015 05:16, Eddilbert Macharia wrote: On Tuesday, June 2, 2015 at 2:27:31 PM UTC+3, Steven D'Aprano wrote: Eddilbert, have you programmed in any other languages? It would help you understand if you have. Sadly yes i have worked with java, and that is what is causing me so much

Re: Everything is an object in python - object class and type class

2015-06-03 Thread BartC
On 03/06/2015 11:38, Chris Angelico wrote: On Wed, Jun 3, 2015 at 8:20 PM, BartC b...@freeuk.com wrote: I have a lot of trouble with this stuff too, as my ideas are decidedly old-fashioned. (Also I'm developing a language with some OO aspects without ever having used OO!) But, it is mostly

Re: Everything is an object in python - object class and type class

2015-06-03 Thread BartC
On 03/06/2015 11:20, BartC wrote: 'genfield' is a field (attribute) that can't be resolved, but the possibilities have been reduced to a small, finite set which is resolved at load-time (in Python, the attribute could be anything, and you don't even know at runtime what it might be until you

[issue18003] lzma module very slow with line-oriented reading.

2015-06-03 Thread Antoine Pitrou
Antoine Pitrou added the comment: Yes, this is right. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18003 ___ ___ Python-bugs-list mailing list

[issue24363] httplib fails to handle semivalid HTTP headers

2015-06-03 Thread Cory Benfield
Cory Benfield added the comment: It is obvious that this case could be treated as a folded (continuation) line. But in general I think it would be better to ignore the erroneous line, or to record it as a defect so that the server module or other user can check it. Just to clarify, in an

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Steven D'Aprano
On Wednesday 03 June 2015 05:31, Jon Ribbens wrote: On 2015-06-02, Dr. Bigcock dreamingforw...@gmail.com wrote: On Tuesday, June 2, 2015 at 1:49:03 PM UTC-5, Jon Ribbens wrote: On 2015-06-02, Dr. Bigcock dreamingforw...@gmail.com wrote: It doesn't really do anything. No one uses integers as

What sort of data structure to use?

2015-06-03 Thread David Aldrich
Hi I have written a Python utility that performs a certain activity on some predefined sets of files. Here is the outline of what I have written: # File Set A pathA = 'pathA' fileListA = ['fileA1.txt', 'fileA2.txt'] # File Set B pathB = 'pathB' fileListB = ['fileB1.txt', 'fileB2.txt',

[issue18003] lzma module very slow with line-oriented reading.

2015-06-03 Thread Martin Panter
Martin Panter added the comment: Yes that’s basically right Larry. The __iter__() was previously inherited; now I am overriding it with a custom version. Similarly for the “closed” property, but that one is only a member of objects internal to the gzip, lzma and bz2 modules. --

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Chris Angelico
On Wed, Jun 3, 2015 at 8:20 PM, BartC b...@freeuk.com wrote: I have a lot of trouble with this stuff too, as my ideas are decidedly old-fashioned. (Also I'm developing a language with some OO aspects without ever having used OO!) But, it is mostly just jargon. If you go back to using

Re: What sort of data structure to use?

2015-06-03 Thread Peter Otten
David Aldrich wrote: Hi I have written a Python utility that performs a certain activity on some predefined sets of files. Here is the outline of what I have written: # File Set A pathA = 'pathA' fileListA = ['fileA1.txt', 'fileA2.txt'] # File Set B pathB = 'pathB' fileListB =

Re: fork/exec close file descriptors

2015-06-03 Thread Alain Ketterlin
Chris Angelico ros...@gmail.com writes: On Wed, Jun 3, 2015 at 7:06 AM, Alain Ketterlin al...@universite-de-strasbourg.fr.invalid wrote: I've no idea what the OP's program was doing, so I'm not going to split hairs. I can't imagine why one would like to mass-close an arbitrary set of file

Re: fork/exec close file descriptors

2015-06-03 Thread Marko Rauhamaa
Alain Ketterlin al...@universite-de-strasbourg.fr.invalid: Marko Rauhamaa ma...@pacujo.net writes: Maybe close() will fail for ever. Your program has to deal with this, something is going wrong, it can't just close and go on. Here's the deal: the child process is saddled with file

Calling Python Script from an SQL Proceudre

2015-06-03 Thread Amit Goutham
Hi All, I am trying to search on the Internet if i can call a Python Script from an SQL Procedure. All the information found on Internet is about connecting to a database from Python through a Python script.But, i want the other way round. Any Help will be appreciated -- Thanks and Regards,

[issue24270] PEP 485 (math.isclose) implementation

2015-06-03 Thread Tal Einat
Tal Einat added the comment: Indeed, it should be. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24270 ___ ___ Python-bugs-list mailing list

Re: Issuing commands using exec_command() of paramiko AND also sending commands together

2015-06-03 Thread Sreenathan Nair
Hi, Could you be more specific about your problem? Perhaps an example of something similar to what you're trying to do would be helpful. Usually the process is to instantiate paramiko.SSHCLIENT, use the connect() method with desired parameters and execute commands using the exec_command(). If

[issue24371] configparser hate dot in option like eth2.6

2015-06-03 Thread Yavuz Selim Komur
New submission from Yavuz Selim Komur: [remember] eth2.6 = True eth5 = True eth5 correct but eth2.6 return exception -- components: Extension Modules, Library (Lib) messages: 244730 nosy: Yavuz Selim Komur priority: normal severity: normal status: open title: configparser hate dot in

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Steven D'Aprano
On Wednesday 03 June 2015 03:59, BartC wrote: Javascript primitives include Number and String. What does Python allow to be done with its Number (int, etc) and String types that can't be done with their Javascript counterparts, that makes /them/ objects? That's a good question, and I'm not

[issue20186] Derby #18: Convert 31 sites to Argument Clinic across 23 files

2015-06-03 Thread Tal Einat
Tal Einat added the comment: Attached is an updated patch for Modules/mathmodule.c. This is based on Georg's patch, updated to apply to current 3.5, with several improvements: * replaced legacy converters * converted math.ceil() and math.floor() functions * converted the new math.gcd() and

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Steven D'Aprano
On Wednesday 03 June 2015 08:33, Marko Rauhamaa wrote: Grant Edwards invalid@invalid.invalid: On 2015-06-02, Ian Kelly ian.g.ke...@gmail.com wrote: Accepting for the sake of argument that something to be subclassed is a reasonable definition of object, Huh? You can't subclass an object.

Re: What sort of data structure to use?

2015-06-03 Thread Cameron Simpson
On 03Jun2015 08:19, David Aldrich david.aldr...@emea.nec.com wrote: I have written a Python utility that performs a certain activity on some predefined sets of files. Here is the outline of what I have written: # File Set A pathA = 'pathA' fileListA = ['fileA1.txt', 'fileA2.txt'] # File Set

Re: What sort of data structure to use?

2015-06-03 Thread David Palao
2015-06-03 10:19 GMT+02:00 David Aldrich david.aldr...@emea.nec.com: Hi I have written a Python utility that performs a certain activity on some predefined sets of files. Here is the outline of what I have written: # File Set A pathA = ‘pathA’ fileListA = [‘fileA1.txt’,

Re: Please help on this sorted function

2015-06-03 Thread Gary Herron
On 06/02/2015 01:20 PM, fl wrote: Hi, I try to learn sorted(). With the tutorial example: ff=sorted({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'}) ff [1, 2, 3, 4, 5] I don't see what sorted does in this dictionary, i.e. the sequence of 1..5 is unchanged. Could you explain it to me?

Re: should self be changed?

2015-06-03 Thread Steven D'Aprano
On Wednesday 03 June 2015 03:19, Marko Rauhamaa wrote: Steven D'Aprano st...@pearwood.info: On Fri, 29 May 2015 12:00 pm, Steven D'Aprano wrote: [...] in a language where classes are themselves values, there is no reason why a class must be instantiated, particularly if you're only using

[issue24270] PEP 485 (math.isclose) implementation

2015-06-03 Thread Berker Peksag
Changes by Berker Peksag berker.pek...@gmail.com: -- resolution: - fixed stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24270 ___

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Steven D'Aprano
On Wednesday 03 June 2015 08:49, Dr. Bigcock wrote: You need classes for objects. Anything else, and you're confusing yourself. Not quite. https://en.wikipedia.org/wiki/Prototype-based_programming -- Steve -- https://mail.python.org/mailman/listinfo/python-list

Re: fork/exec close file descriptors

2015-06-03 Thread alister
On Wed, 03 Jun 2015 10:41:44 +0300, Marko Rauhamaa wrote: Alain Ketterlin al...@universite-de-strasbourg.fr.invalid: Marko Rauhamaa ma...@pacujo.net writes: Maybe close() will fail for ever. Your program has to deal with this, something is going wrong, it can't just close and go on.

Re: What sort of data structure to use?

2015-06-03 Thread David Palao
2015-06-03 10:19 GMT+02:00 David Aldrich david.aldr...@emea.nec.com: Hi I have written a Python utility that performs a certain activity on some predefined sets of files. Here is the outline of what I have written: # File Set A pathA = ‘pathA’ fileListA = [‘fileA1.txt’,

Re: fork/exec close file descriptors

2015-06-03 Thread Alain Ketterlin
Marko Rauhamaa ma...@pacujo.net writes: Alain Ketterlin al...@universite-de-strasbourg.fr.invalid: Marko Rauhamaa ma...@pacujo.net writes: First, if close() fails, what's a poor program to do? Warn the user? Not assume everything went well? It all depends on the application, and what the

Re: Please help on this sorted function

2015-06-03 Thread Steven D'Aprano
On Wednesday 03 June 2015 06:42, Joonas Liik wrote: my_dict = {1: 'D', 2: 'B', 3: 'A', 4: 'E', 5: 'B'} # dict.items() returns an iterator that returns pairs of (key, value) # pairs the key argument to sorted tells sorted what to sort by, operator.itemgetter is a factory function ,

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Marko Rauhamaa
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info: On Wednesday 03 June 2015 08:33, Marko Rauhamaa wrote: In Python, classes are little more than constructor functions. [...] Classes give you an inheritance hierarchy. That's encapsulated in the constructor. From the class user's point

[issue24363] httplib fails to handle semivalid HTTP headers

2015-06-03 Thread Cory Benfield
Cory Benfield added the comment: While we're here and I'm recommending to drop as little data as possible: we need to be really careful about not exposing ourselves to any kind of data smuggling attack here. It's really important that we don't let attackers construct bodies of requests or

Re: Calling Python Script from an SQL Proceudre

2015-06-03 Thread Kushal Kumaran
Amit Goutham agn.91...@gmail.com writes: Hi All, I am trying to search on the Internet if i can call a Python Script from an SQL Procedure. All the information found on Internet is about connecting to a database from Python through a Python script.But, i want the other way round. Any Help

[issue20186] Derby #18: Convert 31 sites to Argument Clinic across 23 files

2015-06-03 Thread Tal Einat
Tal Einat added the comment: Attached is an AC conversion patch for Objects/enumobject.c. Note that this file contains the implementations of the 'enumerate' and 'reversed' classes, but *not* the 'Enum' class. This is based on the 3.5 branch. -- Added file:

[issue24372] Documentation for ssl.wrap_socket's ssl_version parameter is odd

2015-06-03 Thread Christian Heimes
Christian Heimes added the comment: I'd like to deprecate ssl.wrap_socket() in favor of SSLContext.wrap_socket(). Libraries should rather accept a context than expose the awkward interface of ssl.wrap_socket(). A context object is far more powerful and easier to use. --

Re: python 3.4 use python-gcm can't import

2015-06-03 Thread dav . kuhn
Le vendredi 29 août 2014 10:35:29 UTC+2, Frank Liou a écrit : and body is b' .is empty i'm so confused.don't know it work or not Hi, you should read() before you close() the connection. conn = http.client.HTTPConnection('android.googleapis.com') conn.request('POST', '/gcm/send', jqs,

[issue24363] httplib fails to handle semivalid HTTP headers

2015-06-03 Thread Michael Del Monte
Michael Del Monte added the comment: Given that obs-fold is technically valid, then can I recommend reading the entire header first (reading to the first blank line) and then tokenizing the individual headers using a regular expression rather than line by line? That would solve the problem

[issue24372] Documentation for ssl.wrap_socket's ssl_version parameter is odd

2015-06-03 Thread Christian Heimes
Changes by Christian Heimes li...@cheimes.de: -- nosy: +christian.heimes ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24372 ___ ___

[issue23237] Interrupts are lost during readline PyOS_InputHook processing (reopening)

2015-06-03 Thread Michiel de Hoon
Michiel de Hoon added the comment: I am uploading an updated version of the patch. I'd be happy to submit a patch to the documentation also, but wasn't able to find it on Mercurial. Can somebody please point me to the right repository for the documentation? -- Added file:

Re: fork/exec close file descriptors

2015-06-03 Thread Marko Rauhamaa
Marko Rauhamaa ma...@pacujo.net: So the strategy you proposed is the right one: have the child process ignore any possible errors from os.close(). The parent will have an opportunity to deal with them. And now Linux is back in the good graces, only the man page is misleading. However, the

Re: Can Python function return multiple data?

2015-06-03 Thread Thomas Rachel
Am 03.06.2015 um 01:56 schrieb Chris Angelico: and it's pretty convenient. In C, the nearest equivalent is passing a number of pointers as parameters, and having the function fill out values. Python's model is a lot closer to what you're saying than C's model is :) At least, C functions can

[ANN] Mayavi-4.4.1 release

2015-06-03 Thread Prabhu Ramachandran
Hello, Enthought is pleased to announce Mayavi-4.4.1. Mayavi is a general purpose, cross-platform Python package for 2-D and 3-D scientific data visualization. Mayavi integrates seamlessly with numpy and provides a convenient Pythonic wrapper for the VTK API. It provides a high-level

Re: for...else

2015-06-03 Thread Rustom Mody
On Tuesday, June 2, 2015 at 4:56:57 PM UTC+5:30, acdr wrote: Hi, Currently, in various places in my code, I have the equivalent of: for x in it: if complicated_calculation_1(): cleanup() break complicated_calculation_2() if complicated_calculation_3():

[issue24375] Performance regression relative to 2.7

2015-06-03 Thread Yury Selivanov
New submission from Yury Selivanov: Attached (t.py) is a random script that I stumbled upon pretty randomly on the internet -- someone used it to test different languages VMs performance. The interesting thing is that 2.7 runs it 20-30% faster than 3.4 3.5 consistently. The script does not

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Ian Kelly
On Wed, Jun 3, 2015 at 2:57 AM, Marko Rauhamaa ma...@pacujo.net wrote: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info: On Wednesday 03 June 2015 08:33, Marko Rauhamaa wrote: In Python, classes are little more than constructor functions. [...] Classes give you an inheritance

[issue24362] Simplify the fast nodes resize logic in C OrderedDict.

2015-06-03 Thread Stefan Krah
Stefan Krah added the comment: I think this is much nicer, thank you! And the XXX comment looks right, updating od_size could be moved down. I suspect that updating it too early was the cause for #24361, which is also solved by this patch. -- ___

[issue24372] Documentation for ssl.wrap_socket's ssl_version parameter is odd

2015-06-03 Thread Eric V. Smith
Eric V. Smith added the comment: I have a requirement to support 2.7.5, so SSLContext is currently a problem for me. I realize that 2.7 could at best get a documentation change. -- ___ Python tracker rep...@bugs.python.org

[issue24374] Plug refleak in set_coroutine_wrapper

2015-06-03 Thread Yury Selivanov
Changes by Yury Selivanov yseliva...@gmail.com: -- nosy: +gvanrossum, haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24374 ___ ___

[issue24363] httplib fails to handle semivalid HTTP headers

2015-06-03 Thread Michael Del Monte
Michael Del Monte added the comment: ... or perhaps if ':' in line and line[0] != ':': to avoid the colon-as-first-char bug that plagued this library earlier, though the only ill-effect of leaving it alone would be a header with a blank key; not the end of the world. --

Re: fork/exec close file descriptors

2015-06-03 Thread Marko Rauhamaa
alister alister.nospam.w...@ntlworld.com: I meant the program that is supplying your app with file handles willy- nilly without caring what happens to them You seem to be advocating a strategy whereby the application keeps close track of all file descriptors and closes them individually as

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Marko Rauhamaa
BartC b...@freeuk.com: To 'variable' and 'type', you might need to add 'value' to make it more complete. 'Value' and 'object' are indeed synonymous as long as you keep in mind that: -12 == -12 True -12 is -12 False IOW, the literal expression -12 happens to construct a

Re: fork/exec close file descriptors

2015-06-03 Thread Steven D'Aprano
On Wed, 3 Jun 2015 07:38 pm, alister wrote: On Wed, 03 Jun 2015 10:41:44 +0300, Marko Rauhamaa wrote: [...] Here's the deal: the child process is saddled with file descriptors it never wanted in the first place. It can't decline them. Now you're saying it can't even dispose of them. No You

RE: What sort of data structure to use?

2015-06-03 Thread David Aldrich
Thanks very much for all the answers given to my question. They help me to think about the problem pythonically. Best regards David -Original Message- From: Python-list [mailto:python-list- bounces+david.aldrich=emea.nec@python.org] On Behalf Of Peter Otten Sent: 03 June 2015

Re: Everything is an object in python - object class and type class

2015-06-03 Thread Marco Buttu
On 03/06/2015 13:08, BartC wrote: Come on, we're trying to keep this simple. If we really want to keep it simple, we can take this starting point: http://en.wikipedia.org/wiki/Object_(computer_science) If we agree with the Wikipedia definition: ``In the class-based object-oriented

Re: fork/exec close file descriptors

2015-06-03 Thread Marko Rauhamaa
random...@fastmail.us: Why does the child process need to report the error at all? The parent process will find out naturally when *it* tries to close the same file descriptor. That's not how it goes. File descriptors are reference counted in the Linux kernel. Closes are no-ops except for

  1   2   >