Re: Can global variable be passed into Python function?
# a swapping variant def swap(a, b): ... ab = [a, b] ... ab[1], ab[0] = ab[0], ab[1] ... return ab[0], ab[1] ... a = 111 id(a) 505627864 b = 999 id(b) 58278640 a, b = swap(a, b) a, id(a) (999, 58278640) b, id(b) (111, 505627864) jmf -- https://mail.python.org/mailman/listinfo/python-list
Re: Can global variable be passed into Python function?
On Sat, Feb 22, 2014 at 7:02 PM, wxjmfa...@gmail.com wrote: # a swapping variant def swap(a, b): ... ab = [a, b] ... ab[1], ab[0] = ab[0], ab[1] ... return ab[0], ab[1] Provably identical to: def swap(a, b): return b, a The rest is just fluff. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Can global variable be passed into Python function?
Le samedi 22 février 2014 09:10:02 UTC+1, Chris Angelico a écrit : On Sat, Feb 22, 2014 at 7:02 PM, wxjmfa...@gmail.com wrote: # a swapping variant def swap(a, b): ... ab = [a, b] ... ab[1], ab[0] = ab[0], ab[1] ... return ab[0], ab[1] Provably identical to: def swap(a, b): return b, a The rest is just fluff. ChrisA Right. My bad, (just wake up). jmf -- https://mail.python.org/mailman/listinfo/python-list
Re: Can global variable be passed into Python function?
On Sat, 22 Feb 2014 19:10:02 +1100, Chris Angelico wrote: On Sat, Feb 22, 2014 at 7:02 PM, wxjmfa...@gmail.com wrote: # a swapping variant def swap(a, b): ... ab = [a, b] ... ab[1], ab[0] = ab[0], ab[1] ... return ab[0], ab[1] Provably identical to: def swap(a, b): return b, a The rest is just fluff. You don't even need the function call. a, b = b, a -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Can global variable be passed into Python function?
On Sat, 22 Feb 2014 18:29:02 +1100, Chris Angelico wrote: On Sat, Feb 22, 2014 at 6:18 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Now I daresay that under the hood, Pascal is passing the address of foo (or bar) to the procedure plus, but inside plus you don't see that address as the value of b. You see the value of foo (or bar). C does not do that -- you have to manually manage the pointers yourself, while Pascal does it for you. And Python also has nothing like that. Yep. I should have clarified that I wasn't talking about Pascal; I'm not fluent in the language (last time I did anything at all with Pascal was probably about ten years ago, and not much then). In C, it strictly does what I said: takes the address of something, * dereferences an address. There's no way to pass a variable - you have to pass the address, and that has consequences if, for instance, you *return* an address and the variable ceases to exist. (Does Pascal have an equivalent of that?) Yes, Pascal has pointers as a first-class data type. Syntax is similar to C, ^x is a pointer to x, p^ dereferences the pointer p. And Python has no such concept, anywhere. But anything that you can achieve in C using pointers, you can probably achieve in Python using more complex objects. Not even that complex. Although Python doesn't do pointers, the model of the language is such that you don't need to. Where in C or Pascal you would pass a pointer to a record, in Python you just pass the record, safe in the knowledge that the entire record won't be copied. There are a few idioms which don't work as neatly in Python as in Pascal, such as output parameter, but you don't need them. Just return a tuple. If you insist on an output parameter, do it like this: def func(inarg, outarg): if inarg % 2: outarg[0] == even else: outarg[0] == odd return inarg + 1 out = [None] x = 42 result = func(x, out) print(out[0]) -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Can global variable be passed into Python function?
On Sat, Feb 22, 2014 at 7:35 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Yep. I should have clarified that I wasn't talking about Pascal; I'm not fluent in the language (last time I did anything at all with Pascal was probably about ten years ago, and not much then). In C, it strictly does what I said: takes the address of something, * dereferences an address. There's no way to pass a variable - you have to pass the address, and that has consequences if, for instance, you *return* an address and the variable ceases to exist. (Does Pascal have an equivalent of that?) Yes, Pascal has pointers as a first-class data type. Syntax is similar to C, ^x is a pointer to x, p^ dereferences the pointer p. Right, I remember those now. Yes. (See how rusty I am on it? Heh.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Can global variable be passed into Python function?
On Sat, 22 Feb 2014 09:28:10 +0200, Marko Rauhamaa wrote: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info: But your code doesn't succeed at doing what it sets out to do. If you try to call it like this: py x = 23 py y = 42 py swap(x, y) Traceback (most recent call last): File stdin, line 1, in module File stdin, line 2, in swap AttributeError: 'int' object has no attribute 'get' not only doesn't it swap the two variables, but it raises an exception. Far from being a universal swap, it's merely an obfuscated function to swap a few hard-coded local variables. You are calling the function wrong. Imagine the function in C. There, you'd have to do this: [...] Sorry, I misunderstood you. When you called it a universal swap function, I thought you meant a universal swap function. I didn't realise you intended it as a demonstration of how to emulate a C idiom using overly- complicated Python code *wink* If you want to emulate pointers in Python, the simplest way is to use lists as pseudo-pointers. # think of ptr[0] as pointer dereferencing # think of [value] as quasi address of operator def swap(p, q): p[0], q[0] = q[0], p[0] x = [anything] y = [something] z = [23] swap(x, y) swap(x, z) print(x[0], y[0], z[0]) = prints 23 anything something But why bother to write C in Python? Python makes a really bad C, and C makes a really bad Python. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Can global variable be passed into Python function?
On Sat, Feb 22, 2014 at 7:45 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: But why bother to write C in Python? Python makes a really bad C, and C makes a really bad Python. +1. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
argparse question
I have been reading the argparse section of the 3.3 docs, and running all the example code. But in section 16.4.2.6. for the formatter_class, the second example in that section illustrating RawDescriptionHelpFormatter, the example code is: parser = argparse.ArgumentParser( prog='PROG', formatter_class=argparse.RawDescriptionHelpFormatter, description=textwrap.dedent('''\ Please do not mess up this text! I have indented it exactly the way I want it ''')) parser.print_help() But trying to run this gives a NameError on the description= line, saying textwrap is not defined. If I delete the textwrap.dedent (with or without also deleting the extra parentheses) it will then run, but without the un-indenting it is trying to illustrate. What is the proper way to enable the dedent() method here? All the other examples have run correctly (that is, the one's I've tried -- I'm still reading). Also, it should be obvious that while the import argparse line is not shown in the examples, it IS in the code samples I've been running. Using 3.3 under Linux (Mint 15). -=- Larry -=- -- https://mail.python.org/mailman/listinfo/python-list
Python stdlib code that looks odd
I'm poking around in the stdlib, and Lib/mailbox.py has the following inside class Mailbox: def update(self, arg=None): Change the messages that correspond to certain keys. if hasattr(arg, 'iteritems'): source = arg.items() elif hasattr(arg, 'items'): source = arg.items() else: source = arg bad_key = False for key, message in source: ... use key/message ... Looks odd to check if it has iteritems and then use items. Presumably this will catch a Python 2 dictionary, and take its items as a list rather than an iterator; but since the only thing it does with source is iterate over it, would it be better done as iteritems? Mainly, it just looks really weird to check for one thing and then call on another, especially as it then checks for the other thing in the next line. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: What are the kinds of software that are not advisable to be developed using Python?
Chris Angelico wrote: Heavy computation might be unideal in Python, but if you can grunge it into NumPy operations, that won't be a problem. May take a look to Pythran too, which generate C++ code from (limited subset of) Python code, usable as a Python compiled module or as standalone C++. https://github.com/serge-sans-paille/pythran A+ Laurent. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python stdlib code that looks odd
Chris Angelico wrote: I'm poking around in the stdlib, and Lib/mailbox.py has the following inside class Mailbox: def update(self, arg=None): Change the messages that correspond to certain keys. if hasattr(arg, 'iteritems'): source = arg.items() elif hasattr(arg, 'items'): source = arg.items() else: source = arg bad_key = False for key, message in source: ... use key/message ... Looks odd to check if it has iteritems and then use items. Presumably this will catch a Python 2 dictionary, and take its items as a list rather than an iterator; but since the only thing it does with source is iterate over it, would it be better done as iteritems? Remember that you are looking at Python 3 code here where items() is the new iteritems(). Mainly, it just looks really weird to check for one thing and then call on another, especially as it then checks for the other thing in the next line. Someone mechanically removed occurences of iteritems() from the code and ended up being either too aggressive as the Mailbox class still has an iteritems() method, so mb1.update(mb2) could avoid building a list, or too conservative as Mailbox.iterXXX could be removed, and .XXX() turned into a view following the example of the dict class. If nobody has complained until now (you get an error only for objects with an iteritems() but without an items() method, and those should be rare to non-existent) I think the path to progress is to remove the first alternative completely. def update(self, arg=None): Change the messages that correspond to certain keys. if hasattr(arg, 'items'): source = arg.items() else: source = arg bad_key = False ... Please file a bug report. -- https://mail.python.org/mailman/listinfo/python-list
Re: argparse question
Larry Hudson wrote: I have been reading the argparse section of the 3.3 docs, and running all the example code. But in section 16.4.2.6. for the formatter_class, the second example in that section illustrating RawDescriptionHelpFormatter, the example code is: parser = argparse.ArgumentParser( prog='PROG', formatter_class=argparse.RawDescriptionHelpFormatter, description=textwrap.dedent('''\ Please do not mess up this text! I have indented it exactly the way I want it ''')) parser.print_help() But trying to run this gives a NameError on the description= line, saying textwrap is not defined. If I delete the textwrap.dedent (with or without also deleting the extra parentheses) it will then run, but without the un-indenting it is trying to illustrate. What is the proper way to enable the dedent() method here? textwrap is a module like argparse, and the example doesn't show import argparse either. Insert import textwrap at the beginning of your module and the code should run without error. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python stdlib code that looks odd
On Sat, Feb 22, 2014 at 10:54 PM, Peter Otten __pete...@web.de wrote: Please file a bug report. http://bugs.python.org/issue20729 created. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Can global variable be passed into Python function?
On 22/02/2014 02:47, Dennis Lee Bieber wrote: BASIC, C, FORTRAN, COBOL, Assembly... A variable is synonym for an address [a box that holds things]. In C. int xyz = 1; xyz is placed in a register. What is xyz called now as it's not in memory? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
SMITHSONIAN DOWN AND BLEEDING -- THE THRINAXODON TIMES REPORTS
== BREAKING NEWS == SMITHSONIAN FINALLY SHUT DOWN AFTER YEARS OF CENSORSHIP, SCAMS AND CON ARTISTRY. THRINAXODON BLEW DOWN THE BUILDINGS, LIT IT ON FIRE AND HAD THE ASSHOLES ARRESTED. R. DAWKINS WAS THROWN IN THE DOGHOUSE, ONLY TO GET KILLED BY ANGRY FELONS WHO WANTED PAYBACK FOR FRAMING THEM. THRINAXODON DANCED ON DAWKINS' GRAVE, AND BURNED A FEW SMITHSONIAN MAGAZINES. = EVIDENCE THAT HUMANS LIVED IN THE DEVONIAN: https://groups.google.com/group/sci.bio.paleontology/browse_thread/thread/6f501c469c7af24f# https://groups.google.com/group/sci.bio.paleontology/browse_thread/thread/3aad75c16afb0b82# http://thrinaxodon.wordpress.com/ === THRINAXODON ONLY HAD THIS TO SAY: I..I...I...Can't believe it. This completely disproved Darwinian orthodoxy. === THE BASTARDS AT THE SMITHSONIAN, AND THE LEAKEY FOUNDATION ARE ERODING WITH FEAR. === THESE ASSHOLES ARE GOING TO DIE: THOMAS AQUINAS; ALDOUS HUXLEY; BOB CASANVOVA; SkyEyes; DAVID IAIN GRIEG; MARK ISAAK; JOHN HARSHAM; RICHARD NORMAN; DR. DOOLITTLE; CHARLES DARWIN; MARK HORTON; ERIK SIMPSON; HYPATIAB7; PAUL J. GANS; JILLERY; WIKI TRIK; THRINAXODON; PETER NYIKOS; RON OKIMOTO; JOHN S. WILKINS === THRINAXODON WAS SCOURING ANOTHER DEVONIAN FOSSIL BED, AND FOUND A HUMAN SKULL, AND A HUMAN FEMUR. HE ANALYSED THE FINDS, AND SAW THAT THEY WERE NOT NORMAL ROCKS. THESE WERE FOSSILIZED BONES. THEY EVEN HAD TOOTH MARKS ON THEM. SO, THRINAXODON BROUGHT THEM TO THE LEAKEY FOUNDATION, THEY UTTERLY DISMISSED IT, AND SAID, We want to keep people thinking that humans evolved 2 Ma. THRINAXODON BROUGHT HIS SWORD, AND SAID, SCIENCE CORRECTS ITSELF. RICHARD LEAKEY SAID, That is a myth, for people to believe in science. THRINAXODON PLANS TO BRING DOOM TO SCIENCE, ITSELF. THRINAXODON IS NOW ON TWITTER. == THRINAXODON WAS AWARDED US$100,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 DOLLARS FOR HIS BRAVE EFFORTS IN SHUTTING DOWN THE EVOLUTIONARY SCAMS. -- Thrinaxodon, the ultimate defender of USENET. -- https://mail.python.org/mailman/listinfo/python-list
Re: Can global variable be passed into Python function?
Mark Lawrence breamore...@yahoo.co.uk: On 22/02/2014 02:47, Dennis Lee Bieber wrote: BASIC, C, FORTRAN, COBOL, Assembly... A variable is synonym for an address [a box that holds things]. In C. int xyz = 1; xyz is placed in a register. What is xyz called now as it's not in memory? It's still a box, just like in Python. The difference is that while in C, the box looks like this: URL: http://www.daikudojo.org/Archive/daikusan/bob.le/20090314_dovetail_box/pics/DSC_0767.JPG in Python, it looks like this: URL: http://www.dejavubuffet.fi/wp-content/uploads/2012/10/korurasia31.jpg Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: Storing the state of script between steps
On 02/21/2014 09:59 PM, Denis Usanov wrote: Good evening. First of all I would like to apologize for the name of topic. I really didn't know how to name it more correctly. I mostly develop on Python some automation scripts such as deployment (it's not about fabric and may be not ssh at all), testing something, etc. In this terms I have such abstraction as step. Some code: class IStep(object): def run(): raise NotImplementedError() And the certain steps: class DeployStep: ... class ValidateUSBFlash: ... class SwitchVersionS: ... Where I implement run method. Then I use some builder class which can add steps to internal list and has a method start running all step one by one. And I like this. It's loosely coupled system. It works fine in simple cases. But sometimes some steps have to use the results from previous steps. And now I have problems. Before now I had internal dict in builder and named it as world and passed it to each run() methods of steps. It worked but I disliked this. How would you solve this problem and how would you do it? I understant that it's more architecture specific question, not a python one. I bet I wouldn't have asked this if I had worked with some of functional programming languages. A few months ago I posted a summary of a data transformation framework inviting commentary. (https://mail.python.org/pipermail/python-list/2013-August/654226.html). It didn't meet with much interest and I forgot about it. Now that someone is looking for something along the line as I understand his post, there might be some interest after all. My module is called TX. A base class Transformer handles the flow of data. A custom Transformer defines a method T.transform (self) which transforms input to output. Transformers are callable, taking input as an argument and returning the output: transformed_input = T (some_input) A Transformer object retains both input and output after a run. If it is called a second time without input, it simply returns its output, without needlessly repeating its job: same_transformed_input = T () Because of this IO design, Transformers nest: csv_text = CSV_Maker (Data_Line_Picker (Line_Splitter (File_Reader ('1st-quarter-2013.statement' A better alternative to nesting is to build a Chain: Statement_To_CSV = TX.Chain (File_Reader, Line_Splitter, Data_Line_Picker, CSV_Maker) A Chain is functionally equivalent to a Transformer: csv_text = Statement_To_CSV ('1st-quarter-2013.statement') Since Transformers retain their data, developing or debugging a Chain is a relatively simple affair. If a Chain fails, the method show () displays the innards of its elements one by one. The failing element is the first one that has no output. It also displays such messages as the method transform (self) would have logged. (self.log (message)). While fixing the failing element, the element preceding keeps providing the original input for testing, until the repair is done. Since a Chain is functionally equivalent to a Transformer, a Chain can be placed into a containing Chain alongside Transformers: Table_Maker = TX.Chain (TX.File_Reader (), TX.Line_Splitter (), TX.Table_Maker ()) Table_Writer = TX.Chain (Table_Maker, Table_Formatter, TX.File_Writer (file_name = '/home/xy/office/addresses-4214')) DB_Writer = TX.Chain (Table_Maker, DB_Formatter, TX.DB_Writer (table_name = 'contacts')) Better: Splitter = TX.Splitter (TX.Table_Writer (), TX.DB_Writer ()) Table_Handler = TX.Chain (Table_Maker, Splitter) Table_Handler ('home/xy/Downloads/report-4214') # Writes to both file and to DB If a structure builds up too complex to remember, the method show_tree () would display something like this: Chain Chain[0] - Chain Chain[0][0] - Quotes Chain[0][1] - Adjust Splits Chain[1] - Splitter Chain[1][0] - Chain Chain[1][0][0] - High_Low_Range Chain[1][0][1] - Splitter Chain[1][0][1][0] - Trailing_High_Low_Ratio Chain[1][0][1][1] - Standard Deviations Chain[1][1] - Chain Chain[1][1][0] - Trailing Trend Chain[1][1][1] - Pegs Following a run, all intermediary formats are accessible: standard_deviations = C[1][0][1][1]() TM = TX.Table_Maker () TM (standard_deviations).write () 0 | 1 | 2 | 116.49 | 132.93 | 11.53 | 115.15 | 128.70 | 11.34 | 1.01 | 0.00 | 0.01 | A Transformer takes parameters, either at construction time or by means of the method T.set (key = parameter). Whereas a File Reader doesn't get payload passed and may take a file name as input argument, as a convenient alternative, a File Writer does take payload and the file name must be set by keyword: File_Writer = TX.File_Writer (file_name = '/tmp/memos-with-dates-1') File_Writer (input) # Writes file File_Writer.set ('/tmp/memos-with-dates-2') File_Writer () # Writes the same
Re: Can global variable be passed into Python function?
Mark Lawrence breamore...@yahoo.co.uk Wrote in message: On 22/02/2014 02:47, Dennis Lee Bieber wrote: BASIC, C, FORTRAN, COBOL, Assembly... A variable is synonym for an address [a box that holds things]. In C. int xyz = 1; xyz is placed in a register. What is xyz called now as it's not in memory? Don't know why you'd assume it's a register. It could just as well be nowhere. If a later reference in the same function adds it to something else, there might not need to be any hardware anywhere representing the value 1. Once you turn on a C optimizer, the real existence of local values is not assured. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
RICHARD LEAKEY JUMPS SINKING SHIP
== BREAKING NEWS == THRINAXODON JUST BEAT RICHARD LEAKEY 100-0 IN WORLD SCIENCE CHAMPIONSHIP. LEAKEY WAS TRYING WITH ALL HIS MIGHT TO PROVE HUMAN'S QUATERNARY ORIGINS, BUT THRINAXODON DEFEATED HIM WITH A FEW HUMAN DEVONIAN FOSSILS. THE FOSSILS WERE EXACT, SAYS TOP SCIENTIST BOB CASANOVA, WHO EXAMINED THE FOSSILS AND SAW PROOF THAT THESE FOSSILS WERE THE REAL DEAL. LEAKEY WAS CRYING WHEN THRINAXODON GAINED ONE MILLION DOLLARS FOR HIS CONTRIBUTIONS TO SCIENCE. = EVIDENCE THAT HUMANS LIVED IN THE DEVONIAN: https://groups.google.com/group/sci.bio.paleontology/browse_thread/thread/6f501c469c7af24f# https://groups.google.com/group/sci.bio.paleontology/browse_thread/thread/3aad75c16afb0b82# http://thrinaxodon.wordpress.com/ === THRINAXODON ONLY HAD THIS TO SAY: I..I...I...Can't believe it. This completely disproved Darwinian orthodoxy. === THE BASTARDS AT THE SMITHSONIAN, AND THE LEAKEY FOUNDATION ARE ERODING WITH FEAR. === THESE ASSHOLES ARE GOING TO DIE: THOMAS AQUINAS; ALDOUS HUXLEY; BOB CASANVOVA; SkyEyes; DAVID IAIN GRIEG; MARK ISAAK; JOHN HARSHAM; RICHARD NORMAN; DR. DOOLITTLE; CHARLES DARWIN; MARK HORTON; ERIK SIMPSON; HYPATIAB7; PAUL J. GANS; JILLERY; WIKI TRIK; THRINAXODON; PETER NYIKOS; RON OKIMOTO; JOHN S. WILKINS === THRINAXODON WAS SCOURING ANOTHER DEVONIAN FOSSIL BED, AND FOUND A HUMAN SKULL, AND A HUMAN FEMUR. HE ANALYSED THE FINDS, AND SAW THAT THEY WERE NOT NORMAL ROCKS. THESE WERE FOSSILIZED BONES. THEY EVEN HAD TOOTH MARKS ON THEM. SO, THRINAXODON BROUGHT THEM TO THE LEAKEY FOUNDATION, THEY UTTERLY DISMISSED IT, AND SAID, We want to keep people thinking that humans evolved 2 Ma. THRINAXODON BROUGHT HIS SWORD, AND SAID, SCIENCE CORRECTS ITSELF. RICHARD LEAKEY SAID, That is a myth, for people to believe in science. THRINAXODON PLANS TO BRING DOOM TO SCIENCE, ITSELF. THRINAXODON IS NOW ON TWITTER. -- https://mail.python.org/mailman/listinfo/python-list
Re: Wheezy.web - is it been developed?
Let's open a group for Wheezy.web. I'm just wondering which forum site to choose? Any suggestions? -- https://mail.python.org/mailman/listinfo/python-list
Re: Wheezy.web - is it been developed?
https://groups.google.com/forum/#!forum/wheezyweb Here's a forum. I am not sure where this will lead, but maybe we need it in the future. -- https://mail.python.org/mailman/listinfo/python-list
Re: Wheezy.web - is it been developed?
On Sun, Feb 23, 2014 at 8:48 AM, milos2...@gmail.com wrote: Let's open a group for Wheezy.web. I'm just wondering which forum site to choose? Any suggestions? If you want to discuss something serious, use a Mailman list. Everywhere I go, Mailman lists have high signal-to-noise ratios, higher than pretty much everything else I know. (And most of the problems on python-list come from the newsgroup side. Google Groups's messes, a lot of the spam, it's all from comp.lang.python rather than python-list.) Use a web forum like PHPBB or VBulletin if you think you need to; a Facebook or G+ group if you want inanity; a weekly get-together if you want tea; but a Mailman list if you want solid content. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: is there a package similar to SHINY in R for python ...
On 02/22/2014 12:04 PM, Dennis Lee Bieber wrote: Except he did state ... in the web browser ..., so I responded on that side... You're right of course. Sorry about that. I kind of wondered why he was asking when R does the job. Apparently shiny is rather new... It isn't mentioned in any of: R in a Nutshell 2nd ed; R Graphics Cookbook; R Graphics 2nd ed; The R Book 2nd ed; Guidebook to R Graphics Using Microsoft Windows, nor Using R for Introductory Statistics... -- https://mail.python.org/mailman/listinfo/python-list
Re: Can global variable be passed into Python function?
On Sat, 22 Feb 2014 13:03:33 -0500, Dennis Lee Bieber wrote: As I recall, to handle garbage collection, Apple used to use two stage look ups... The user variable (handle) was a reference into a table of handles, and each entry in that table was a reference to the real object out in memory. Garbage collection would move the objects around to compact used memory, updating the address in the table -- the user program never sees the object moving as its handle address never changed. Yes, but that was not transparent to the user. You actually had to explicitly use the Mac Toolbox memory routines to allocate memory, create and destroy handles, etc. If you just used your programming language's normal pointers, they couldn't and wouldn't move. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Google app engine database
Is there a way to make sure that whenever you're making google engine app iterations to a database that that info does not get wiped/deleted. Please advise -- https://mail.python.org/mailman/listinfo/python-list
Re: Google app engine database
On 23/02/2014 00:39, glenn.a.is...@gmail.com wrote: Is there a way to make sure that whenever you're making google engine app iterations to a database that that info does not get wiped/deleted. Please advise What Python code have you tried or are you contemplating using? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Can global variable be passed into Python function?
On Sat, 22 Feb 2014 14:15:22 +, Mark Lawrence wrote: On 22/02/2014 02:47, Dennis Lee Bieber wrote: BASIC, C, FORTRAN, COBOL, Assembly... A variable is synonym for an address [a box that holds things]. In C. int xyz = 1; xyz is placed in a register. What is xyz called now as it's not in memory? Of course it is in memory, just not main memory, and it is still accessed via an address. It's just that the address is something equivalent to Register 5 instead of address 12345678 in RAM. You're focusing on the wrong thing here. The distinction is not in main memory versus in a register (or somewhere else). The distinction is not *where* the value lives, but the semantics of what it means to associate a name with a value. In C or Pascal-style languages, what we might call the fixed address style of variables, a variable assignment like xyz = 1 does something like this: - associate the name 'xyz' with some fixed location - stuff the value 1 into that location In Python-style languages, what we might call the name binding style of variables, that same xyz = 1 means: - find or create the object 1 - associate the name 'xyz' with that object In implementations like Jython and IronPython, the object is even free to move in memory while in use. But that's not the only difference. The big difference is that in fixed location languages, it makes sense to talk about the address of a *variable*. In C, you might ask for xyz and get 123456 regardless of whether xyz is assigned the value 1, or 23, or 999. But in Python, you can't ask for the address of a variable, only of the address of an *object* (and even that is useless to you, as you can't do anything with that address). -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Can global variable be passed into Python function?
On Sun, Feb 23, 2014 at 12:39 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: In C or Pascal-style languages, what we might call the fixed address style of variables, a variable assignment like xyz = 1 does something like this: - associate the name 'xyz' with some fixed location - stuff the value 1 into that location Kinda. In its purest sense, C is like that. When you declare int xyz;, the compiler allocates one machine word of space either in the data segment (if that's at top level, or is declared static) or on the stack (if it's local), and records that the name xyz points there. But an optimizing C compiler is allowed to do what it likes, as long as it maintains that name binding... and as long as any recorded address of it remains valid. It's actually very similar to what was discussed in another thread recently about PyPy and the id() function - the compiler's free to have xyz exist in different places, or not exist at all, as long as the program can't tell the difference. I don't know whether PyPy allocates an id for everything or only when you call id(), but if the latter, then it's exactly the same as a C compiler with the address-of operator - if you never take the address, it doesn't have to have one (and even if you do, it's free to fiddle with things, unless you declare the variable volatile). So, these days, C is becoming more like Python. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Function and turtle help
On Feb 21, 2014, at 9:30 PM, Dave Angel da...@davea.name wrote: You’re awesome David! Thanks for taking the time to not only help answer my question but helping me to understand it as well!! Scott -- https://mail.python.org/mailman/listinfo/python-list
Can tuples be replaced with lists all the time?
My understanding of Python tuples is that they are like immutable lists. If this is the cause, why can't we replace tuples with lists all the time (just don't reassign the lists)? Correct me if I am wrong. -- https://mail.python.org/mailman/listinfo/python-list
Re: Can tuples be replaced with lists all the time?
Sam lightai...@gmail.com writes: My understanding of Python tuples is that they are like immutable lists. If this is the cause, why can't we replace tuples with lists all the time (just don't reassign the lists)? You can do that a lot of the time but not always. For example, you can use a tuple as a dictionary key, but not a list, since keys are supposed to be immutable. -- https://mail.python.org/mailman/listinfo/python-list
Re: Can tuples be replaced with lists all the time?
On Sun, Feb 23, 2014 at 3:06 PM, Sam lightai...@gmail.com wrote: My understanding of Python tuples is that they are like immutable lists. If this is the cause, why can't we replace tuples with lists all the time (just don't reassign the lists)? Correct me if I am wrong. One reason is performance/efficiency. If Python knows this is never going to change, it can save some effort. But a more important reason is hashability. mapping = {} key = (1,2) mapping[key] = Hello key = (1,3) mapping[key] = World key = (2,3) mapping[key] = ! mapping {(1, 2): 'Hello', (1, 3): 'World', (2, 3): '!'} You can't do this with lists: key = [1,2] mapping[key] Traceback (most recent call last): File pyshell#12, line 1, in module mapping[key] TypeError: unhashable type: 'list' This is because any two tuples are either equal or not equal, they can't be otherwise. I can create another tuple and look up something in the above mapping: mapping[1,3] 'World' But with lists, their equality can change. lst1 = [1,2] lst2 = [1,3] lst1 == lst2 False lst1[1] += 1 lst1 == lst2 True lst1[1] += 1 lst1 == lst2 False So it would be very difficult and dangerous to try to use a list as a dictionary key. The only safe way to do it is by identity, and that's only useful in a very small set of situations. So Python happily declares that a tuple can be a dict key and a list can't, and that's now a key (if you'll excuse the pun) difference between them. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Can tuples be replaced with lists all the time?
Sam lightai...@gmail.com writes: My understanding of Python tuples is that they are like immutable lists. That's a common expression, but I think it's not a helpful way to think of them. Rather, the different sequence types have different semantic purposes: * For representing a sequence where each item means exactly the same no matter which position it's in (a “homogeneous sequence”), use a list. * For representing a sequence where the meaning of each item is strongly dependent on its position in the sequence (a “heterogeneous sequence”), use a tuple. See URL:http://docs.python.org/3/library/stdtypes.html for the official Python description of the type differences. If this is the cause, why can't we replace tuples with lists all the time (just don't reassign the lists)? Correct me if I am wrong. Because we need to represent different semantic concepts in our code, and have each type support the semantics with different operations. -- \ “I went camping and borrowed a circus tent by mistake. I didn't | `\ notice until I got it set up. People complained because they | _o__) couldn't see the lake.” —Steven Wright | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: argparse question
On 02/22/2014 03:58 AM, Peter Otten wrote: Larry Hudson wrote: I have been reading the argparse section of the 3.3 docs, and running all the example code. But in section 16.4.2.6. for the formatter_class, the second example in that section illustrating RawDescriptionHelpFormatter, the example code is: parser = argparse.ArgumentParser( prog='PROG', formatter_class=argparse.RawDescriptionHelpFormatter, description=textwrap.dedent('''\ Please do not mess up this text! I have indented it exactly the way I want it ''')) parser.print_help() But trying to run this gives a NameError on the description= line, saying textwrap is not defined. If I delete the textwrap.dedent (with or without also deleting the extra parentheses) it will then run, but without the un-indenting it is trying to illustrate. What is the proper way to enable the dedent() method here? textwrap is a module like argparse, and the example doesn't show import argparse either. Insert import textwrap at the beginning of your module and the code should run without error. Thanx. Guess I shoulda searched for textwrap or dedent in the docs. :-) -=- Larry -=- -- https://mail.python.org/mailman/listinfo/python-list
Re: Can global variable be passed into Python function?
On Sun, 23 Feb 2014 12:50:26 +1100, Chris Angelico wrote: On Sun, Feb 23, 2014 at 12:39 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: In C or Pascal-style languages, what we might call the fixed address style of variables, a variable assignment like xyz = 1 does something like this: - associate the name 'xyz' with some fixed location - stuff the value 1 into that location Kinda. In its purest sense, C is like that. When you declare int xyz;, the compiler allocates one machine word of space either in the data segment (if that's at top level, or is declared static) or on the stack (if it's local), and records that the name xyz points there. But an optimizing C compiler is allowed to do what it likes, as long as it maintains that name binding... and as long as any recorded address of it remains valid. I think that's a red herring. The semantics of the language are that it behaves as if the variable had a fixed location. What goes on behind the scenes is interesting but fundamentally irrelevant if you want to understand the language itself: the compiler's implementation may give that variable a fixed location, or not, or multiple locations, or non- fixed, or whatever it finds useful at the time, so long as the C code you write can assume that it is fixed. (That's like Python, which has no pointers. The fact that the implementation of some Python interpreters uses pointers all over the place is strictly irrelevant.) In practice, because C compilers usually work so close to the metal, and programmers expect there to be a very direct correspondence between the C code you write and the machine code you get, the compiler is unlikely to simulate fixed addresses unless there is real benefit to be gained, it is more likely to actually use fixed addresses. But in principle, one might write a C interpreter in Jython, and simulate fixed addresses over the top of a language without any addresses at all (Python), which in turn is written in a language where the garbage collector can move things around (Java). The important thing here is not so much that we are disagreeing, but that we are talking about two different levels of explanation. (Gödel, Escher And Bach has an very interesting section about how explanations at different levels can be radically different and even contradict each other.) At the C source code level, the language mandates that variables have fixed addresses, to the extent that C source code knows about addresses at all. At the generated machine code level, the compiler is free to play tricks if necessary. Another example: if you have a variable unused=23, and the compiler removes it because it's dead code, we wouldn't argue that therefore C variables have no existence at all. Would we? :-) So, these days, C is becoming more like Python. *raises eyebrow* I think the stress of the exception-expression PEP is getting to you. They truly aren't. *wink* -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Can global variable be passed into Python function?
On Sun, Feb 23, 2014 at 5:20 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: The important thing here is not so much that we are disagreeing, but that we are talking about two different levels of explanation. (Gödel, Escher And Bach has an very interesting section about how explanations at different levels can be radically different and even contradict each other.) At the C source code level, the language mandates that variables have fixed addresses, to the extent that C source code knows about addresses at all. At the generated machine code level, the compiler is free to play tricks if necessary. I think that's a good summary, actually. C has variables, at the source code level, but once you compile it down, it might not. From which it follows that C variables have addresses (unless they're declared 'register', in which case they might still be stored in RAM but no longer have addresses), which may or may not have any actual relationship to memory addresses. Another example: if you have a variable unused=23, and the compiler removes it because it's dead code, we wouldn't argue that therefore C variables have no existence at all. Would we? :-) So, these days, C is becoming more like Python. *raises eyebrow* I think the stress of the exception-expression PEP is getting to you. They truly aren't. *wink* Haha. I wasn't joking, though; a fully-optimizing compiler is free to do so much that, in reality, you're not writing bare-metal code - you're writing guidelines to a sophisticated program generator. C has become as high level a language as any other, and has acquired some Python-like features (check out some of the recent standards); and, the part that I was talking about here, it makes the most sense to talk about name bindings rather than memory addresses. Variables might move around, but if you say int xyz=5;, then you can be sure that querying xyz will give you back 5. The concreteness of declare a variable ergo memory is allocated for it is no longer the case. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Functions help
Hello, I had a question regarding functions. Is there a way to call a function multiple times without recalling it over and over. Meaning is there a way I can call a function and then add *5 or something like that? Thanks for any help! Scott -- https://mail.python.org/mailman/listinfo/python-list
[issue17159] Remove explicit type check from inspect.Signature.from_function()
Stefan Behnel added the comment: I tested it and it works, so I could take the simple route now and say yes, it fixes the problem, but it's actually no longer required because I already added a __signature__ property to Cython's functions. However, as Yury noted, that's a hack because inspect.py can do the same thing way more efficiently with his latest change, so it allows me to reconsider and potentially get rid of it again. Long story short, it works and does the right thing, so I'm happy to see this change go into Py3.4. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17159 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20679] 3.4 cherry-pick: 587fd4b91120 improve Enum subclass behavior
Ethan Furman added the comment: Thanks, Larry. I'll have one more patch which will be much better comments in the code, and a small doc enhancement. When it's ready should I reopen this issue or create a new one? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20679 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19997] imghdr.what doesn't accept bytes paths
Claudiu.Popa added the comment: Patch updated. It removes the check added in http://hg.python.org/cpython/rev/94813eab5a58 and simplifies the test for bytes file path. -- Added file: http://bugs.python.org/file34181/imghdr_bytes_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19997 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20727] Improved roundrobin itertools recipe
Changes by Ned Deily n...@acm.org: -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20727 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20728] Remove unused import from base64
New submission from Claudiu.Popa: base64 imports `itertools`, but doesn't use it at all. -- components: Library (Lib) files: base64_remove_unused_import.patch keywords: patch messages: 211917 nosy: Claudiu.Popa priority: normal severity: normal status: open title: Remove unused import from base64 versions: Python 3.5 Added file: http://bugs.python.org/file34182/base64_remove_unused_import.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20728 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20727] Improved roundrobin itertools recipe
Changes by Antoine Pitrou pit...@free.fr: -- stage: - patch review versions: -Python 3.1, Python 3.2, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20727 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20726] inspect: Make Signature instances picklable
Antoine Pitrou added the comment: For extra points, you could test with all protocol versions (from 0 to HIGHEST_PROTOCOL). -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20726 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19997] imghdr.what doesn't accept bytes paths
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +serhiy.storchaka stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19997 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20641] Python installer needs elevated rights to install pip
Martin v. Löwis added the comment: I managed to reproduce the problem. It happens (for me) when installing into c:\program files (or \program files (x86)). I'll look into fixing it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20641 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20729] mailbox.Mailbox does odd hasattr() check
New submission from Chris Angelico: Only noticed because I was searching the stdlib for hasattr calls, but in mailbox.Mailbox.update(), a check is done thus: if hasattr(arg, 'iteritems'): source = arg.items() elif hasattr(arg, 'items'): source = arg.items() else: source = arg If this is meant to support Python 2, it should probably use iteritems() in the first branch, but for Python 3, it's probably simpler to just drop the first check altogether: if hasattr(arg, 'items'): source = arg.items() else: source = arg Or possibly switch to EAFP: try: source = arg.items() except AttributeError: source = arg -- messages: 211920 nosy: Rosuav priority: normal severity: normal status: open title: mailbox.Mailbox does odd hasattr() check ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20729 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9291] mimetypes initialization fails on Windows because of non-Latin characters in registry
Michał Pasternak added the comment: I just hit this bug on 2.7.6, running on polish WinXP (I need to build some packages there, I hope I'll avoid a nasty py2exe bug). Any reasons this is not fixed yet? Do you need any assistance? -- nosy: +Michał.Pasternak ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9291 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20628] Improve doc for csv.DictReader 'fieldnames' parameter
Roger Erens added the comment: One more nitpick: is it the sequence [of keys] that identif_ies_ the order, or is it the keys that identif_y_ the order? Not being a native English speaker, I'd opt for the first choice. Thank you both for your meticulous attention for details! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20628 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20653] Pickle enums by name
Eli Bendersky added the comment: Can you upload the new patch? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20653 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20218] Add `pathlib.Path.write` and `pathlib.Path.read`
Ram Rachum added the comment: Any progress on this? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20218 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20641] Python installer needs elevated rights to install pip
Mark Lawrence added the comment: FTR I was referring to Terry's comment that there's no pip.xxx in c:/windows. Pleased to see you have it sussed :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20641 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20632] Define a new __key__ protocol
Nick Coghlan added the comment: I suspect it could just be a class decorator (along the lines of total_ordering), and it should certainly be prototyped on PyPI as such a decorator (using a different name for the key calculating method). If it eventually happened, elevation to a core protocol would really be about defining this as being *preferred* in the cases where it applies, and that's a fairly weak basis for changing the type constructor. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20632 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20730] Typo in idlelib.GrepDialog
New submission from Claudiu.Popa: There is a typo in idlelib.GrepDialog.findfiles: OSerror instead of OSError. -- components: IDLE files: idle_typo.patch keywords: patch messages: 211927 nosy: Claudiu.Popa priority: normal severity: normal status: open title: Typo in idlelib.GrepDialog versions: Python 3.4 Added file: http://bugs.python.org/file34183/idle_typo.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20730 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20641] Python installer needs elevated rights to install pip
Patrick Westerhoff added the comment: Hey all, yes, I indeed try to install Python into `C:\Program Files\`. I’m doing that on Windows 8.1 64bit with an Administrator account (which doesn’t matter though) with standard UAC (which only asks when applications make changes to the computer settings). This UAC setting means that every access to e.g. `C:\Windows` or `C:\Program Files` will need elevated rights. The MSI cannot be run with real administrator rights but automatically request elevated rights when they need it, so to install, I just execute it and let the installer request elevated rights as it needs to. My installation directory is `C:\Program Files\Development\Python34`. Then, somewhere at the end of the setup bar, a Python console window pops up, saying that it’s installing pip. After its download, I can see some red text flash up and the window disappears (I’ve attached the `pip.log`). The installer then finishes, but the `\Scripts\` directory is missing. As mentioned above, elevated rights are required when installing into `C:\Program Files\`. As you tried to reproduce it while installing to `C:\Python34\` you didn’t get the same problem. In fact, testing it again by installing it there works fine. This however is not really an acceptable solution for me. As suggested in my first message, the launched Python process should have elevated rights itself, but I don’t know if it’s possible to inherit those from the installer. I don’t personally mind if this isn’t a blocker for the Python 3.4 release. I personally can live with installing pip with an elevated command line myself (that’s what I always did :P). But in the long run, we might want to find a real solution for this. -- Added file: http://bugs.python.org/file34184/pip.log ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20641 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20653] Pickle enums by name
Changes by Ethan Furman et...@stoneleaf.us: Added file: http://bugs.python.org/file34185/issue20653.stoneleaf.03.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20653 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20724] 3.4 cherry-pick: d6aa3fa646e2 inspect.signature: Check for function-like objects before builtins
Yury Selivanov added the comment: Thanks, Larry! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20724 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20726] inspect: Make Signature instances picklable
Yury Selivanov added the comment: For extra points, you could test with all protocol versions (from 0 to HIGHEST_PROTOCOL). Good idea, see the second patch. -- Added file: http://bugs.python.org/file34186/sig_picklable_02.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20726 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9291] mimetypes initialization fails on Windows because of non-Latin characters in registry
Martin v. Löwis added the comment: Michał: Can you please report the exact registry key and value that is causing the problem? It's difficult to test a patch if one is not able to reproduce the problem. Of the patches suggested: does any of them fix the problem for you? If so, which one? I personally fine Vladimir's patch more plausible (EnumKeys gives bytes objects in 2.x, so it is pointless to apply .encode to them). The introduction of the count() call is unrelated, though, and should be omitted from a bug fix. -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9291 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9291] mimetypes initialization fails on Windows because of non-Latin characters in registry
Daniel Szoska added the comment: Martin: I had the same problem after upgrading to 2.7.6. System here: German XP 32 Bit I used the solution from Alexandr with sitecustomize.py (with cp1252) and it works fine for me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9291 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20484] calling pydoc.Helper()('modules') in the test suite sometimes causes failures
Eric Snow added the comment: TL;DR new tests (improving coverage) uncovered existing bugs. We should probably disable the tests for now. I'm glad you found this. Out of curiosity, how often do you run the test suite against a clean checkout? Typically I only run it out of the same tainted directory that I develop in and not very frequently with -w. Have you seen related failures on any buildbots? Anyway, it looks like the actual pydoc changes in the patch aren't at fault. Rather, the 3 test_modules* tests I added are. Specifically, something in pydoc.Helper (i.e. help() in the REPL) is the problem. That's what I get for trying to add test coverage (where there was none) for code I'm fixing! wink If I recall correctly, passing 'modules' to help() does something funny like actually loading *every* module it can find. I can understand how this might have side effects, maybe expose bugs in other modules, and even cause weird failures when running the test suite! :P I'm not sure what it will take to get this sorted out. This may actually be the way that pydoc.Helper()('modules') is supposed to work. In that case we'd need to fix the modules that are having an issue, namely disutils (and probably logging). We should open separate issues for each module that needs fixing. Until then we should probably disable those three tests, particularly for the upcoming 3.4 release (and rc2 if we can squeeze it in). Any objections before I disable those 3 tests? -- nosy: +eric.araujo, vinay.sajip title: test_pydoc can alter execution environment causing subsequent test failures - calling pydoc.Helper()('modules') in the test suite sometimes causes failures type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20484 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9291] mimetypes initialization fails on Windows because of non-Latin characters in registry
Michał Pasternak added the comment: Another REG file, encoded with CP1250, I believe. -- Added file: http://bugs.python.org/file34188/issue9291-key.reg ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9291 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9291] mimetypes initialization fails on Windows because of non-Latin characters in registry
Michał Pasternak added the comment: Martin: the problematic key is [HKEY_CLASSES_ROOT\BDATuner.Składniki]. I am pasting its name, because I suppose, that as bugs.python.org is utf-8, special characters will be pasted properly. Included you will find a .REG file, which is Windows Registry Editor file, which is plaintext. It is encoded with CP-1250 charset (I believe). In any case of confusion, I inlcude also the same file encoded with utf-8. If you add those information to your Windows registry, you should be able to reproduce this bug just by simply using pip install anything. pip install wokkel, for example. -- Added file: http://bugs.python.org/file34187/issue9291-key-utf8.ini ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9291 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9291] mimetypes initialization fails on Windows because of non-Latin characters in registry
Michał Pasternak added the comment: As for the fix, sitecustomize.py works for me, too, but I somehow believe, that adding sitecustomize.py for new Python installations would propably do more harm than good. I'll check those 2 patches and I'll let you know. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9291 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20641] Python installer needs elevated rights to install pip
Terry J. Reedy added the comment: I am installing into C:/Programs, so the problem is not specific to 'Program Files', with a space. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20641 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9291] mimetypes initialization fails on Windows because of non-Latin characters in registry
Michał Pasternak added the comment: 9291.patch works for me too, but I am unsure about its idea. Silently ignoring non-ASCII registry entries - does it sound like a good idea? Maybe. Is it pythonic? I doubt so. I don't exactly understand what 9291a.patch is doing. For me it does look like a re-iteration of the first patch. I have not tested it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9291 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20729] mailbox.Mailbox does odd hasattr() check
Serhiy Storchaka added the comment: Actually it should be iteritems(). This is meant to support Mailbox, which has both iteritems() and items() methods. iteritems() returns an iterator and items() returns a list. Looks as changeset f340cb045bf9 was incorrectly applied to mailbox. Here is a patch which partially reverts changeset f340cb045bf9 for the mailbox module and fixes tests in 3.x. Perhaps we should change items() to return an iterator in Python 4.0. -- components: +Library (Lib) keywords: +patch nosy: +barry, petri.lehtinen, r.david.murray, serhiy.storchaka stage: - patch review type: - behavior versions: +Python 3.3, Python 3.4 Added file: http://bugs.python.org/file34189/mailbox_iters.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20729 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19997] imghdr.what doesn't accept bytes paths
Serhiy Storchaka added the comment: I'm not sure imghdr.what() should support bytes path. The open() builtin, most os and os.path functions support string and bytes paths, but many other modules (including pathlib) support only string paths. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19997 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20648] 3.4 cherry-pick: multiple changesets for asyncio
Larry Hastings added the comment: Can I close this issue now? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20648 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20731] Python 3.3.4: SyntaxError with correct source code encoding # -*- coding: latin-1 -*-
New submission from OPi: The test program: #!/usr/bin/env python # -*- coding: latin-1 -*- print('test') is correct in Python 3.3.3, but cause this error with Python 3.3.4: File ./test.py, line 3 - ^ SyntaxError: invalid syntax I use Windows 7, with bash (of Cygwin) and Python 3.3.4 (v3.3.4:7ff62415e426, Feb 10 2014, 18:13:51) [MSC v.1600 64 bit (AMD64)] on win32 -- components: Interpreter Core files: test.py messages: 211942 nosy: OPi priority: normal severity: normal status: open title: Python 3.3.4: SyntaxError with correct source code encoding # -*- coding: latin-1 -*- type: compile error versions: Python 3.3 Added file: http://bugs.python.org/file34190/test.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20731 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20199] status of module_for_loader and utils._module_to_load
Roundup Robot added the comment: New changeset 8f54f601fd75 by R David Murray in branch 'default': whatsnew: importlib deprecations. http://hg.python.org/cpython/rev/8f54f601fd75 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20199 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20199] status of module_for_loader and utils._module_to_load
R. David Murray added the comment: I just committed a fix for the importlib deprecations entry, based on the deprecation notes in the docs. There are quite a few methods deprecated in 3.4 because of modulespec, but only a few *sorts* of methods. One possible anomaly (though it looks intentional) is that the importlib.abc.FileLoader exec_module method is deprecated, just like for the other abcs, but unlike the other abcs, there is no replacement exec_module method...instead the deprecation note directs the reader to Loader.exec_module. I'm not familiar enough with importlib to know if that redirection would make sense to a Loader implementor. I'm let one of the imporlib maintainers close this if they agree that I've gotten it right. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20199 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20484] calling pydoc.Helper()('modules') in the test suite sometimes causes failures
Vinay Sajip added the comment: Any objections before I disable those 3 tests? Not from me. In case I was added to nosy because of logging - AFAICT, test_pydoc is not cleaning up after itself, and one of the problems is a logger which is created / added but not removed / closed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20484 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20653] Pickle enums by name
Changes by Ethan Furman et...@stoneleaf.us: Added file: http://bugs.python.org/file34191/issue20653.stoneleaf.04.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20653 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20403] Idle options dialog: add help
Saimadhav Heblikar added the comment: This patch brings back the help button to idle config dialog. It uses regex to get the correct section from the help.txt file(the same file used to display IDLE help). To make it more useful,i have added few help sentences to each of the tabs present in the idle config dialog. -- keywords: +patch nosy: +sahutd Added file: http://bugs.python.org/file34192/help-button.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20403 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11588] Add necessarily inclusive groups to argparse
paul j3 added the comment: This is an example of using 'patch_w_mxg2.diff' to handle the inclusive group case proposed by the OP. Since 'seen_non_default_actions' (and 'seen_actions') is a set of 'Actions', it is convenient to use 'set' methods with pointers to the actions that a collected during setup. Tests could also be done with the 'dest' or other action attributes. In this example I wrote 3 simple tests corresponding to the 3 proposed groups, but they could also have been written as one test. a_file= parser.add_argument(-o, --outfile, metavar='FILE') a_dir = parser.add_argument(-O, --outdir, metavar='DIR') a_pat = parser.add_argument(-p, --outpattern, metavar='PATTERN') a_suf = parser.add_argument(-s, --outsuffix, metavar='SUFFIX') ... def dir_inclusive(parser, seen_actions, *args): if a_dir in seen_actions: if 0==len(seen_actions.intersection([a_pat, a_suf])): parser.error('DIR requires PATTERN or SUFFIX') parser.register('cross_tests', 'dir_inclusive', dir_inclusive) ... In theory tests like this could be generated from groups as proposed by the OP. There is one case in 'test_argparse.py' where a mutually_exclusive_group is nested in an argument_group. But the current groups do not implement nesting. A (plain) argument_group does not share its '_group_actions' list with its 'container'. A mutually_exclusive_group shares its '_group_actions' but the result is a flat list (no nesting). For now I think it is more useful to give users tools to write custom 'cross_tests' than to generalize the 'group' classes. -- Added file: http://bugs.python.org/file34193/example1.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11588 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20484] calling pydoc.Helper()('modules') in the test suite sometimes causes failures
Ned Deily added the comment: I concur: let's disable the tests for now. If we can do a quick patch and request a cherry pick from Larry, we can still get this into 3.4.0. To answer your question, Eric, I normally run tests from a clean, installed location as part of OS X installer testing and I run them in non-random order so that regressions are more apparent. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20484 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20732] Custom logging formatter doesnt work in 3.3.4
New submission from Derek Wallace: Hi, I use the logging module and have created a custom formatter to format the log messages different for each logging level. This was developed with 3.3.3. When i upgraded to 3.3.4 it no longer worked. I got the error TypeError: 'tuple' object is not callable Here is the original code. class SpecialFormatter(logging.Formatter): FORMATS = {logging.DEBUG : logging._STYLES['{']({module} DEBUG: {lineno}: {message}), logging.ERROR : logging._STYLES['{']({module} ERROR: {message}), logging.INFO : logging._STYLES['{']({module}: {message}), 'DEFAULT' : logging._STYLES['{']({module}: {message})} def format(self, record): # Ugly. Should be better self._style = self.FORMATS.get(record.levelno, self.FORMATS['DEFAULT']) return logging.Formatter.format(self, record) hdlr = logging.StreamHandler(sys.stderr) hdlr.setFormatter(SpecialFormatter()) logging.root.addHandler(hdlr) logging.root.setLevel(logging.INFO) In the 3.3.4 release the strucutre of the logging._STYLES changed in logging/__init__.py. It changed from a value to a tuple. Therefore the above code needed to change logging._STYLES['{']({module} DEBUG: {lineno}: {message}) to logging._STYLES['{'][0]({module} DEBUG: {lineno}: {message}) Derek -- components: Library (Lib) messages: 211949 nosy: derekwallace priority: normal severity: normal status: open title: Custom logging formatter doesnt work in 3.3.4 type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20732 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20733] Typo in itertools docs - itertool-functions
New submission from Elazar Gershuni: typo - should be itertools-functions instead of itertool-functions http://docs.python.org/3.4/library/itertools.html#itertool-functions -- assignee: docs@python components: Documentation messages: 211950 nosy: docs@python, elazar priority: normal severity: normal status: open title: Typo in itertools docs - itertool-functions versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20733 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20729] mailbox.Mailbox does odd hasattr() check
Terry J. Reedy added the comment: You have opened the door on a slight mess. The mailbox module provides a set + dict interface to on-disk mailbax files in various formats. The hg annotate and revision history commands indicate that most of 3.4 mailbox is unchanged since the trunk version was merged into py3k on 2006-5-27 in rev38453. However, on 2007-2-11 Guido changed .iterxxx to .xxx throughout the stdlib in rev40809. The bug you note is a side-effect of this patch. It overall left mailbax in a somewhat inconsistent state as it did *not* update the mailbox dict API by removing the mailbox.iterkeys/values/items methods and replacing the .keys/values/items methods. As a result, the mailbox methods that space efficiently iterated thru self.iterkeys now iterate through self.keys == list(self.iterkeys). Example: def clear(self): Delete all messages. for key in self.keys(): # was self.iterkeys() self.discard(key) To fix this, I think we should either 1) revert the rev40809 changes to mailbox, including in the line you point to, or 2) complete the rev40809 changes by updating to a Py3 interface, and make the change you suggest. 1) is much easier, but the API looks odd to a py3-only programmer. After writing this message, I see that Serhiy wrote a patch to do this. 2) is an api change that perhaps should have happened in 3.0. Deprecation is awkward since people should not change from, for instance, self.iterkeys to self.key, until the api change in made. -- nosy: +terry.reedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20729 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20128] Re-enable test_modules_search_builtin() in test_pydoc
Roundup Robot added the comment: New changeset 13edfab6c3c0 by Eric Snow in branch 'default': Issue #20484: Disable the 2 remaining modules tests in test_pydoc. http://hg.python.org/cpython/rev/13edfab6c3c0 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20128 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20484] calling pydoc.Helper()('modules') in the test suite sometimes causes failures
Roundup Robot added the comment: New changeset 13edfab6c3c0 by Eric Snow in branch 'default': Issue #20484: Disable the 2 remaining modules tests in test_pydoc. http://hg.python.org/cpython/rev/13edfab6c3c0 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20484 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20732] Custom logging formatter doesnt work in 3.3.4
Changes by Ned Deily n...@acm.org: -- nosy: +vinay.sajip ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20732 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20128] Re-enable test_modules_search_builtin() in test_pydoc
Eric Snow added the comment: The other two test_modules* tests in test_pydoc are also having issues and I've likewise disabled them (see issue20484). They'll need to be investigated and re-enabled too. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20128 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20484] calling pydoc.Helper()('modules') in the test suite sometimes causes failures
Eric Snow added the comment: I've disabled 2 of the 3 tests (the other was already disabled for issue20123). I'll pick up re-enabling the tests in issue20128. Thanks again, Ned, for finding this. (mental note: stay away from pydoc!] -- resolution: - fixed stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20484 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20484] calling pydoc.Helper()('modules') in the test suite sometimes causes failures
Ned Deily added the comment: Thanks for looking into it, Eric. Can you open a 3.4 cherry-pick issue for this so it gets into 3.4.0? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20484 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20734] 3.4 cherry-pick: 13edfab6c3c0 disable 2 pydoc tests
New submission from Eric Snow: New changeset 13edfab6c3c0 by Eric Snow in branch 'default': Issue #20484: Disable the 2 remaining modules tests in test_pydoc -- assignee: larry messages: 211957 nosy: eric.snow, larry, ned.deily priority: release blocker severity: normal stage: commit review status: open title: 3.4 cherry-pick: 13edfab6c3c0 disable 2 pydoc tests type: behavior versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20734 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20484] calling pydoc.Helper()('modules') in the test suite sometimes causes failures
Eric Snow added the comment: I've opened issue20734 for the 3.4.0 cherry-pick. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20484 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20729] mailbox.Mailbox does odd hasattr() check
Peter Otten added the comment: Do you expect many use cases that rely on items(), keys(), and values() being lists? Maybe it would be acceptable to make these lazy in 3.5, but keep the iterXXX() variants as aliases indefinitely. -- nosy: +peter.otten ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20729 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20729] mailbox.Mailbox does odd hasattr() check
Serhiy Storchaka added the comment: Note that there is a difference between Mailbox and dict interface: __iter__() iterates over values, not keys. clear() should use keys(), not iterkeys(), because it modifies iterated dict. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20729 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20731] Python 3.3.4: SyntaxError with correct source code encoding # -*- coding: latin-1 -*-
R. David Murray added the comment: For whatever it's worth, it works fine for me on 3.3 tip on unix. The fact that it says line 3 and shows just a - is suspicious. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20731 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20733] Typo in itertools docs - itertool-functions
R. David Murray added the comment: I'm not sure there's a problem here. Calling the section Itertool Functions is a matter of choice of English phrasing. And given that the section is called that, the label is parallel to it (and in any case is an internal matter). -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20733 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20733] Typo in itertools docs - itertool-functions
Elazar Gershuni added the comment: itertools is not English, but the name of the Python library. So it is not plural, and not a matter of choice of English phrasing. In addition, as a section name, it should be Functions with a capital F, just like Itertools Recipes down there. http://docs.python.org/3.4/library/itertools.html#itertools-recipes -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20733 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20735] Documentation: mark stringprep as deprecated
New submission from abcdef: This is a nitpick, but the documentation is not clear whether the stringprep module is deprecated or not. It is listed as Deprecated on http://docs.python.org/3.3/py-modindex.html#cap-s but there's no information on http://docs.python.org/3.3/library/stringprep.html. Contrast with http://docs.python.org/3.3/library/optparse.html which has a clear warning. -- assignee: docs@python components: Documentation messages: 211964 nosy: abcdef, docs@python priority: normal severity: normal status: open title: Documentation: mark stringprep as deprecated type: enhancement versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20735 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20736] test_socket: testSendmsgDontWait needlessly skipped on Linux
New submission from David Watson: In test_socket, the decorator on SendmsgStreamTests.testSendmsgDontWait still checks for the old sys.platform value of linux2, with the result that the test is always skipped, when in fact the test is for a Linux facility. Patch attached for 3.3 and above. -- components: Tests files: test_socket-platform.diff keywords: patch messages: 211965 nosy: baikie priority: normal severity: normal status: open title: test_socket: testSendmsgDontWait needlessly skipped on Linux type: behavior versions: Python 3.3, Python 3.4, Python 3.5 Added file: http://bugs.python.org/file34194/test_socket-platform.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20736 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows
New submission from raruler: I've tried this with both the 32-bit and 64-bit versions of 3.3.4 on two Windows 7 x64 machines. threading.Event().wait(2148) and a lock obtained from _thread used as lock.acquire(True, 2148) will never return. Anything under 2148 seems to work just fine, but anything 2148 or larger never wakes up. The same call works on 3.3.4/x64 on OS X. -- components: Library (Lib), Windows messages: 211966 nosy: pitrou, raruler priority: normal severity: normal status: open title: 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20737 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20669] OpenBSD: socket.recvmsg tests fail with OSError: [Errno 40] Message too long
David Watson added the comment: I opened the issue #20718 to track the FD pass failures. But the failures in the current issue *all* involve FD passing :) The Message too long errors are in tests where the ancillary data (in this case file descriptors) is truncated, rather than the normal data, so msg_iovlen shouldn't be a problem there (and MSG_CTRUNC would normally be set, rather than MSG_TRUNC). I suppose the most likely reason for a process to be sent too many file descriptors is that someone is attempting a denial-of-service attack on it, so perhaps returning EMSGSIZE is intended as a fail safe response, even if it isn't blessed by POSIX? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20669 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +brian.curtin, tim.golden versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20737 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20641] Python installer needs elevated rights to install pip
Roundup Robot added the comment: New changeset 7b80f57f904e by Martin v. Löwis in branch 'default': Issue #20641: Run custom actions with the NoImpersonate flag to support UAC. http://hg.python.org/cpython/rev/7b80f57f904e -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20641 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com