回复: problem on multi-threading
x=webdata(name) x.start() Traceback (most recent call last): File stdin, line 1, in module AttributeError: 'webdata' object has no attribute 'start' There is a relation with jobs.join() method in threading module,your answer is wrong. -- 原始邮件 -- 发件人: Sturla Molden;sturla.mol...@gmail.com; 发送时间: 2014年7月26日(星期六) 凌晨4:04 收件人: python-listpython-list@python.org; 主题: Re: problem on multi-threading 水静流深 1248283...@qq.com wrote: name=['60', '01', '600319', '600531','600661', '600983', '600202', '600149'] x=webdata(name) x.run() never quit from the thread ,why? Call .start() instead of .run() -- https://mail.python.org/mailman/listinfo/python-list-- https://mail.python.org/mailman/listinfo/python-list
Re: problem on multi-threading
On Fri, Jul 25, 2014 at 12:45 AM, 水静流深 1248283...@qq.com wrote: never quit from the thread ,why? I am going to guess that you can actually run code in the interpreter here. When printing from threads, the prompt will end up in the wrong place as the prompt is printed in the main thread. Similarly, there is a (decent) chance that the prints will be done out-of-order (multiple Thread... lines or URLs next to each other or on the same line). The odds that such behavior will occur will increase as the work become more complex and more threads are created. All of this can be resolved by manually using the locking provided in the threading module. 08221DA3@7B7BB14B.140BD253.PNG Description: Binary data -- https://mail.python.org/mailman/listinfo/python-list
python template lint
Hi there List, I am looking for a little guidance here. I am taking a series of template files for building configuration. I want to design some simple lint rules to check for some of the syntax of the template files I created. For instance if an open brace is seen indent 4 spaces each time. unindent when a close brace is seen. remove blank lines. Remove comments after '#' and so on. I could write this with search adn replace rules but I might want a module that allows for some complexity down the road. Any cool python module recommendations out there that does this well? Cheers, Noah -- https://mail.python.org/mailman/listinfo/python-list
Re: Prob. Code Downloaded for Programming the Semantic Web (python code)
On 7/25/2014 8:06 PM, Bruce Whealton wrote: The book has python 2.x code. If the modules in the book use the Natural Language Toolkit (nltk), then I believe you are currently stuck with using 2.7. If it does not, and you want to run with 3.3 or 3.4, then use 2to3 to do most to all of the conversion for you. C:\Programs\Python34python Tools/scripts/2to3.py -h Usage: 2to3 [options] file|dir ... Options: -h, --helpshow this help message and exit -d, --doctests_only Fix up doctests only -f FIX, --fix=FIX Each FIX specifies a transformation; default: all -j PROCESSES, --processes=PROCESSES Run 2to3 concurrently -x NOFIX, --nofix=NOFIX Prevent a transformation from being run -l, --list-fixes List available transformations -p, --print-function Modify the grammar so that print() is a function -v, --verbose More verbose logging --no-diffsDon't show diffs of the refactoring -w, --write Write back modified files -n, --nobackups Don't write backups for modified files -o OUTPUT_DIR, --output-dir=OUTPUT_DIR Put output files in this directory instead of overwriting the input files. Requires -n. -W, --write-unchanged-files Also write files even if no changes were required (useful with --output-dir); implies -w. --add-suffix=ADD_SUFFIX Append this string to all output filenames. Requires -n if non-empty. ex: --add-suffix='3' will generate .py3 files. This is the user interface for lib2to3. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: .Net Like Gui Builder for Python?
From the newbie point of view, VS is the perfect tool to get people coding. All the way back to Visual Basic, Microsoft has consistently pushed the ease of creating applications for Windows as a point of adoption. Hence Borland Delphi, and the now abandoned Kylix. Pascal has the Lazarus project, which builds on Delphi - so there is a point in integrating gui building in the RAD. /martin On 26 Jul 2014, TP wing...@gmail.com wrote: On Fri, Jul 25, 2014 at 7:40 PM, Chris Angelico ros...@gmail.com wrote: The OP asked for two things, which I'll separate because they're actually quite different. 1) Drag and drop widgets to create a window 2) Double-click a widget to edit its code (presumably event handler) I have used a number of GUI toolkits that did provide the first one, but the second is a lot more restrictive than you might think Not that I disagree with the overall point of just using a text editor (especially for Python GUIs) but apparently you've never created a C# WPF app using Visual Studio? WPF fully supports layout controls, is *not* generally pixel based it's more similar to HTML + CSS (although you do pixel perfect layout if you try), and still easily does (2). And while I almost exclusively use the Visual Studio XAML tab view rather than bothering with the Designer view you can drag drop if you really want to. And Microsoft's Expression Blend takes that to a whole 'nother level supposedly making it easy for even graphic designers to create GUIs without delving too much into raw code wrangling. One of the nice things about VIsual Studio and WPF (even in the XAML view) is its Properties window. This lets you select a control and see all the applicable possible properties and what legal choices you have for setting them. This is an incredible aid to discovering how to use said controls. And as far as any limitations of (2) goes, I still like using the Events view of the Properties window to initially hook up an event handler. This automatically creates a correctly (or at least consistently) named and argumented event handler and adds the proper attribute to the XAML. It is easy enough to then mess around with the generated code if that doesn't quite suit your needs. Having the list of possible event handlers all in one place instead of having to look up the doc is invaluable. And being able to press F1 just about anywhere and have the relevant document open up is even more so. As far as I've seen Visual Studio + WPF really is state of the art for GUI building. I wish more developers were familiar with all its capabilities so they could know what to whine for in their own programming environment :) -- https://mail.python.org/mailman/listinfo/python-list -- Sent with K-@ Mail - the evolution of emailing.-- https://mail.python.org/mailman/listinfo/python-list
Re: .Net Like Gui Builder for Python?
From the newbie point of view, VS is the perfect tool to get people coding. All the way back to Visual Basic, Microsoft has consistently pushed the ease of creating applications for Windows as a point of adoption. Hence Borland Delphi, and the now abandoned Kylix. Pascal has the Lazarus project, which builds on Delphi - so there is a point in integrating gui building in the RAD. /martin On 26 Jul 2014, TP wing...@gmail.com wrote: On Fri, Jul 25, 2014 at 7:40 PM, Chris Angelico ros...@gmail.com wrote: The OP asked for two things, which I'll separate because they're actually quite different. 1) Drag and drop widgets to create a window 2) Double-click a widget to edit its code (presumably event handler) I have used a number of GUI toolkits that did provide the first one, but the second is a lot more restrictive than you might think Not that I disagree with the overall point of just using a text editor (especially for Python GUIs) but apparently you've never created a C# WPF app using Visual Studio? WPF fully supports layout controls, is *not* generally pixel based it's more similar to HTML + CSS (although you do pixel perfect layout if you try), and still easily does (2). And while I almost exclusively use the Visual Studio XAML tab view rather than bothering with the Designer view you can drag drop if you really want to. And Microsoft's Expression Blend takes that to a whole 'nother level supposedly making it easy for even graphic designers to create GUIs without delving too much into raw code wrangling. One of the nice things about VIsual Studio and WPF (even in the XAML view) is its Properties window. This lets you select a control and see all the applicable possible properties and what legal choices you have for setting them. This is an incredible aid to discovering how to use said controls. And as far as any limitations of (2) goes, I still like using the Events view of the Properties window to initially hook up an event handler. This automatically creates a correctly (or at least consistently) named and argumented event handler and adds the proper attribute to the XAML. It is easy enough to then mess around with the generated code if that doesn't quite suit your needs. Having the list of possible event handlers all in one place instead of having to look up the doc is invaluable. And being able to press F1 just about anywhere and have the relevant document open up is even more so. As far as I've seen Visual Studio + WPF really is state of the art for GUI building. I wish more developers were familiar with all its capabilities so they could know what to whine for in their own programming environment :) -- https://mail.python.org/mailman/listinfo/python-list -- Sent with K-@ Mail - the evolution of emailing.-- https://mail.python.org/mailman/listinfo/python-list
Re: .Net Like Gui Builder for Python?
On Sat, Jul 26, 2014 at 5:19 PM, Martin S shieldf...@gmail.com wrote: From the newbie point of view, VS is the perfect tool to get people coding. All the way back to Visual Basic, Microsoft has consistently pushed the ease of creating applications for Windows as a point of adoption. IMO it's an attractive nuisance at best. Make it easy to build something simple and flawed, and people will build things that aren't simple but are still flawed. Microsoft has done this to the world a few times - how many people do you know who use Excel for jobs that would be better served by a database? (Or by a script, even; CSV import into one sheet, manual fixups as required, then CSV export from another sheet that has a bunch of formula cells. I've seen that done.) GUI builders, especially those with hey look you don't even need to write code event handlers, are often like that. Sure, you can make a simple Hello, world pretty easily. You can go one further and have a slider and an entry field whose contents are synchronized. But for building a large and complex application, they tend more to make the job harder than easier; and for people who've learned on that system and no other, it's but this works - what, I have to learn a whole new system now? That new system sucks. It's the same with everything. I did my first music transposition and composing with NoteWorthy Composer. It was alright, it got the job done. But when I wanted to do anything more complex than the authors planned for, I was stuck. Just adding additional verses to a hymn tune (music score at the top of the page, four more verses underneath) was impossible in NWC, so I ended up actually printing out the score, then physically putting the sheet of paper back in, and printing the additional verses from a word processor. With LilyPond, I can do additional verses easily, because the authors planned for it; but more importantly, I can also do things they didn't plan for, like putting lyric line breaks into the MIDI file without disrupting the printed score. (I had to write a little Scheme code to make that work.) If it comes to that, in a way, programming is all like that. Imagine buying a device and being allowed to run only the software that its makers provide. [1] If they think of lots of things, then great! You want to do something, and there's an app for that. But generally, a device is sold to more people than built it, and most likely (I'm definitely making assumptions here) the collective intelligence and creativity of the buyers exceeds that of the designers. So a smart designer will make it possible for the device to do more than he planned, by making it programmable. Sure, it's a bit harder to use than just touch this and stuff happens, but instead of finite, pre-coded functionality, you have infinite possibilities. Since we're all here on python-list, I think we all appreciate the value of being able to do what someone else didn't think of. I'm happy to have the same power-at-the-cost-of-effort in GUI building, too. ChrisA [1] This scenario is purely hypothetical. Any similarity with real products whose names begin with the mathematician's shorthand for the square root of -1 is purely coincidental. Anyway, I'm exaggerating for emphasis. Slightly. -- https://mail.python.org/mailman/listinfo/python-list
Re: .Net Like Gui Builder for Python?
Am 26.07.2014 11:05, schrieb Chris Angelico: IMO it's an attractive nuisance at best. Make it easy to build something simple and flawed, and people will build things that aren't simple but are still flawed. Microsoft has done this to the world a For most software/tools that's good enough. It's better to have this than having nothing. Sure, when you have a look at the VB-created programs, most of them are flawed, but still they solve problems. Currently, Python is ruled out as tool in many situations due to the steep learning curve when it comes to GUIs, so people use Excel, Labview, Matlab or whatever (or nothing at all or still VB). But for building a large and complex application, they tend more to make the job harder than easier; and for people who've learned on that system Most problems that are out there to be adressed require only simple applications. For anything non-trivial I don't see that a GUI-builder, I agree that hand-coding the GUI is the better approach. But then, we're now in a world where e.g. Qt is moving away from widgets to QML which makes GUI programming a huge mess (in the same way that PHP made web-programming a mess). and no other, it's but this works - what, I have to learn a whole new system now? That new system sucks. What is the point of not having tools to ease the entry? Of course it makes the others, who still learned it, feel cool, but other than that? Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: .Net Like Gui Builder for Python?
On Sat, Jul 26, 2014 at 8:14 PM, Dietmar Schwertberger maill...@schwertberger.de wrote: For most software/tools that's good enough. It's better to have this than having nothing. Sure, when you have a look at the VB-created programs, most of them are flawed, but still they solve problems. Currently, Python is ruled out as tool in many situations due to the steep learning curve when it comes to GUIs, so people use Excel, Labview, Matlab or whatever (or nothing at all or still VB). That's exactly what I mean by attractive nuisance. Excel appears to solve your problem, so you use it, and then as the problem shifts, your spreadsheet gets more and more complicated, until it appears on The Daily WTF. Is that really a good thing? I mean, you could have started with pencil and paper, and that would have been even easier. The only difference is that you outgrow paper sooner than VB, which means porting is done on a much smaller code-base and is less of a problem. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: .Net Like Gui Builder for Python?
On 26 Jul 2014 12:16, Dietmar Schwertberger maill...@schwertberger.de wrote: Am 26.07.2014 11:05, schrieb Chris Angelico: IMO it's an attractive nuisance at best. Make it easy to build something simple and flawed, and people will build things that aren't simple but are still flawed. Microsoft has done this to the world a For most software/tools that's good enough. It's better to have this than having nothing. Sure, when you have a look at the VB-created programs, most of them are flawed, but still they solve problems. And it gets people coding, adding to existing software and thinking about how to improve stuff (their own or others) in the future. Also if you look at any newbie programmer software, it's flawed. But it wouldn't hurt making it easier creating flawed software. Better than less software (unless it it's malware) /martin -- https://mail.python.org/mailman/listinfo/python-list
Re: .Net Like Gui Builder for Python?
Martin S shieldf...@gmail.com wrote: Also if you look at any newbie programmer software, it's flawed. But it wouldn't hurt making it easier creating flawed software. Better than less software (unless it it's malware) Malware is rarely flawed. I wish it were, though. -- https://mail.python.org/mailman/listinfo/python-list
Re: .Net Like Gui Builder for Python?
Am 26.07.2014 12:25, schrieb Chris Angelico: The only difference is that you outgrow paper sooner than VB, which means porting is done on a much smaller code-base and is less of a problem. Most Excel or VB based tools are never replaced. They are the replacement and final implementation of the paper solution already. The world would be a better one if Python was chosen instead of Excel for implementation, offering a continuous path for improvement, but that won't happen without an easy-to-use GUI builder. (Even though many problems could be addressed without a GUI, it's still what people want.) Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Online Python Channel
To whom it may concern We at Eyn2k (Everything you need to know) have dedicated our time to create a free educational channel. Our first subject being Python Programming. Soon excercises will be added, progressing to a graphics calculator and 2D vector collisions. Would it be possible to get a mention of our channel somewhere on your google+ page or python.org? We are taking requests for tutorials and excercises. Thank you for your time eyn2k@outlook.comhttps://www.youtube.com/channel/UCad91ea17ynqc0cTokBG3bg/feedhttps://plus.google.com/u/0/115589514656500200774https://www.facebook.com/EYN2K -- https://mail.python.org/mailman/listinfo/python-list
Re: .Net Like Gui Builder for Python?
On Sat, 26 Jul 2014 10:51:31 +, Sturla Molden wrote: Martin S shieldf...@gmail.com wrote: Also if you look at any newbie programmer software, it's flawed. But it wouldn't hurt making it easier creating flawed software. Better than less software (unless it it's malware) Malware is rarely flawed. I wish it were, though. Malware is often buggy. Sometimes so buggy it doesn't even do the job it is intended to. Viruses crash. Even the most technologically sophisticated virus yet discovered in the wild was buggy: Stuxnet was only discovered because of a programming error. https://en.wikipedia.org/wiki/Stuxnet -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Best place to find sample data
Hey I need some sample data to test out and do stuff with. Also I am having strange errors with idle when i load a .txt file read it and then print it, idle crashes well kind of freezes. Not sure what is wrong here. Also I am having troubles with Numpy and its loadtxt function: ValueError: cannot set an array element with a sequence So all i need is a good site to download some data from and maybe some fixes for these problems. -- https://mail.python.org/mailman/listinfo/python-list
Re: Best place to find sample data
On 26-7-2014 15:41, Nicholas Cannon wrote: Hey I need some sample data to test out and do stuff with. Also I am having strange errors with idle when i load a .txt file read it and then print it, idle crashes well kind of freezes. Not sure what is wrong here. Also I am having troubles with Numpy and its loadtxt function: ValueError: cannot set an array element with a sequence So all i need is a good site to download some data from and maybe some fixes for these problems. First hit when googling for 'testdata generator site': http://www.generatedata.com/ The search produces various other useful looking sites. The numpy one is probably a typo in your code, please show the offending code. No idea about your idle problem. Irmen -- https://mail.python.org/mailman/listinfo/python-list
Re: Best place to find sample data
On 07/26/2014 09:57 AM, Irmen de Jong wrote: On 26-7-2014 15:41, Nicholas Cannon wrote: Hey I need some sample data to test out and do stuff with. Also I am having strange errors with idle when i load a .txt file read it and then print it, idle crashes well kind of freezes. Not sure what is wrong here. Also I am having troubles with Numpy and its loadtxt function: ValueError: cannot set an array element with a sequence So all i need is a good site to download some data from and maybe some fixes for these problems. First hit when googling for 'testdata generator site': http://www.generatedata.com/ The search produces various other useful looking sites. Another option, driven by python... https://github.com/joke2k/faker -- https://mail.python.org/mailman/listinfo/python-list
Return class.
Hi, What does return Wrapper do in the following piece of code? Which method does it invoke? I mean return Wrapper invokes __init__ method? def Tracer(aClass): class Wrapper: def __init__(self, *args, **kargs): self.fetches = 0 self.wrapped = aClass(*args, **kargs) def __getattr__(self, attrname): print('Trace: ' + attrname) self.fetches += 1 print(self.fetches) return getattr(self.wrapped, attrname) return Wrapper Actual program: def Tracer(aClass): class Wrapper: def __init__(self, *args, **kargs): self.fetches = 0 self.wrapped = aClass(*args, **kargs) def __getattr__(self, attrname): print('Trace: ' + attrname) self.fetches += 1 print(self.fetches) return getattr(self.wrapped, attrname) return Wrapper @Tracer class Spam: def __init__(self, *args): print(*args) def display(self): print('Spam!' * 8) @Tracer class Person: def __init__(self, name, hours, rate): self.name = name self.hours = hours self.rate = rate def pay(self): return self.hours * self.rate food = Spam(CARST) food.display() print([food.fetches]) bob = Person('Bob', 40, 50) print(bob.name) print(bob.pay()) print('') sue = Person('Sue', rate=100, hours=60) print(sue.name) print(sue.pay()) print(bob.name) print(bob.pay()) print([bob.fetches, sue.fetches]) -- https://mail.python.org/mailman/listinfo/python-list
Re: Return class.
On Sun, Jul 27, 2014 at 4:29 AM, Satish ML satishmlwiz...@gmail.com wrote: What does return Wrapper do in the following piece of code? Which method does it invoke? I mean return Wrapper invokes __init__ method? def Tracer(aClass): class Wrapper: def __init__(self, *args, **kargs): self.fetches = 0 self.wrapped = aClass(*args, **kargs) def __getattr__(self, attrname): print('Trace: ' + attrname) self.fetches += 1 print(self.fetches) return getattr(self.wrapped, attrname) return Wrapper It doesn't invoke anything. It returns the class itself - a callable, subclassable thing, which wraps the passed-in class. When it's used as a decorator, what happens is that first the basic class gets constructed, then it gets passed to this function, and whatever this function returns becomes the resulting class. So, taking the simplest example: @Tracer class Spam: def __init__(self, *args): print(*args) def display(self): print('Spam!' * 8) This is like doing this: class Spam: def __init__(self, *args): print(*args) def display(self): print('Spam!' * 8) Spam = Tracer(Spam) And then Tracer begins executing, with the Spam class as aClass. It constructs a new class with two methods: an __init__ which passes everything through to the wrapped class and retains the resulting object, and a __getattr__ which proxies through to the original with tracing facilities. But all it does is construct and return that class. It doesn't call anything, yet. Calling the class (instantiating an object of it) happens when the Spam(CARST) call happens; instead of calling the original Spam class, it calls the special wrapper, which then calls on the original. You can look up class decorators in the Python docs; they're not something you'll use often (and they're something you'll write even less often), but they can give you a lot of flexibility. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Return class.
Which line of code is printing [4] and [4, 5, 6, 7] in the output? from tracer import Tracer @Tracer class MyList(list): def __init__(self, *args): print(INSIDE MyList) print(*args) x = MyList([1, 2, 3]) x.append(4) print(x.wrapped) WrapList = Tracer(list) x = WrapList([4, 5, 6]) x.append(7) print(x.wrapped) OUTPUT: CARST Trace: display 1 Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam! [1] Trace: name 1 Bob Trace: pay 2 2000 Trace: name 1 Sue Trace: pay 2 6000 Trace: name 3 Bob Trace: pay 4 2000 [4, 2] INSIDE MyList [1, 2, 3] Trace: append 1 [4] Trace: append 1 [4, 5, 6, 7] -- https://mail.python.org/mailman/listinfo/python-list
Re: Return class.
Which line of code is printing [4] and [4, 5, 6, 7] in the output? from tracer import Tracer @Tracer class MyList(list): def __init__(self, *args): print(INSIDE MyList) print(*args) x = MyList([1, 2, 3]) x.append(4) print(x.wrapped) WrapList = Tracer(list) x = WrapList([4, 5, 6]) x.append(7) print(x.wrapped) OUTPUT: CARST Trace: display 1 Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam! [1] Trace: name 1 Bob Trace: pay 2 2000 Trace: name 1 Sue Trace: pay 2 6000 Trace: name 3 Bob Trace: pay 4 2000 [4, 2] INSIDE MyList [1, 2, 3] Trace: append 1 [4] Trace: append 1 [4, 5, 6, 7] -- https://mail.python.org/mailman/listinfo/python-list
Re: Return class.
Which line of code is printing [4] and [4, 5, 6, 7] in the output? from tracer import Tracer @Tracer class MyList(list): def __init__(self, *args): print(INSIDE MyList) print(*args) x = MyList([1, 2, 3]) x.append(4) print(x.wrapped) WrapList = Tracer(list) x = WrapList([4, 5, 6]) x.append(7) print(x.wrapped) OUTPUT: CARST Trace: display 1 Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam! [1] Trace: name 1 Bob Trace: pay 2 2000 Trace: name 1 Sue Trace: pay 2 6000 Trace: name 3 Bob Trace: pay 4 2000 [4, 2] INSIDE MyList [1, 2, 3] Trace: append 1 [4] Trace: append 1 [4, 5, 6, 7] -- https://mail.python.org/mailman/listinfo/python-list
Re: Return class.
On Sun, Jul 27, 2014 at 5:04 AM, Satish ML satishmlwiz...@gmail.com wrote: Which line of code is printing [4] and [4, 5, 6, 7] in the output? These lines: print(x.wrapped) The .wrapped attribute has the wrapped object, so you're printing out the thing that would be in x if you weren't using the decorator. Since that's a subclass of list and doesn't change __str__ or __repr__, it prints out like a list. Tip: If you're not sure what line produces what output, tag them all. Instead of print(x.wrapped), put print(1,x.wrapped), and have a different number on every line of output. Then you'll easily see which is which. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Return class.
Actual program: def Tracer(aClass): class Wrapper: def __init__(self, *args, **kargs): self.fetches = 0 self.wrapped = aClass(*args, **kargs) def __getattr__(self, attrname): print('Trace: ' + attrname) self.fetches += 1 print(self.fetches) return getattr(self.wrapped, attrname) return Wrapper @Tracer class Spam: def __init__(self, *args): print(*args) def display(self): print('Spam!' * 8) @Tracer class Person: def __init__(self, name, hours, rate): self.name = name self.hours = hours self.rate = rate def pay(self): return self.hours * self.rate food = Spam(CARST) food.display() print([food.fetches]) bob = Person('Bob', 40, 50) print(bob.name) print(bob.pay()) print('') sue = Person('Sue', rate=100, hours=60) print(sue.name) print(sue.pay()) print(bob.name) print(bob.pay()) print([bob.fetches, sue.fetches]) Which line of code is printing [4] and [4, 5, 6, 7] in the output? Another module. from tracer import Tracer @Tracer class MyList(list): def __init__(self, *args): print(INSIDE MyList) print(*args) x = MyList([1, 2, 3]) x.append(4) print(x.wrapped) WrapList = Tracer(list) x = WrapList([4, 5, 6]) x.append(7) print(x.wrapped) OUTPUT: CARST Trace: display 1 Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam! [1] Trace: name 1 Bob Trace: pay 2 2000 Trace: name 1 Sue Trace: pay 2 6000 Trace: name 3 Bob Trace: pay 4 2000 [4, 2] INSIDE MyList [1, 2, 3] Trace: append 1 [4] Trace: append 1 [4, 5, 6, 7] -- https://mail.python.org/mailman/listinfo/python-list
Re: Return class.
Hi, Which lines of code prints [4] and [4, 5, 6, 7] in the output? Output: CARST Trace: display 1 Spam!Spam!Spam!Spam!Spam!Spam!Spam!Spam! [1] Trace: name 1 Bob Trace: pay 2 2000 Trace: name 1 Sue Trace: pay 2 6000 Trace: name 3 Bob Trace: pay 4 2000 [4, 2] INSIDE MyList [1, 2, 3] Trace: append 1 [4] Trace: append 1 [4, 5, 6, 7] Actual Code: def Tracer(aClass): class Wrapper: def __init__(self, *args, **kargs): self.fetches = 0 self.wrapped = aClass(*args, **kargs) def __getattr__(self, attrname): print('Trace: ' + attrname) self.fetches += 1 print(self.fetches) return getattr(self.wrapped, attrname) return Wrapper @Tracer class Spam: def __init__(self, *args): print(*args) def display(self): print('Spam!' * 8) @Tracer class Person: def __init__(self, name, hours, rate): self.name = name self.hours = hours self.rate = rate def pay(self): return self.hours * self.rate food = Spam(CARST) food.display() print([food.fetches]) bob = Person('Bob', 40, 50) print(bob.name) print(bob.pay()) print('') sue = Person('Sue', rate=100, hours=60) print(sue.name) print(sue.pay()) Another module that is producing output: from tracer import Tracer @Tracer class MyList(list): def __init__(self, *args): print(INSIDE MyList) print(*args) x = MyList([1, 2, 3]) x.append(4) print(x.wrapped) WrapList = Tracer(list) x = WrapList([4, 5, 6]) x.append(7) print(x.wrapped) -- https://mail.python.org/mailman/listinfo/python-list
Full stack python should be linked on python.org
Hi! Anyone shares my opinion that www.fullstackpython.com should be referenced here https://www.python.org/about/apps or at least here https://wiki.python.org/moin/WebProgramming ? What do you think? It's great source for python web newbies (and not only). -- Tymoteusz Jankowski tel. 698 142 927 email: tymoteusz.jankow...@gmail.com email do efaktur: tymoteusz.jankowski+...@gmail.com Jeśli wysyłasz mi pliki biurowe (dokumenty, arkusze, prezentacje..), upewnij się, że są one w formatach międzysystemowych takich jak: .ODT, .ODS, .ODP. Wszystkie wspomniane formaty można uzyskać dzięki darmowym pakietom biurowym LibreOffice http://www.libreoffice.org/download/, OpenOffice http://www.openoffice.org/download/. Formaty te są obsługiwane przez większość pakietów biurowych i programów. If you send me office files, please make sure they are in a cross-platform format. For editing this means: .ODT, .ODS and .ODP. All of them can be made by LibreOffice http://www.libreoffice.org/download/, OpenOffice http://www.openoffice.org/download/ and most other Office Suites and programs. -- https://mail.python.org/mailman/listinfo/python-list
Re: Best place to find sample data
On Sat, 26 Jul 2014 06:41:11 -0700, Nicholas Cannon wrote: Hey I need some sample data to test out and do stuff with. When I want sample data I usually write a python script to generate it. Also I am having strange errors with idle when i load a .txt file read it and then print it, idle crashes well kind of freezes. Missing libraries? Bad characters in the text file? Not sure what is wrong here. Also I am having troubles with Numpy and its loadtxt function: ValueError: cannot set an array element with a sequence How about showing us the code concerned, and the text that's being loaded. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Best place to find sample data
On Saturday, July 26, 2014 9:41:11 PM UTC+8, Nicholas Cannon wrote: Also I am having troubles with Numpy and its loadtxt function: ValueError: cannot set an array element with a sequence I found out why this has occurred because the csv file i was using didnt have a consistent amount of values in each line so when the load text tried to load it into a list or whatever some lines had a missing index or something. -- https://mail.python.org/mailman/listinfo/python-list
Re: Best place to find sample data
Oh the above is quoted here just the bottom line in added in -- https://mail.python.org/mailman/listinfo/python-list
What's the difference between gevent.sleep and time.sleep?
Hi, I'm learning gevent, but I didn't found the difference with gevent.sleep and time.sleep, does anybody could give me a sample code to show their difference? Thanks! -- https://mail.python.org/mailman/listinfo/python-list
Re: .Net Like Gui Builder for Python?
On Sat, 26 Jul 2014 14:40:56 -0400, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Sat, 26 Jul 2014 19:05:21 +1000, Chris Angelico ros...@gmail.com declaimed the following: IMO it's an attractive nuisance at best. Make it easy to build something simple and flawed, and people will build things that aren't simple but are still flawed. Microsoft has done this to the world a few times - how many people do you know who use Excel for jobs that would be better served by a database? (Or by a script, even; CSV import into one sheet, manual fixups as required, then CSV export from another sheet that has a bunch of formula cells. I've seen that done.) The way they package Office doesn't help... Ignoring the subscription-based Office 365 I was at Best Buy a few weeks ago... The only local-install version of Office (HomeOffice I think) had Word, Excel, and PowerPoint. How many /home/ users are creating presentations/slide-shows? Drop PowerPoint and include Access (which is essentially a GUI builder front-end for the Jet RDBM engine) and Publisher (seems a home user would do more with invitations, cards, and maybe reports/brochures)! The one thing that isn't available with LibreOffice is OneNote, which you don't seem to be able to get separately, and doesn't seem to have any documentation (ie 3rd party books on it). But there is Evernote. -- Steve Hayes from Tshwane, South Africa Web: http://www.khanya.org.za/stevesig.htm Blog: http://khanya.wordpress.com E-mail - see web page, or parse: shayes at dunelm full stop org full stop uk -- https://mail.python.org/mailman/listinfo/python-list
[issue22047] argparse improperly prints mutually exclusive options when they are in a group
paul j3 added the comment: This patch adds a class TestMutuallyExclusiveGroupErrors test_invalid_add_group() test, closely modeled on test_invalid_add_argument() I'm using ValueError in group add methods (maintaining the similarity with add_argument errors). I haven't changed the documentation. add_argument_group and add_mutually_exclusive_group methods are described as belonging to an ArgumentParser, and the examples are consistent with that. An admonition against nesting groups would not fit with the current flow. However to be accurate, these methods belong to _ActionsContainer, the parent class for both the parser and groups. The documentation glosses over this detail. So an alternative way of addressing this issue is to move these 2 methods to the ArgumentParser class. -- Added file: http://bugs.python.org/file36100/issue22047_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22047 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22068] test_gc fails after test_idle
Terry J. Reedy added the comment: ConfigDialog is a good guess as I added a minimal test this month. I will try to revise to not create loops in the first place. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22068 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3982] support .format for bytes
Terry J. Reedy added the comment: http://legacy.python.org/dev/peps/pep-0461/ adds % formatting for bytes and bytes array. Nick, I have the impression that there was a decision to not add bytes.format. Correct? If so, this issue should be closed. If not, what, if anything, has been decided? -- nosy: +ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3982 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3982] support .format for bytes
Nick Coghlan added the comment: Right, bytes.format was considered as part of the PEP 461 discussions, and rejected as an operation that only made sense in the text domain: http://www.python.org/dev/peps/pep-0461/#proposed-variations With PEP 461 accepted, and PEP 460 withdrawn, that means we won't be adding bytes.format and bytearray.format. Issue 20284 covers the implementation of PEP 461. -- resolution: - wont fix stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3982 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20284] patch to implement PEP 461 (%-interpolation for bytes)
Nick Coghlan added the comment: Just noting I'm working on some significant updates to the bytes and bytearray docs in issue 21777. I'll try to get that ready for review and merged relatively soon, so the docs for this can build on top of those changes. -- nosy: +ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20284 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21777] Separate out documentation of binary sequence methods
Nick Coghlan added the comment: OK, I've completed the initial pass through all the methods. Remaining items: * add back the guarantees where str will return the same object, add those guarantees for bytes where applicable * address the review comments from Zach and Ezio There are a couple of review comments about removing duplication that I'd like to skip addressing for now. I think they're reasonable ideas, but I also think it's a lot easier to go wrong with DRY in docs than it is in code. Indeed, this whole matter of not documenting the bytes behaviour in the first place was a matter of assuming folks could just infer the binary behaviour from the text behaviour. -- Added file: http://bugs.python.org/file36101/separate_binary_sequence_docs_v4.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21777 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17172] Add turtledemo to IDLE menu
Ned Deily added the comment: Here are some review comments on turtle_demo_v2.patch. First, the subprocess call to start turtledemo may work ok in your build directory but it will not work in general. Using the standard idiom for invoking a new process running the current instance of python, the call should look something like: cmd = [sys.executable, '-c', 'from turtledemo.__main__ import main; main()'] p = subprocess.Popen(cmd) Also, note that the imp module is deprecated in 3.4 in favor of importlib: https://docs.python.org/dev/library/imp.html#imp.find_module I'm not sure there is much point in having this test, though. The only thing it would catch is if some third-party distributor decided to move turtledemo into a separate package or not ship it altogether. It would not work for 2.7, even if Demo/turtle was shipped, since, in 2.7, turtledemo is not structured as an importable package. (And, to answer Terry's earlier question: no, the Demo directory is also not shipped with the python.org OS X installers for 2.7. I expect that the standard practice among Unix distributors would also be not to ship it by default; for one thing, they have to figure out where to install it since we don't provide a standard location to do so. I see that Debian does package up Demo into an optional python2.7-examples Debian package. So there seems to be no point in applying this change to 2.7 without also backporting the turtledemo repackaging done in 3.x and that would be a larger undertaking needing discussion and approval.) (Ah, but looking at current Debian and Ubuntu, for Python 3.4 I see that they have packaged turtledemo as part of their optional 'libpython3.4-testsuite' source package. Plus, they have long packaged IDLE separately ('idle-python3.4'). That means end users will need to ensure both packages are installed to be able to use turtledemo with IDLE. So I guess that says that there *is* a point to the import test. Ugh. I'm not sure what other popular distributions do.) Then there is a specific and serious usability problem with this feature on OS X. The subprocess call starts a new process with a second Python interpreter to run a second Tcl/Tk instance to run turtledemo next to IDLE. The turtledemo appears *but* the keyboard and mouse focus remains on IDLE which also means that the IDLE menu remains active (recall that there is only one menu bar on OS X and it shows only the menus from the currently focused GUI application). Especially with the proposed menu changes in Issue22065, it would be very confusing to the novice user to see the turtledemo window appear, possibly covering any IDLE windows, but with the IDLE menu still active and keyboard/mouse focus still on IDLE. It turns out to be a bit tricky to reliably activate tbe turtledemo application programmatically from Python code without resorting to some hacks. Here is one hack, making use of a bit of AppleScript, that seems to work. It would need to be tested in non-English OS X en vironments to make sure it works there also. diff Lib/turtledemo/__main__.py --- a/Lib/turtledemo/__main__.pyFri Jul 25 15:01:18 2014 -0700 +++ b/Lib/turtledemo/__main__.pyFri Jul 25 22:43:58 2014 -0700 @@ -69,6 +69,7 @@ import sys import os +import subprocess from tkinter import * from idlelib.Percolator import Percolator @@ -111,6 +112,20 @@ self.root = root = turtle._root = Tk() root.title('Python turtle-graphics examples') root.wm_protocol(WM_DELETE_WINDOW, self._destroy) +if sys.platform == 'darwin': +# Make sure we are the currently activated OS X application +# so that our menu bar appears. +p = subprocess.Popen( +[ +'osascript', +'-e', 'tell application System Events', +'-e', 'set frontmost of the first process whose ' + 'unix id is {} to true'.format(os.getpid()), +'-e', 'end tell', +], +stderr=subprocess.DEVNULL, +stdout=subprocess.DEVNULL, +) root.grid_rowconfigure(0, weight=1) root.grid_columnconfigure(0, weight=1) There are deprecated OS X Carbon interfaces to do the equivalent, as was used in the third-party package appscript. I'm noseying Ronald to see if he has any better suggestions for a non-deprecated way to do this (via Cocoa perhaps) and that could possibly be made available more generally: IDLE itself could benefit from it and would be a better solution than what was used in Issue11571. I have not tried the patch on Windows or X11 Tk to see if there are similar usability issues. If so, it's possible the wm attribtues . -topmost dance, as in Issue11571, might help. And last, Lita, please don't forget to run make patchcheck before uploading a
[issue19776] Provide expanduser() on Path objects
Claudiu Popa added the comment: Here's a version of the patch which raises ValueError when the path can't be expanded. Hopefully, the used approach is good enough. -- Added file: http://bugs.python.org/file36102/issue19776_4.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19776 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16535] json encoder unable to handle decimal
Changes by Ralph Heinkel r...@ralph-heinkel.com: -- nosy: +christian.heimes ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16535 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1152248] Add support for reading records with arbitrary separators to the standard IO stack
Changes by Phil Connell pconn...@gmail.com: -- nosy: +pconnell ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1152248 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22076] csv module bad grammar in exception message
New submission from Martin Matusiak: The csv module has an exception message with bad grammar: - delimiter must be an 1-character string an should be a -- components: Library (Lib) files: csv_grammar_fix.diff keywords: patch messages: 224028 nosy: haypo, numerodix, serhiy.storchaka priority: normal severity: normal status: open title: csv module bad grammar in exception message type: enhancement versions: Python 3.5 Added file: http://bugs.python.org/file36103/csv_grammar_fix.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22076 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22077] Improve the error message for various sequences
New submission from Claudiu Popa: For a couple of sequences (bytes, list, tuple, bytearray), the error when using an invalid sequence index is misleading, because it says that only integers are allowed, while slices are allowed too. a = [] a['python'] Traceback (most recent call last): File stdin, line 1, in module TypeError: list indices must be integers, not str For instance, here's how range does it: range(1)['a'] Traceback (most recent call last): File stdin, line 1, in module TypeError: range indices must be integers or slices, not str The attached patch improves these error messages. -- files: proper_error.patch keywords: patch messages: 224029 nosy: Claudiu.Popa priority: normal severity: normal status: open title: Improve the error message for various sequences type: enhancement versions: Python 3.5 Added file: http://bugs.python.org/file36104/proper_error.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22077 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22012] struct.unpack('?', '\x02') returns (False,) on Mac OSX
Ronald Oussoren added the comment: Does anyone have feedback for my proposed patch (other the bug in test code when sizeof(bool) != 1, the test values for big and little endian are in the wrong order)? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22012 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15730] Silence unused value warnings under Mac OS X 10.8/clang
Changes by Ronald Oussoren ronaldousso...@mac.com: -- versions: +Python 3.5 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15730 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21308] PEP 466: backport ssl changes
Christian Heimes added the comment: Awesome! :) I'll try to find some time to check your work when I'm back from EuroPython. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21308 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16535] json encoder unable to handle decimal
Christian Heimes added the comment: I'm EuroPython 2014 in Berlin. Ralph has approached me and asked me about progress on the progress of this patch. I'm reluctant to implement a special case for decimals for two reasons: 1) JSON just support floats and decimals are IMHO incompatible with floats. The conversion of decial to JSON floats is a loosely operation. 2) Rather than having a special case I would rather go with a general implementation that uses an ABC to JSON dump some float-like objects. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16535 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22068] test_gc fails after test_idle
Serhiy Storchaka added the comment: Here is a patch against 2.7 which get rid of reference loops in Tk variables and Font. This will fix not only ConfigDialog, but any similar user code. In 3.4+ such reference loops are successfully resolved, but I think we should foreport this path to 3.4+ because it also fixes other minor bug: callbacks registered to trace variable now live while the variable lives, not while widget lives. -- assignee: - serhiy.storchaka components: +Tkinter stage: - patch review Added file: http://bugs.python.org/file36105/tkinter_refloops-2.7.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22068 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19325] _osx_support imports many modules
Ronald Oussoren added the comment: The use of context lib in _read_output should not be necessary anymore as file objects and NamedTemporaryFile objects already are context managers with the right semantics. I'm not sure how to avoid the import of tempfile other than adding a minimal implementation of tempfile.mkstemp to _osx_support, in particular because the fallback code in _osx_support is insecure: It uses a named temporary file in /tmp with builtin.open and because the name of the file is predictable there is a small risk of overwriting arbitrary files when an attacker has access to /tmp. I guess the fallback is there to use during bootstrap, it should really be avoided afterwards. BTW. A small unscientific test on my laptop didn't see any differences between the regular _osx_support and a version where import re was moved inside the functions that use that module. But: that's on a fast laptop with SSD for storage, there could easily be a difference on systems with slower storage. Ned: do you remember what your idea was w.r.t. avoid the use of re? I guess its easy enough to replace the current re-using code by code that only uses str methods, but your phrasing seems to indicate another plan. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19325 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15398] intermittence on UnicodeFileTests.test_rename at test_pep277 on MacOS X
Ronald Oussoren added the comment: I'd be in favour of closing this issue, I haven't seen the problem in a while and it is almost certainly due to a platform bug on OSX 10.6. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15398 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10964] Mac installer need not add things to /usr/local
Ronald Oussoren added the comment: There'd still need to be some way to update the shell environment, but I agree that there needs to be something better than we have now. One option is to add a small shell script that can be sourced from the shell profile and adds the various python frameworks at the right place in sys.path (dynamically checks what's there instead of hardcoding a version in the command file we now use). A nice option to add is to optionally use a configuration file in ~/Library/Python to control the order in which directories are added to have some control on which version of python is used when starting it without a full version. There would then also need to be a script that manages that configuration file. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10964 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19776] Provide expanduser() on Path objects
Serhiy Storchaka added the comment: Here is alternative patch which doesn't use os.path.expanduser() and reimplement it's logic. Differences: * expanduser() is part of concrete path API. This method access environment. * RuntimeError is raised when user home can't be determined. * Currently ntpath.expanduser() uses heuristic to expand path with specified username. This works with default homedirs but can return wrong result when homedirs was moved to different locations. WindowsPath.expanduser() also uses heuristic, but more robust. Of course it would be better to get other users homedirs from Windows API, and perhaps we should defer this issue until implementing pwd or like on Windows. * Expanded tests. Interesting, common idiom to escape tilda in relative path (adding ./ prefix) doesn't work with pathlib, because . components are ignored. -- Added file: http://bugs.python.org/file36106/pathlib_expanduser.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19776 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22076] csv module bad grammar in exception message
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: -serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22076 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12243] getpass.getuser works on OSX
Ronald Oussoren added the comment: The issue still is present, wouldn't it be better to just remove the availability annotation from the docs (2.7, 3.4 and trunk) while waiting for a better solution? That would at least remove confusion for these docs. At the very least the Macintosh availability note should be removed, that was used to document that a function is available on MacOS 9, which hasn't been supported in a long time now. -- nosy: +ronaldoussoren versions: +Python 3.4, Python 3.5 -Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12243 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19776] Provide expanduser() on Path objects
Claudiu Popa added the comment: Looks good. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19776 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22078] io.BufferedReader hides ResourceWarnings when garbage collected
New submission from Claudiu Popa: Given the following example, Python 3.5 doesn't emit any resource warning: import io, gc f = open(a) bufio = io.BufferedReader(f) gc.collect() Here's a small patch that enables this. -- components: IO files: buffered_io_resource_warning.patch keywords: patch messages: 224040 nosy: Claudiu.Popa priority: normal severity: normal status: open title: io.BufferedReader hides ResourceWarnings when garbage collected type: behavior versions: Python 3.5 Added file: http://bugs.python.org/file36107/buffered_io_resource_warning.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22078 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22078] io.BufferedReader hides ResourceWarnings when garbage collected
Serhiy Storchaka added the comment: All works to me. $ ./python -Wall -c open('/dev/null', 'rb') -c:1: ResourceWarning: unclosed file _io.BufferedReader name='/dev/null' -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22078 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22068] test_gc fails after test_idle
STINNER Victor added the comment: I agree that the patch shoukd also br applied to 3.4. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22068 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22078] io.BufferedReader hides ResourceWarnings when garbage collected
Claudiu Popa added the comment: That's not the same, try with my example. open(a) will be a TextIOWrapper. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22078 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21308] PEP 466: backport ssl changes
Nick Coghlan added the comment: Thanks for working through this! I've kicked it in the direction of the Fedora Python SIG folks (https://lists.fedoraproject.org/pipermail/python-devel/2014-July/000611.html), since it would be good if we could get it tested before it makes its way into an upstream release. -- nosy: +bkabrda ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21308 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22078] io.BufferedReader hides ResourceWarnings when garbage collected
Claudiu Popa added the comment: I mean this one: $ python_d -Wall -c f=open('a', 'r'); import io; io.BufferedReader(f) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22078 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22078] io.BufferedReader hides ResourceWarnings when garbage collected
Serhiy Storchaka added the comment: This example is not correct. 1) Argument of BufferedReader should be binary stream. import io, gc f = open('/dev/null') bufio = io.BufferedReader(f) bufio.read(1) Traceback (most recent call last): File stdin, line 1, in module AttributeError: '_io.TextIOWrapper' object has no attribute 'readinto' 2) gc.collect() doesn't collect file streams because references to them are saved in local variables. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22078 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22078] io.BufferedReader hides ResourceWarnings when garbage collected
Claudiu Popa added the comment: You're right, thanks for the new information. You can close the issue then. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22078 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22078] io.BufferedReader hides ResourceWarnings when garbage collected
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - not a bug stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22078 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19875] test_getsockaddrarg occasional failure
koobs added the comment: Thank you for taking care of this Charles-François :) Requesting backport to 3.3 and 2.7 too please, both are open for fixes. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19875 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22079] Ensure in PyType_Ready() that base class of static type is static
New submission from Serhiy Storchaka: It would be good if PyType_Ready() will check that base class of static type is static. -- components: Interpreter Core messages: 224049 nosy: alex, haypo, serhiy.storchaka priority: normal severity: normal stage: needs patch status: open title: Ensure in PyType_Ready() that base class of static type is static type: enhancement versions: Python 2.7, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22079 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22080] Add windows_helper module helper
New submission from Claudiu Popa: Hi. This patch adds a new test helper module, initially added in issue21518, for controlling various aspects on Windows platform, like acquiring / releasing privileges etc. At the same time, it contains a modification in test.support.skip_unless_symlink, so that it tries to acquire the privilege, failing otherwise. The only downside is that acquiring SeCreateSymbolicLinkPrivilege is only possible for admins and it seems to be that they have the privilege by default. On the other hand, for SeBackupPrivilege must be explicitly acquired, so the purpose of this module isn't redundant. The part of acquiring a privilege using ctypes is based on similar code by Jason R. Coombs. -- components: Tests files: windows_helper.patch keywords: patch messages: 224050 nosy: Claudiu.Popa, zach.ware priority: normal severity: normal status: open title: Add windows_helper module helper type: enhancement versions: Python 3.5 Added file: http://bugs.python.org/file36108/windows_helper.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22080 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21518] Expose RegUnloadKey in winreg
Changes by Claudiu Popa pcmantic...@gmail.com: -- dependencies: +Add windows_helper module helper ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21518 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19875] test_getsockaddrarg occasional failure
Roundup Robot added the comment: New changeset 57e3c4ae37ea by Charles-François Natali in branch '2.7': Issue #19875: Fix random test_getsockaddrarg() failure. http://hg.python.org/cpython/rev/57e3c4ae37ea -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19875 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19875] test_getsockaddrarg occasional failure
Charles-François Natali added the comment: Backported to 2.7 (don't know how Iforgot it). 3.3 is only open for security issues, so not backporting. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19875 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22081] Backport repr(socket.socket) from Python 3.5 to Python 2.7
New submission from STINNER Victor: Currently, the C module _socket has an useful representation of socket: it gives the file descriptor, family, type, etc. The Python socket module only shows the memory address. Example: $ ./python -c 'import _socket; s=_socket.socket(); print(repr(s));' socket object, fd=3, family=2, type=1, protocol=0 $ ./python -c 'import socket; s=socket.socket(); print(repr(s));' socket._socketobject object at 0x7fad1fdcbba0 I propose to backport repr(socket.socket) from Python 3.5 to Python 2.7. With the patch, the Python socket even contains *more* information than the C module (laddr and raddr). Example with the patch applied: $ ./python -c 'import socket; s=socket.socket(); print(repr(s));' socket._socketobject fd=3, family=2, type=1, proto=0, laddr=('0.0.0.0', 0) In Python 2.7, when a socket is closed, it drops the underlying C _socket object. So it's not possible to provide a better representation than: $ ./python -c 'import socket; s=socket.socket(); s.close(); print(repr(s));' socket._socketobject[closed] I don't want to change the design of the Python module, Python 2.7 is very stable. I don't want to take the risk of breaking anything. -- files: socket_repr.patch keywords: patch messages: 224053 nosy: haypo priority: normal severity: normal status: open title: Backport repr(socket.socket) from Python 3.5 to Python 2.7 type: enhancement versions: Python 2.7 Added file: http://bugs.python.org/file36109/socket_repr.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22081 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22081] Backport repr(socket.socket) from Python 3.5 to Python 2.7
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +alex ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22081 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22081] Backport repr(socket.socket) from Python 3.5 to Python 2.7
STINNER Victor added the comment: I also fixed repr(_socket.socket) on Windows 64-bit for closed sockets (on Python 2.7, 3.4 and 3.5): changeset: 91881:04c916a1e82f branch: 2.7 tag: tip user:Victor Stinner victor.stin...@gmail.com date:Sat Jul 26 14:52:55 2014 +0200 files: Lib/test/test_socket.py Misc/NEWS Modules/socketmodule.c description: Fix repr(_socket.socket) on Windows 64-bit: don't fail with OverflowError on closed socket. changeset: 91880:a86c273a1270 branch: 2.7 user:Victor Stinner victor.stin...@gmail.com date:Sat Jul 26 14:47:56 2014 +0200 files: Modules/socketmodule.c description: socketmodule.c: backport INVALID_SOCKET from Python 3.5 to simplify the code -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22081 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19875] test_getsockaddrarg occasional failure
koobs added the comment: Updating versions to reflect branch changes. Will come in handy for those tracking for manual packaging backports -- versions: +Python 2.7, Python 3.5 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19875 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22081] Backport repr(socket.socket) from Python 3.5 to Python 2.7
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +gvanrossum ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22081 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19838] test.test_pathlib.PosixPathTest.test_touch_common fails on FreeBSD with ZFS
Larry Hastings added the comment: This test also fails on Linux when using ZFS. -- nosy: +larry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19838 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8232] webbrowser.open incomplete on Windows
Brandon Milam added the comment: In order to fix the issue I added on to the WindowsDefault class so that it is the main browser class for windows platforms as opposed to being a default when no other browser is given. I gave the class an init where it specifies specific flags for firefox, chrome, and internet explorer (from what I could find there aren't really new window or new tab flags for internet explorer). If the flags for other browsers are known they should be easy to add to this section. def __init__(self,browser = windows-default): # Grab the different flags for the different browser types browser.lower() self.browsername = browser # If get() is used without arguments browser will be passed None if browser == windows_default or browser == None: self.cmd = start elif browser == 'iexplore' or browser == 'internet explorer': self.cmd = start iexplore self.newwindow = self.newtab = elif browser == chrome: self.cmd = start chrome.exe self.newwindow = -new-window self.newtab = -new-tab elif browser == firefox: self.cmd = start firefox.exe self.newwindow = -new-window self.newtab = -new-tab else: raise Error('The browser you entered (%s) is not currently supported on windows' % browser) In the open method of the WindowsDefault class I changed how the browser is opened by building a command from the flags and the cmd for the specific browser and used subprocess,call. # Format the command for optional arguments and add the url if new == 1: self.cmd += + self.newwindow elif new == 2: self.cmd += + self.newtab self.cmd += + url subprocess.call(self.cmd,shell = True) This allows the user to input different new arguments to open a new window or new tab like the documentation says they should be able to do. I added a little bit to the beginning of the get function so that it passes its argument to the WindowsDefault class and returns that object on Windows systems. # Let the windows default class handle different browsers on windows if sys.platform[:3] == win: return WindowsDefault(using) This adds some of the desired compatibility but does not completely address the module's issues. I did not see a way to open a web page in a currently open page on any of the browsers, just new windows and new tabs (when no flags are passed the browsers default to one of these two options). Also the _isexecutable function's attempt at windows compatibility is still not working because I was unsure of how to use just a string of a browser name like 'chrome' to determine if a file is on a system. This leaves _tryorder not properly containing the browsers on the system. This leaves the module's open, open_new and open_new_tab not properly working either just the WindowsDefault open method. Any feed back and direction from here is most welcome. -- nosy: +jbmilam Added file: http://bugs.python.org/file36110/webbrowserdebug.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8232 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22082] Clear interned strings listed in slotdefs
New submission from Martin v. Löwis: I'm chasing objects left at shutdown. I found that the string objects in slotdefs are still around at the end; this patch removes them. -- files: type.diff keywords: patch messages: 224058 nosy: loewis priority: normal severity: normal status: open title: Clear interned strings listed in slotdefs Added file: http://bugs.python.org/file36111/type.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22082 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22082] Clear interned strings listed in slotdefs
Roundup Robot added the comment: New changeset c55300337932 by Martin v. Löwis in branch 'default': Issue #22082: Clear interned strings in slotdefs. http://hg.python.org/cpython/rev/c55300337932 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22082 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8232] webbrowser.open incomplete on Windows
Brandon Milam added the comment: How the _isexecutable function is set up now it would require a full path name in order to be able to tell if a specific browser is on the system. The area under platform support for windows checks for multiple browsers using this function but only passes it browser names and so it always returns false and does not add any browsers to _tryorder. I found a way to fix this using os.walk so that the simple strings of the browser names like firefox.exe is able to actually able to be found on the system. This method is rather slow though and the module wants to check for 8 browsers when imported. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8232 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22081] Backport repr(socket.socket) from Python 3.5 to Python 2.7
Guido van Rossum added the comment: Antoine, what do you want me to do? I think improving __repr__ of a socket sounds fine for some Python 2.7 bugfix release. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22081 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22083] Refactor PyShell's breakpoint related methods
New submission from Saimadhav Heblikar: This refactoring is required to enable setting/clearing breakpoints, using linenumbering( whether using a Canvas implementation or a Text implementation http://bugs.python.org/issue17535) The patch ensures consistency between the set_breakpoint(_here) and clear_breakpoint(_here) methods. The clear_breakpoint_here, which is not present currently has been added. No functionality has been added or removed, so I think it should be safe to go forward. -- components: IDLE files: pyshell-breakpoint-refactor.diff keywords: patch messages: 224062 nosy: jesstess, sahutd, taleinat, terry.reedy priority: normal severity: normal status: open title: Refactor PyShell's breakpoint related methods versions: Python 2.7, Python 3.4, Python 3.5 Added file: http://bugs.python.org/file36112/pyshell-breakpoint-refactor.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22083 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19838] test.test_pathlib.PosixPathTest.test_touch_common fails on FreeBSD with ZFS
Larry Hastings added the comment: Sorry to have such an awful configuration, but this approach won't fix the problem for me. I use a Linux encrypted home directory, which uses crazy loopback mount logic to create an on-the-fly decrypted representation of my home directory. So my home directory is actually on an ecryptfs device: % df -T FilesystemType Mounted on ... home zfs /home /home/larry/.Private ecryptfs /home/larry Maybe we could ignore deltas below a certain race-condition threshold? Perhaps a millisecond? I think there are already tests like that. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19838 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22081] Backport repr(socket.socket) from Python 3.5 to Python 2.7
Serhiy Storchaka added the comment: I afraid this can break doctests. Isn't this against policy? -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22081 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19838] test.test_pathlib.PosixPathTest.test_touch_common fails on FreeBSD with ZFS
Antoine Pitrou added the comment: So, I'm not against the patch, but it would be nice to diagnose where exactly the issue comes from. -- stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19838 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19838] test.test_pathlib.PosixPathTest.test_touch_common fails on FreeBSD with ZFS
Larry Hastings added the comment: (By this approach I meant the approach employed in the first patch posted. Sorry for the ambiguity.) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19838 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22074] Lib/test/make_ssl_certs.py fails with NameError
Roundup Robot added the comment: New changeset 83628d9e1035 by Antoine Pitrou in branch '3.4': Issue #22074: Fix Lib/test/make_ssl_certs.py http://hg.python.org/cpython/rev/83628d9e1035 New changeset 17f46a7b1125 by Antoine Pitrou in branch 'default': Issue #22074: Fix Lib/test/make_ssl_certs.py http://hg.python.org/cpython/rev/17f46a7b1125 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22074 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22074] Lib/test/make_ssl_certs.py fails with NameError
Antoine Pitrou added the comment: Good catch, this is now solved. -- resolution: - fixed stage: - resolved status: open - closed type: - behavior versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22074 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22081] Backport repr(socket.socket) from Python 3.5 to Python 2.7
Guido van Rossum added the comment: I don't think it's against policy. Do doctests even work for objects that have an address as part of their repr()? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22081 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22081] Backport repr(socket.socket) from Python 3.5 to Python 2.7
Serhiy Storchaka added the comment: See for example test_generators, test_genexps, test_xml_etree or ctypes.test.test_objects. dict(a = (i for i in xrange(10))) #doctest: +ELLIPSIS {'a': generator object genexpr at ...} repr(element) # doctest: +ELLIPSIS Element 't\\xe4g' at 0x... But unit tests can be broken too. When I enhanced reprs this week (issue22031, issue22032), I needed to correct failed tests. Due to this facts I applied patches only to 3.5. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22081 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22084] Mutating while iterating
New submission from Aaron Brady: Hi, I asked about the inconsistency of the RuntimeError being raised when mutating a container while iterating over it here [1], set and dict iteration on Aug 16, 2012. [1] http://www.gossamer-threads.com/lists/python/python/1004659 I posted a patch on the ML but never submitted it. People's reaction seemed ambivalent. Now I have an idea for a different implementation. I'd like to take another shot at it. It's one of the worst silent errors, since there's an error in the *iterator* when we call a *set* method. We're going to add something to make it safer, at least in the sense of getting a clear failure, if the programmer does something that's always been ill-advised. We have a number of options for the implementation. We still have the option to introduce IterationError, possibly a subclass of RuntimeError. These options are still applicable: 1) Collection of iterators . Invalidate all open iterators on mutating . a) Linked list .. i) Uncounted references .. ii) Counted references .. iii) Weak references . b) Weak set 2) Version index / timestamp / memo . Iterators check whether the container has been mutated since they were created . a) No overflow - Python longs .. i) Reset index if no iterators left . b) Overflow - C ints / shorts (silent error) 3) Iterator count . Raise exception on mutation, not iteration The new option is: 2d) Use a dedicated empty *object* for a timestamp or memo. A new memo is created on every mutation. Before advancing, the iterator checks whether the current memo is a different object than it was when it was created. Costs: The existing silent error is fairly rare. The container gains a pointer to its current memo. The iterator loses the cached length but gains a pointer to a memo. The memos are blank objects: a Py ssize t and a pointer with certain flags at time of writing. Speed is the same: comparing the lengths is replaced with comparing the memos. Some caveats: The memory manager is used to obtain perpetually unique IDs. A unique algorithm could be used instead of the memory manager, though the memo needs to contain a reference count more or less regardless. There can at most be one memo per iterator. The approach is outlined in pseudocode here [2]. Implementation could be optimized slightly by only creating new memos if iterators have been opened, shown here [3]. [2] http://home.comcast.net/~castironpi-misc/irc-0168%20mutating%20while%20iterating%20markup.html [3] http://home.comcast.net/~castironpi-misc/irc-0168%20mutating%20while%20iterating%202%20markup.html -- components: Library (Lib) messages: 224071 nosy: castironpi priority: normal severity: normal status: open title: Mutating while iterating type: behavior versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22084 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20093] Wrong OSError message from os.rename() when dst is a non-empty directory
Matthias Klose added the comment: 3.4.0 has this fixed. resolutions in http://bugs.python.org/issue16074 and http://bugs.python.org/issue20517 -- nosy: +doko resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20093 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22084] Mutating while iterating
Serhiy Storchaka added the comment: It would be better discuss such ideas on python-ideas mailing list (http://mail.python.org/mailman/listinfo/python-ideas). Option 3 breaks existing code such as for k, v in d.items(): if pred(k, v): d[k] = newvalue break Option 1 is memory inefficient. It requires a list of iterators in every dict (well, in almost every dict). And it doesn't look more time efficient than option 2. Implementation of option 2 was provided and rejected in issue19332. -- nosy: +rhettinger, serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22084 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22081] Backport repr(socket.socket) from Python 3.5 to Python 2.7
Guido van Rossum added the comment: OK, I'm convinced. Sorry Victor. On Saturday, July 26, 2014, Serhiy Storchaka rep...@bugs.python.org wrote: Serhiy Storchaka added the comment: See for example test_generators, test_genexps, test_xml_etree or ctypes.test.test_objects. dict(a = (i for i in xrange(10))) #doctest: +ELLIPSIS {'a': generator object genexpr at ...} repr(element) # doctest: +ELLIPSIS Element 't\\xe4g' at 0x... But unit tests can be broken too. When I enhanced reprs this week (issue22031, issue22032), I needed to correct failed tests. Due to this facts I applied patches only to 3.5. -- ___ Python tracker rep...@bugs.python.org javascript:; http://bugs.python.org/issue22081 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22081 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22081] Backport repr(socket.socket) from Python 3.5 to Python 2.7
Alex Gaynor added the comment: Personally I don't think it is (or should) be against policy to change reprs, there's not really any way to improve them otherwise. That said, my excitement level about this issue is pretty low, so I won't argue more than this :-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22081 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21308] PEP 466: backport ssl changes
Alex Gaynor added the comment: New patch cherry pick's the fix from issue22074. -- Added file: http://bugs.python.org/file36113/ssl-backport.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21308 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22069] TextIOWrapper(newline=\n, line_buffering=True) mistakenly treat \r as a newline
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22069 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1152248] Add support for reading records with arbitrary separators to the standard IO stack
Akira Li added the comment: As a side-effect it also fixes the bug in line_buffering=True behavior, see issue22069O. It should be issue22069 TextIOWrapper(newline=\n, line_buffering=True) mistakenly treat \r as a newline Reuploaded the patch so that it applies cleanly on the current tip. -- Added file: http://bugs.python.org/file36114/io-newline-issue1152248-2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1152248 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22069] TextIOWrapper(newline=\n, line_buffering=True) mistakenly treat \r as a newline
Serhiy Storchaka added the comment: Looks as this behavior is intentional. Documentation should be corrected. -- assignee: - docs@python components: +Documentation nosy: +benjamin.peterson, docs@python, hynek, pitrou, stutzbach ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22069 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22085] Update deprecated Tcl commands in Tkinter
New submission from Serhiy Storchaka: Command used to monitor Tcl variable access (trace variable, trace vdelete, trace vinfo) are deprecated and will likely be removed in a future version of Tcl. Proposed patch replaces them to modern equivalents. The problem is that new commands was introduced in Tcl 8.4, but minimal supported by Tkinter version is 8.3. This patch should wait until dropping support of Tcl 8.3. -- components: Tkinter messages: 224080 nosy: serhiy.storchaka priority: normal severity: normal status: open title: Update deprecated Tcl commands in Tkinter type: enhancement versions: Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22085 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com