Re: About python while statement and pop()
2014年6月12日木曜日 14時43分42秒 UTC+9 Steven D'Aprano: On Wed, 11 Jun 2014 21:56:06 -0700, hito koto wrote: I want to use while statement, for example: def foo(x): ... y = [] ... while x !=[]: ... y.append(x.pop()) ... return y ... print foo(a) [[10], [5, 6, 7, 8, 9], [1, 2, 3, 4]] a [] but this is empty so,I want to leave a number of previous (a = [[1, 2, 3, 4],[5, 6, 7, 8, 9],[10]]) I wouldn't use a while statement. The easy way is: py a = [[1, 2, 3, 4],[5, 6, 7, 8, 9],[10]] py y = a[::-1] py print y [[10], [5, 6, 7, 8, 9], [1, 2, 3, 4]] py print a [[1, 2, 3, 4], [5, 6, 7, 8, 9], [10]] If you MUST use a while loop, then you need something like this: def foo(x): y = [] index = 0 while index len(x): y.append(x[i]) i += 1 return y This does not copy in reverse order. To make it copy in reverse order, index should start at len(x) - 1 and end at 0. -- Steven Hi, Steven: Thanks, My goal is to be able to in many ways python Sorry, I was mistake, I want to leave a number of previous (a = [[10], [5, 6, 7, 8, 9], [1, 2, 3, 4]] ) -- https://mail.python.org/mailman/listinfo/python-list
Re: Lines on a tkinter.Canvas
Pedro Izecksohn wrote: The code available from: http://izecksohn.com/pedro/python/canvas/testing.py draws 2 horizontal lines on a Canvas. Why the 2 lines differ on thickness and length? The Canvas' method create_line turns on at least 2 pixels. But I want to turn on many single pixels on a Canvas. How should I do this? Canvas has no method create_pixel or create_point. #!/usr/bin/python3 import tkinter as tk class Point (): def __init__ (self, x, y): self.x = x self.y = y class Board (tk.Frame): def __init__ (self, bg, dimensions): tk.Frame.__init__ (self, tk.Tk()) self.pack() self.canvas = tk.Canvas (self, bd = 0, bg = bg, width = dimensions.x, height = dimensions.y) self.canvas.pack (side = top) def drawLine (self, pa, pb, color): self.canvas.create_line (pa.x, pa.y, pb.x, pb.y, fill = color) def drawPoint (self, p, color): self.canvas.create_line (p.x, p.y, p.x, p.y, fill = color) dimensions = Point (500, 500) board = Board ('black', dimensions) color = 'red' p = Point (0, 250) while (p.x dimensions.x): board.drawPoint (p, color) p.x += 1 pa = Point (0, 350) pb = Point (499, 350) board.drawLine (pa, pb, color) board.mainloop() I just tried your script, and over here the line drawn with def drawLine (self, pa, pb, color): self.canvas.create_line (pa.x, pa.y, pb.x, pb.y, fill = color) has a width of 1 pixel and does not include the end point. Therefore the line drawn with def drawPoint (self, p, color): self.canvas.create_line (p.x, p.y, p.x, p.y, fill = color) does not show up at all. You could try to specify the line width explicitly: def drawPoint (self, p, color): self.canvas.create_line (p.x, p.y, p.x+1, p.y, fill=color, width=1) If that doesn't work (or there's too much overhead) use pillow to prepare an image and show that. Another random idea: if you have a high resolution display your OS might blow up everything. In that case there would be no fix on the application level. -- https://mail.python.org/mailman/listinfo/python-list
Re: About python while statement and pop()
2014年6月12日木曜日 14時43分42秒 UTC+9 Steven D'Aprano: On Wed, 11 Jun 2014 21:56:06 -0700, hito koto wrote: I want to use while statement, for example: def foo(x): ... y = [] ... while x !=[]: ... y.append(x.pop()) ... return y ... print foo(a) [[10], [5, 6, 7, 8, 9], [1, 2, 3, 4]] a [] but this is empty so,I want to leave a number of previous (a = [[1, 2, 3, 4],[5, 6, 7, 8, 9],[10]]) I wouldn't use a while statement. The easy way is: py a = [[1, 2, 3, 4],[5, 6, 7, 8, 9],[10]] py y = a[::-1] py print y [[10], [5, 6, 7, 8, 9], [1, 2, 3, 4]] py print a [[1, 2, 3, 4], [5, 6, 7, 8, 9], [10]] If you MUST use a while loop, then you need something like this: def foo(x): y = [] index = 0 while index len(x): y.append(x[i]) i += 1 return y This does not copy in reverse order. To make it copy in reverse order, index should start at len(x) - 1 and end at 0. -- Steven Hi, Steven: Thanks, My goal is to be able to in many ways python Sorry, I was mistake, I want to leave a number of previous (a = [[10], [9, 8, 7, 6, 5], [4, 3, 2, 1]] ) -- https://mail.python.org/mailman/listinfo/python-list
Al madinah international university opening apply for university colleges (September season)
MR/ MiSS * al madinah international university which win dependence Malaysian Ministry of Higher Education Malaysia (MOHE) and also winning the adoption of all academic programs and courses, the university that are approved by the Malaysian funds and private academy, which deals with quality control and efficiency Academy, known for short as [MQA ] to congratulate you on the occasion of the new academic September year - 2014 . Its pleasure to tell you that the university opening apply for university colleges. The flowing colleges : * faculty of Islamic Sciences * faculty of languages *faculty of computer Science . *faculty of education . * Faculty of Science, Finance and Administration . *Language center *.faculty of engineering ( soon) The university offer : * Bachelor degree * Master degree * PH degree Both online and on campus learning for more information you can visit http://www.mediu.edu.my/ar/admissions/requirments for more information about Bachelor degree http://www.mediu.edu.my/ar/admissions/undergraduateprograms for more information about master degree http://www.mediu.edu.my/ar/admissions/postgraduateprograms Best Regard international city university //www.mediu.edu.my/ar/ -- https://mail.python.org/mailman/listinfo/python-list
Re: asyncio - how to stop loop?
Ian Kelly ian.g.ke...@gmail.com wrote in message news:CALwzidnv07Wba9WJ=nuc0_v4mvudyaxwh6bgjvw0o1hf3oo...@mail.gmail.com... On Wed, Jun 11, 2014 at 1:19 AM, Frank Millman fr...@chagford.com wrote: First attempt - same as before loop = asyncio.get_event_loop() threading.Thread(target=loop.run_forever).start() input('Press enter to stop') loop.stop() loop.close() Each event loop is hosted by a specific thread. In this case you're getting the event loop of the main thread and then trying to run it in a separate thread, which is not a good idea. You can run an event loop in a separate thread, but you should install a separate event loop for that thread if you do (and then when you interact with the loop, do so in a thread-safe manner -- see below). Second attempt - move the keyboard input to a separate thread def stop_loop(): input('Press enter to stop') loop.stop() loop.close() loop = asyncio.get_event_loop() threading.Thread(target=stop_loop).start() loop.run_forever() One issue here is that (like most event loop implementations) event loops are not thread-safe. To make a call to the event loop across threads, you should be using the call_soon_threadsafe method, e.g. loop.call_soon_threadsafe(loop.stop). You'll also want to make sure that the event loop has actually stopped before you call loop.close -- see below. Third attempt - get the loop to close itself (cannot use in practice, but see what happens) def stop_loop(): loop.stop() loop.close() loop = asyncio.get_event_loop() loop.call_later(2, stop_loop) loop.run_forever() I think what's happening here is that per the docs loop.close should not be called while the loop is running. You've called loop.stop but you're still inside a callback, which is a bit of a gray area. You probably don't need to call loop.close at all, but if you want to do so I suggest putting it after the run_forever call, so you can be certain the loop has stopped when it's called. Putting all that together, you should have something like this: def stop_loop(): input('Press enter to stop') loop.call_soon_threadsafe(loop.stop) loop = asyncio.get_event_loop() threading.Thread(target=stop_loop).start() loop.run_forever() loop.close() # optional Thanks very much for the very clear explanation. Your solution works perfectly. Much appreciated. Frank -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: This Swift thing
On Thu, 12 Jun 2014 12:16:08 +1000, Chris Angelico wrote: On Thu, Jun 12, 2014 at 12:08 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I'm just pointing out that our computational technology uses over a million times more energy than the theoretical minimum, and therefore there is a lot of room for efficiency gains without sacrificing computer power. I never imagined that such viewpoint would turn out to be so controversial. The way I understand it, you're citing an extremely theoretical minimum, in the same way that one can point out that we're a long way from maximum entropy in a flash memory chip, so it ought to be possible to pack a lot more data onto a USB stick. Um, yes? Hands up anyone who thinks that today's generation of USB sticks will be the highest capacity ever, that all progress in packing more memory into a thumb drive (or the same memory into a smaller drive) will cease effective immediately? Anyone? The laws of physics tend to put boundaries that are ridiculously far from where we actually work - I think most roads have speed limits that run a fairly long way short of c. 186,000 miles per second: not just a good idea, it's the law There's no *law of physics* that says cars can only travel at the speeds they do. Compare how fast a typical racing car goes with the typical 60kph speed limit in suburban Melbourne. Now compare how fast the Hennessey Venom GT goes to that speed limit. http://www.autosaur.com/fastest-car-in-the-world/?PageSpeed=noscript Speed limits for human-piloted ground-based transport (cars) are more based on social and biological factors than engineering ones. Similarly, there are biological factors that force keyboards to be a minimum size. We probably could build a keyboard where the keys were 0.1mm square, but what would be the point? Who could use it? Those social and biological factors don't apply to computing efficiency, so it's only *engineering* factors that prevent us from being able to run your server off a watch battery, not the laws of physics. It is my contention that, had Intel and AMD spent the last few decades optimizing for power consumption rather than speed, we probably could run a server off, well, perhaps not a watch battery, but surely a factor of 100 improvement in efficiency isn't unreasonable given that we're just moving a picogram of electrons around? -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: This Swift thing
On Thu, 12 Jun 2014 09:06:50 +, Steven D'Aprano wrote: On Thu, 12 Jun 2014 12:16:08 +1000, Chris Angelico wrote: On Thu, Jun 12, 2014 at 12:08 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I'm just pointing out that our computational technology uses over a million times more energy than the theoretical minimum, and therefore there is a lot of room for efficiency gains without sacrificing computer power. I never imagined that such viewpoint would turn out to be so controversial. The way I understand it, you're citing an extremely theoretical minimum, in the same way that one can point out that we're a long way from maximum entropy in a flash memory chip, so it ought to be possible to pack a lot more data onto a USB stick. Um, yes? Hands up anyone who thinks that today's generation of USB sticks will be the highest capacity ever, that all progress in packing more memory into a thumb drive (or the same memory into a smaller drive) will cease effective immediately? Anyone? The laws of physics tend to put boundaries that are ridiculously far from where we actually work - I think most roads have speed limits that run a fairly long way short of c. 186,000 miles per second: not just a good idea, it's the law There's no *law of physics* that says cars can only travel at the speeds they do. Compare how fast a typical racing car goes with the typical 60kph speed limit in suburban Melbourne. Now compare how fast the Hennessey Venom GT goes to that speed limit. http://www.autosaur.com/fastest-car-in-the-world/?PageSpeed=noscript Speed limits for human-piloted ground-based transport (cars) are more based on social and biological factors than engineering ones. Similarly, there are biological factors that force keyboards to be a minimum size. We probably could build a keyboard where the keys were 0.1mm square, but what would be the point? Who could use it? Those social and biological factors don't apply to computing efficiency, so it's only *engineering* factors that prevent us from being able to run your server off a watch battery, not the laws of physics. It is my contention that, had Intel and AMD spent the last few decades optimizing for power consumption rather than speed, we probably could run a server off, well, perhaps not a watch battery, but surely a factor of 100 improvement in efficiency isn't unreasonable given that we're just moving a picogram of electrons around? but a 20 year old server would probably take a week to do what a current one does in an hour (random figures chosen for effect not accuracy). How does the power consumption compare on those time-scales, not to mention the cost of the wasted time? I would agree that for the average desk-top users modern processor performance exceeds that required by a considerable margin so perhaps optimising for power consumption is now possible, wait a minute arn't intel AMD now developing lower powered processors? -- Breeding rabbits is a hare raising experience. -- https://mail.python.org/mailman/listinfo/python-list
Re: About python while statement and pop()
2014年6月12日木曜日 14時43分42秒 UTC+9 Steven D'Aprano: On Wed, 11 Jun 2014 21:56:06 -0700, hito koto wrote: I want to use while statement, for example: def foo(x): ... y = [] ... while x !=[]: ... y.append(x.pop()) ... return y ... print foo(a) [[10], [5, 6, 7, 8, 9], [1, 2, 3, 4]] a [] but this is empty so,I want to leave a number of previous (a = [[1, 2, 3, 4],[5, 6, 7, 8, 9],[10]]) I wouldn't use a while statement. The easy way is: py a = [[1, 2, 3, 4],[5, 6, 7, 8, 9],[10]] py y = a[::-1] py print y [[10], [5, 6, 7, 8, 9], [1, 2, 3, 4]] py print a [[1, 2, 3, 4], [5, 6, 7, 8, 9], [10]] If you MUST use a while loop, then you need something like this: def foo(x): y = [] index = 0 while index len(x): y.append(x[i]) i += 1 return y This does not copy in reverse order. To make it copy in reverse order, index should start at len(x) - 1 and end at 0. -- Steven Hi, Thank you! -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: This Swift thing
Steven D'Aprano wrote: It is my contention that, had Intel and AMD spent the last few decades optimizing for power consumption rather than speed, we probably could run a server off, well, perhaps not a watch battery, Current draw of CMOS circuitry is pretty much zero when nothing is changing, so if you didn't care how slow it ran, you probably could run a server off a watch battery today. Users wouldn't like waiting a week for their web pages to load, though... -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: Lines on a tkinter.Canvas
Pedro Izecksohn wrote: The Canvas' method create_line turns on at least 2 pixels. But I want to turn on many single pixels on a Canvas. You could try using a 1x1 rectangle instead. However, be aware that either of these will use quite a lot of memory per pixel. If you are drawing a very large number of pixels, this could cause performance problems. In that case, you might want to use a different approach, such as creating an image and telling the canvas to display the image. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: This Swift thing
I am bewildered by this argument... [Heck Ive recently learnt that using ellipses is an easy way to produce literature... So there...] On Thursday, June 12, 2014 2:36:50 PM UTC+5:30, Steven D'Aprano wrote: It is my contention that, had Intel and AMD spent the last few decades optimizing for power consumption rather than speed, we probably could run a server off, well, perhaps not a watch battery, but surely a factor of 100 improvement in efficiency isn't unreasonable given that we're just moving a picogram of electrons around? This is fine and right. I personally would pay more if my PCs/laptops etc were quieter/efficient-er. So we agree... upto here! On Thu, 12 Jun 2014 12:16:08 +1000, Chris Angelico wrote: On Thu, Jun 12, 2014 at 12:08 PM, Steven D'Aprano wrote: I'm just pointing out that our computational technology uses over a million times more energy than the theoretical minimum, and therefore there is a lot of room for efficiency gains without sacrificing computer power. I never imagined that such viewpoint would turn out to be so controversial. The way I understand it, you're citing an extremely theoretical minimum, in the same way that one can point out that we're a long way from maximum entropy in a flash memory chip, so it ought to be possible to pack a lot more data onto a USB stick. Um, yes? Hands up anyone who thinks that today's generation of USB sticks will be the highest capacity ever, that all progress in packing more memory into a thumb drive (or the same memory into a smaller drive) will cease effective immediately? Anyone? The laws of physics tend to put boundaries that are ridiculously far from where we actually work - I think most roads have speed limits that run a fairly long way short of c. 186,000 miles per second: not just a good idea, it's the law There's no *law of physics* that says cars can only travel at the speeds they do. Compare how fast a typical racing car goes with the typical 60kph speed limit in suburban Melbourne. Now compare how fast the Hennessey Venom GT goes to that speed limit. http://www.autosaur.com/fastest-car-in-the-world/?PageSpeed=noscript Now you (or I) are getting completely confused. If you are saying that the Hennessey Venom (HV) is better than some standard vanilla Ford/Toyota (FT) based on the above, thats ok. In equations: maxspeed(HV) = 250 mph maxspeed(FT) = 150 mph so HV is better than FT. Ok... But from your earlier statements you seem to be saying its better because: 250 mph is closer to 186,000 mps (= 670 million mph) than 150 mph Factually this is a correct statement. Pragmatically this is as nonsensical as comparing a mile and a kilogram. Speed limits for human-piloted ground-based transport (cars) are more based on social and biological factors than engineering ones. Similarly, there are biological factors that force keyboards to be a minimum size. We probably could build a keyboard where the keys were 0.1mm square, but what would be the point? Who could use it? Those social and biological factors don't apply to computing efficiency, so it's only *engineering* factors that prevent us from being able to run your server off a watch battery, not the laws of physics. As best as I can see you are confused about the difference between science and engineering. Saying one car is better engineered than another on direct comparison (150mph250mph) is ok Saying one car is better than another because of relation to physics limits (c-150c-250) is confusing science and engineering. Likewise saying AMD and Intel should have done more due diligence to their clients (and the planet) by considerging energy efficiency is right and I (strongly) agree. But compare their products' realized efficiency with theoretical limits like Landauers is a type-wrong statement -- https://mail.python.org/mailman/listinfo/python-list
Python MSI Repo
Is there a public repository for the python windows installer? I'd like to play around with it. - Alex -- https://mail.python.org/mailman/listinfo/python-list
Re: Python MSI Repo
On 6/12/14 9:47 AM, Alex Rodrigues wrote: Is there a public repository for the python windows installer? I'd like to play around with it. - Alex I'm no expert on what the source for a windows installer looks like, but there seem to be things that smell like that in the PC and PCbuild directories of the CPython repository: http://hg.python.org/cpython/file/9aba5d75ce94 -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list
Re: About python while statement and pop()
On 6/11/14 10:12 PM, hito koto wrote: i want to change this is code: def foo(x): y = [] while x !=[]: y.append(x.pop()) return y Consider this generator (all kinds of permutations on the idea): L1 [1, 2, 3, 4, 5, 6, 7] def poplist(L): while True: yield L[::-1][:1:] L = L[::-1][1::][::-1] pop = poplist(L1) next(pop) [7] next(pop) [6] next(pop) [5] next(pop) [4] next(pop) [3] next(pop) [2] next(pop) [1] next(pop) [] next(pop) [] -- https://mail.python.org/mailman/listinfo/python-list
Re: About python while statement and pop()
On 6/11/14 10:12 PM, hito koto wrote: def foo(x): y = [] while x !=[]: y.append(x.pop()) return y Consider this generator variation: def poplist(L): done = False while done==False: yield L[::-1][:1:] L = L[::-1][1::][::-1] if len(L)==0: done=True L1=[1, 2, 3, 4, 5, 6, 7] for n in poplist(L1): print(n) [7] [6] [5] [4] [3] [2] [1] -- https://mail.python.org/mailman/listinfo/python-list
Re: About python while statement and pop()
On Fri, Jun 13, 2014 at 2:49 AM, Mark H Harris harrismh...@gmail.com wrote: Consider this generator variation: def poplist(L): done = False while done==False: yield L[::-1][:1:] L = L[::-1][1::][::-1] if len(L)==0: done=True Why not just while L? Or are you deliberately trying to ensure that cheating will be detectable? ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Python MSI Repo
On Thu, Jun 12, 2014 at 8:47 AM, Alex Rodrigues lemi...@gmail.com wrote: Is there a public repository for the python windows installer? I'd like to play around with it. The installer is built using msi.py, found in the tools directory of the main cpython repository: http://hg.python.org/cpython/file/default/Tools/msi/msi.py You can also find in that directory a README.txt file which should help you get started, and you can also refer to the 'buildmsi.bat' script in .../Tools/buildbot/ (which is currently unused and long out of date, but can give you an idea of what's involved). Note that the script has not been updated for 3.5 yet (since there hasn't been a release yet). Also, it is not often used by anyone other than Martin v. Löwis who has built all of the Python Windows installers in recent history, so it may take a bit of effort to make it work. I have tried and failed a couple of times, but on each occasion have run out of time to work on it before other things called me away. That script is liable to change in the not-too-far-distant future, as Steve Dower is taking over installer building responsibilities from Martin and may change the way they are built entirely. Good luck, and have fun 'playing around'! :) -- Zach -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: This Swift thing
On Thu, 12 Jun 2014 05:54:47 -0700, Rustom Mody wrote: On Thursday, June 12, 2014 2:36:50 PM UTC+5:30, Steven D'Aprano wrote: [...] The laws of physics tend to put boundaries that are ridiculously far from where we actually work - I think most roads have speed limits that run a fairly long way short of c. 186,000 miles per second: not just a good idea, it's the law There's no *law of physics* that says cars can only travel at the speeds they do. Compare how fast a typical racing car goes with the typical 60kph speed limit in suburban Melbourne. Now compare how fast the Hennessey Venom GT goes to that speed limit. http://www.autosaur.com/fastest-car-in-the-world/?PageSpeed=noscript Now you (or I) are getting completely confused. If you are saying that the Hennessey Venom (HV) is better than some standard vanilla Ford/Toyota (FT) based on the above, thats ok. I'm not making any value judgements (better or worse) about cars based on their speed. I'm just pointing out that the speed limits on our roads have very little to do with the speeds cars are capable of reaching, and *nothing* to do with ultimate limits due to the laws of physics. Chris made the argument that *the laws of physics* put limits on what we can attain, which is fair enough, but then made the poor example of speed limits on roads falling short of the speed of light. Yes, speed limits on roads fall considerably short of the speed of light, but not because of laws of physics. The speed limit in my street is 50 kilometres per hour, not because that limit is a law of physics, or because cars are incapable of exceeding 50kph, but because the government where I live has decided that 50kph is the maximum safe speed for a car to travel in my street, rounded to the nearest multiple of 10kph. In other words, Chris' example is a poor one to relate to the energy efficiency of computing. A more directly relevant example would have been the efficiency of heat engines, where there is a fundamental physical limit of 100% efficiency. Perhaps Chris didn't mention that one because our technology can build heat engines with 60% efficiency, which is probably coming close to the practical upper limit of attainable efficiency -- we might, by virtue of clever engineering and exotic materials, reach 70% or 80% efficiency, but probably not 99.9% efficiency. That's a good example. Bringing it back to computing technology, the analogy is that our current computing technology is like a heat engine with an efficiency of 0.01%. Even an efficiency of 1% would be a marvelous improvement. In this analogy, there's an ultimate limit of 100% imposed by physics (Landauer's Law), and a practical limit of (let's say) 80%, but current computing technology is so far from those limits that those limits might as well not exist. In equations: maxspeed(HV) = 250 mph maxspeed(FT) = 150 mph so HV is better than FT. Better is your word, not mine. I don't actually care about fast cars, but if I did, and if I valued speed above everything else (cost, safety, fuel efficiency, noise, environmental impact, comfort, etc) then yes, I would say 250 mph is better than 150 mph, because 250 mph is larger. Ok... But from your earlier statements you seem to be saying its better because: 250 mph is closer to 186,000 mps (= 670 million mph) than 150 mph Factually this is a correct statement. And yet you're going to disagree with it, even though you agree it is correct? Pragmatically this is as nonsensical as comparing a mile and a kilogram. This makes no sense at all. Your two statements about speeds are logically and mathematically equivalent. You cannot have one without the other. Take three numbers, speeds in this case, s1, s2 and c, with c a strict upper-bound. We can take: s1 s2 c without loss of generality. So in this case, we say that s2 is greater than s1: s2 s1 Adding the constant c to both sides does not change the inequality: c + s2 c + s1 Subtracting s1 + s2 from each side: c + s2 - (s1 + s2) c + s1 - (s1 + s2) c - s1 c - s2 In other words, if 250mph is larger than 150mph (a fact, as you accept), then it is equally a fact that 250mph is closer to the speed of light than 150mph. You cannot possibly have one and not the other. So why do you believe that the first form is acceptable, but the second form is nonsense? Speed limits for human-piloted ground-based transport (cars) are more based on social and biological factors than engineering ones. Similarly, there are biological factors that force keyboards to be a minimum size. We probably could build a keyboard where the keys were 0.1mm square, but what would be the point? Who could use it? Those social and biological factors don't apply to computing efficiency, so it's only *engineering* factors that prevent us from being able to run your server off a watch battery, not the laws of physics. As best as I can see you are
Re: About python while statement and pop()
while done==False: Correction: while not done: Better Python and not bad English, either. Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: About python while statement and pop()
On 6/12/14 11:55 AM, Marko Rauhamaa wrote: while not done: Better Python and not bad English, either. ... and taking Marko's good advice, what I think you really wanted: def poplist(L): done = False while not done: yield L[::-1][:1:] L = L[::-1][1::][::-1] if len(L)==0: done=True L=[1, 2, 3, 4, 5, 6, 7] m=[] pop = poplist(L) for n in poplist(L): m.append(n[0]) m [7, 6, 5, 4, 3, 2, 1] -- https://mail.python.org/mailman/listinfo/python-list
Re: About python while statement and pop()
On 6/12/14 11:57 AM, Chris Angelico wrote: On Fri, Jun 13, 2014 at 2:49 AM, Mark H Harris harrismh...@gmail.com wrote: Consider this generator variation: def poplist(L): done = False while done==False: yield L[::-1][:1:] L = L[::-1][1::][::-1] if len(L)==0: done=True Why not just while L? Or are you deliberately trying to ensure that cheating will be detectable? ;-) -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: This Swift thing
On Fri, Jun 13, 2014 at 3:04 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Chris made the argument that *the laws of physics* put limits on what we can attain, which is fair enough, but then made the poor example of speed limits on roads falling short of the speed of light. Yes, speed limits on roads fall considerably short of the speed of light, but not because of laws of physics. The speed limit in my street is 50 kilometres per hour, not because that limit is a law of physics, or because cars are incapable of exceeding 50kph, but because the government where I live has decided that 50kph is the maximum safe speed for a car to travel in my street, rounded to the nearest multiple of 10kph. In other words, Chris' example is a poor one to relate to the energy efficiency of computing. The point isn't so much the legal or safe limit as that that's the speed of most driving. That is to say: Around here, most cars will travel at roughly 50 kph, which is a far cry from c. There are other reasons than physics for choosing a speed. Take three numbers, speeds in this case, s1, s2 and c, with c a strict upper-bound. We can take: s1 s2 c without loss of generality. So in this case, we say that s2 is greater than s1: s2 s1 Adding the constant c to both sides does not change the inequality: c + s2 c + s1 As long as we accept that this is purely in a mathematical sense. Let's not get into the realm of actual speeds greater than c. Subtracting s1 + s2 from each side: c + s2 - (s1 + s2) c + s1 - (s1 + s2) c - s1 c - s2 In other words, if 250mph is larger than 150mph (a fact, as you accept), then it is equally a fact that 250mph is closer to the speed of light than 150mph. You cannot possibly have one and not the other. So why do you believe that the first form is acceptable, but the second form is nonsense? And at this point the calculation becomes safe again, and obvious common sense. (Or alternatively, substitute Mach 1 for c; it's not a hard limit, but there are good reasons for staying below it in practical application - most airliners cruise a smidge below the speed of sound for efficiency.) If I were arguing that there are no engineering limits prohibiting CPUs reaching Landauer's limit, then you could criticise me for that, but I'm not making that argument. I'm saying that, whatever the practical engineering limits turn out to be, we're unlikely to be close to them, and therefore there are very likely to be many and massive efficiency gains to be made in computing. And this I totally agree with. The limits of physics are so incredibly far from where we now are that we can utterly ignore them; the limits we face are generally engineering (with the exception of stuff designed for humans to use, eg minimum useful key size is defined by fingers and not by what we can build). ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: About python while statement and pop()
On 6/12/14 11:57 AM, Chris Angelico wrote: def poplist(L): done = False while done==False: yield L[::-1][:1:] L = L[::-1][1::][::-1] if len(L)==0: done=True Why not just while L? OK, here it is with Chris' excellent advice: def poplist(L): while L: yield L[::-1][:1:] L = L[::-1][1::][::-1] L=[1, 2, 3, 4, 5, 6, 7] m=[] pop = poplist(L) for n in poplist(L): m.append(n[0]) m [7, 6, 5, 4, 3, 2, 1] == ah === -- https://mail.python.org/mailman/listinfo/python-list
كأس العالم FIFA 2014
كأس العالم FIFA 2014 https://www.facebook.com/pages/%D9%86%D8%AA%D8%A7%D8%A6%D8%AC-%D8%A7%D9%84%D8%A7%D9%85%D8%AA%D8%AD%D8%A7%D9%86%D8%A7%D8%AA-%D9%88%D8%A7%D9%84%D8%AC%D8%A7%D9%85%D8%B9%D8%A7%D8%AA-%D9%88%D8%A7%D8%AC%D8%AA%D9%85%D8%A7%D8%B9%D9%8A%D8%A7%D8%AA/299719160065550 كأس العالم: البرازيل تستعد لاطلاق بطولة 2014 https://www.facebook.com/pages/%D9%86%D8%AA%D8%A7%D8%A6%D8%AC-%D8%A7%D9%84%D8%A7%D9%85%D8%AA%D8%AD%D8%A7%D9%86%D8%A7%D8%AA-%D9%88%D8%A7%D9%84%D8%AC%D8%A7%D9%85%D8%B9%D8%A7%D8%AA-%D9%88%D8%A7%D8%AC%D8%AA%D9%85%D8%A7%D8%B9%D9%8A%D8%A7%D8%AA/299719160065550 مباريات كأس العالم البرازيل 2014 FIFA - FIFA.com https://www.facebook.com/pages/%D9%86%D8%AA%D8%A7%D8%A6%D8%AC-%D8%A7%D9%84%D8%A7%D9%85%D8%AA%D8%AD%D8%A7%D9%86%D8%A7%D8%AA-%D9%88%D8%A7%D9%84%D8%AC%D8%A7%D9%85%D8%B9%D8%A7%D8%AA-%D9%88%D8%A7%D8%AC%D8%AA%D9%85%D8%A7%D8%B9%D9%8A%D8%A7%D8%AA/299719160065550 صور كأس العالم 2014 https://www.facebook.com/pages/%D9%86%D8%AA%D8%A7%D8%A6%D8%AC-%D8%A7%D9%84%D8%A7%D9%85%D8%AA%D8%AD%D8%A7%D9%86%D8%A7%D8%AA-%D9%88%D8%A7%D9%84%D8%AC%D8%A7%D9%85%D8%B9%D8%A7%D8%AA-%D9%88%D8%A7%D8%AC%D8%AA%D9%85%D8%A7%D8%B9%D9%8A%D8%A7%D8%AA/299719160065550 كأس العالم لكرة القدم 2014 https://www.facebook.com/pages/%D9%86%D8%AA%D8%A7%D8%A6%D8%AC-%D8%A7%D9%84%D8%A7%D9%85%D8%AA%D8%AD%D8%A7%D9%86%D8%A7%D8%AA-%D9%88%D8%A7%D9%84%D8%AC%D8%A7%D9%85%D8%B9%D8%A7%D8%AA-%D9%88%D8%A7%D8%AC%D8%AA%D9%85%D8%A7%D8%B9%D9%8A%D8%A7%D8%AA/299719160065550 إليكَ ترددات القنوات المفتوحة لمشاهدة المونديال مجاناً https://www.facebook.com/pages/%D9%86%D8%AA%D8%A7%D8%A6%D8%AC-%D8%A7%D9%84%D8%A7%D9%85%D8%AA%D8%AD%D8%A7%D9%86%D8%A7%D8%AA-%D9%88%D8%A7%D9%84%D8%AC%D8%A7%D9%85%D8%B9%D8%A7%D8%AA-%D9%88%D8%A7%D8%AC%D8%AA%D9%85%D8%A7%D8%B9%D9%8A%D8%A7%D8%AA/299719160065550 كيف سيشاهد العرب كأس العالم 2014 https://www.facebook.com/pages/%D9%86%D8%AA%D8%A7%D8%A6%D8%AC-%D8%A7%D9%84%D8%A7%D9%85%D8%AA%D8%AD%D8%A7%D9%86%D8%A7%D8%AA-%D9%88%D8%A7%D9%84%D8%AC%D8%A7%D9%85%D8%B9%D8%A7%D8%AA-%D9%88%D8%A7%D8%AC%D8%AA%D9%85%D8%A7%D8%B9%D9%8A%D8%A7%D8%AA/299719160065550 جدول كاس العالم - جدول مباريات كاس العالم 2014 https://www.facebook.com/pages/%D9%86%D8%AA%D8%A7%D8%A6%D8%AC-%D8%A7%D9%84%D8%A7%D9%85%D8%AA%D8%AD%D8%A7%D9%86%D8%A7%D8%AA-%D9%88%D8%A7%D9%84%D8%AC%D8%A7%D9%85%D8%B9%D8%A7%D8%AA-%D9%88%D8%A7%D8%AC%D8%AA%D9%85%D8%A7%D8%B9%D9%8A%D8%A7%D8%AA/299719160065550 متابعة ومشاهدة مباريات كأس العالم 2014 للأندرويد مجاناً https://www.facebook.com/pages/%D9%86%D8%AA%D8%A7%D8%A6%D8%AC-%D8%A7%D9%84%D8%A7%D9%85%D8%AA%D8%AD%D8%A7%D9%86%D8%A7%D8%AA-%D9%88%D8%A7%D9%84%D8%AC%D8%A7%D9%85%D8%B9%D8%A7%D8%AA-%D9%88%D8%A7%D8%AC%D8%AA%D9%85%D8%A7%D8%B9%D9%8A%D8%A7%D8%AA/299719160065550 جدول مباريات كأس العالم 2014 https://www.facebook.com/pages/%D9%86%D8%AA%D8%A7%D8%A6%D8%AC-%D8%A7%D9%84%D8%A7%D9%85%D8%AA%D8%AD%D8%A7%D9%86%D8%A7%D8%AA-%D9%88%D8%A7%D9%84%D8%AC%D8%A7%D9%85%D8%B9%D8%A7%D8%AA-%D9%88%D8%A7%D8%AC%D8%AA%D9%85%D8%A7%D8%B9%D9%8A%D8%A7%D8%AA/299719160065550 تقارير خاصة - BBC Arabic - كأس العالم 2014 https://www.facebook.com/pages/%D9%86%D8%AA%D8%A7%D8%A6%D8%AC-%D8%A7%D9%84%D8%A7%D9%85%D8%AA%D8%AD%D8%A7%D9%86%D8%A7%D8%AA-%D9%88%D8%A7%D9%84%D8%AC%D8%A7%D9%85%D8%B9%D8%A7%D8%AA-%D9%88%D8%A7%D8%AC%D8%AA%D9%85%D8%A7%D8%B9%D9%8A%D8%A7%D8%AA/299719160065550 كأس العالم 2014: تحضيرات المنتخبات الإفريقية https://www.facebook.com/pages/%D9%86%D8%AA%D8%A7%D8%A6%D8%AC-%D8%A7%D9%84%D8%A7%D9%85%D8%AA%D8%AD%D8%A7%D9%86%D8%A7%D8%AA-%D9%88%D8%A7%D9%84%D8%AC%D8%A7%D9%85%D8%B9%D8%A7%D8%AA-%D9%88%D8%A7%D8%AC%D8%AA%D9%85%D8%A7%D8%B9%D9%8A%D8%A7%D8%AA/299719160065550 عمليات بحث متعلقة بـ كأس العالم 2014 تصفيات كأس العالم 2014 اسيا جدول مباريات العراق في تصفيات كأس العالم 2014 كأس العالم 2022 تصفيات كأس العالم 2014 https://www.facebook.com/pages/%D9%86%D8%AA%D8%A7%D8%A6%D8%AC-%D8%A7%D9%84%D8%A7%D9%85%D8%AA%D8%AD%D8%A7%D9%86%D8%A7%D8%AA-%D9%88%D8%A7%D9%84%D8%AC%D8%A7%D9%85%D8%B9%D8%A7%D8%AA-%D9%88%D8%A7%D8%AC%D8%AA%D9%85%D8%A7%D8%B9%D9%8A%D8%A7%D8%AA/299719160065550 كأس العالم: البرازيل تستعد لاطلاق بطولة 2014 https://www.facebook.com/pages/%D9%86%D8%AA%D8%A7%D8%A6%D8%AC-%D8%A7%D9%84%D8%A7%D9%85%D8%AA%D8%AD%D8%A7%D9%86%D8%A7%D8%AA-%D9%88%D8%A7%D9%84%D8%AC%D8%A7%D9%85%D8%B9%D8%A7%D8%AA-%D9%88%D8%A7%D8%AC%D8%AA%D9%85%D8%A7%D8%B9%D9%8A%D8%A7%D8%AA/299719160065550 القنوات الناقلة لكاس العالم 2014 https://www.facebook.com/pages/%D9%86%D8%AA%D8%A7%D8%A6%D8%AC-%D8%A7%D9%84%D8%A7%D9%85%D8%AA%D8%AD%D8%A7%D9%86%D8%A7%D8%AA-%D9%88%D8%A7%D9%84%D8%AC%D8%A7%D9%85%D8%B9%D8%A7%D8%AA-%D9%88%D8%A7%D8%AC%D8%AA%D9%85%D8%A7%D8%B9%D9%8A%D8%A7%D8%AA/299719160065550 كأس العالم 2014 : رابط مجاني لمشاهدة مباراة البرازيل وكرواتيا https://www.facebook.com/pages/%D9%86%D8%AA%D8%A7%D8%A6%D8%AC-%D8%A7%D9%84%D8%A7%D9%85%D8%AA%D8%AD%D8%A7%D9%86%D8%A7%D8%AA-%D9%88%D8%A7%D9%84%D8%AC%D8%A7%D9%85%D8%B9%D8%A7%D8%AA-%D9%88%D8%A7%D8%AC%D8%AA%D9%85%D8%A7%D8%B9%D9%8A%D8%A7%D8%AA/299719160065550 أخبار كأس العالم 2014 م بالبرازيل
Re: Lines on a tkinter.Canvas
On 6/12/2014 7:38 AM, Gregory Ewing wrote: Pedro Izecksohn wrote: The Canvas' method create_line turns on at least 2 pixels. But I want to turn on many single pixels on a Canvas. You could try using a 1x1 rectangle instead. However, be aware that either of these will use quite a lot of memory per pixel. If you are drawing a very large number of pixels, this could cause performance problems. Pedro, the tkinter canvas is a vector graphics canvas, not a bitmap image canvas as in paint programs. In that case, you might want to use a different approach, such as creating an image and telling the canvas to display the image. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Asymmetry in globals __getitem__/__setitem__
Hi all, I have noticed there is a slight asymmetry in the way the interpreter (v3.3.5, reproduced also in v3.5.x) loads and stores globals. While loading globals from a custom mapping triggers __getitem__ just fine, writing seems to silently ignore __setitem__. class Namespace(dict): def __getitem__(self, key): print(getitem, key) def __setitem__(self, key, value): print(setitem, key, value) def fun(): global x, y x # should call globals.__getitem__ y = 1 # should call globals.__setitem__ exec(fun.__code__, Namespace()) # = getitem x I would have expected setitem y 1 to show up as well, but to no avail. Am I doing something wrong? Is this on purpose? Cheers, Robert PS. I found a 3.3.x commit (e3ab8aa http://hg.python.org/cpython/rev/e3ab8aa0216c) which fixed the LOAD_GLOBAL opcode to support other types than dict, but STORE_GLOBAL seems to use bare PyDict_SetItem instead of dispatching to PyObject_SetItem. -- https://mail.python.org/mailman/listinfo/python-list
Re: Asymmetry in globals __getitem__/__setitem__
On Thu, Jun 12, 2014 at 12:18 PM, Robert Lehmann m...@robertlehmann.de wrote: Hi all, I have noticed there is a slight asymmetry in the way the interpreter (v3.3.5, reproduced also in v3.5.x) loads and stores globals. While loading globals from a custom mapping triggers __getitem__ just fine, writing seems to silently ignore __setitem__. class Namespace(dict): def __getitem__(self, key): print(getitem, key) def __setitem__(self, key, value): print(setitem, key, value) def fun(): global x, y x # should call globals.__getitem__ y = 1 # should call globals.__setitem__ exec(fun.__code__, Namespace()) # = getitem x I would have expected setitem y 1 to show up as well, but to no avail. Am I doing something wrong? Is this on purpose? Seems like a bug to me. I note that the STORE_NAME opcode does call __setitem__: code = compile('x = 1', '', 'exec') dis.dis(code) 1 0 LOAD_CONST 0 (1) 3 STORE_NAME 0 (x) 6 LOAD_CONST 1 (None) 9 RETURN_VALUE exec(code, Namespace()) setitem x 1 But STORE_GLOBAL does not: code = compile('global x; x = 1', '', 'exec') dis.dis(code) 1 0 LOAD_CONST 0 (1) 3 STORE_GLOBAL 0 (x) 6 LOAD_CONST 1 (None) 9 RETURN_VALUE exec(code, Namespace()) -- https://mail.python.org/mailman/listinfo/python-list
Re: Asymmetry in globals __getitem__/__setitem__
On Fri, Jun 13, 2014 at 4:18 AM, Robert Lehmann m...@robertlehmann.de wrote: PS. I found a 3.3.x commit (e3ab8aa) which fixed the LOAD_GLOBAL opcode to support other types than dict, but STORE_GLOBAL seems to use bare PyDict_SetItem instead of dispatching to PyObject_SetItem. This looks like something for a tracker issue. I agree with Ian, seems like a bug. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Suds 4.1 Beta Assertion Failure
It turns out I was passing the parameters incorrectly to the generateReportSQL method. This is what I had: result=reportservice.generateReportSQL(rptRef, paramRpt, sessionid) This is what works: result=XMLservice.generateReportSQL({'reportPath':rptRef},sessionid) I have another issue. When I make the call to return data apparently the result set is too big for suds and I get a MemoryError. Here is my code snippet: print 'executing SQL Query:',len(logicalSQL) executionOptions={'async':False,'maxRowsPerPage':50,'refresh':True,'presentationInfo':False,'type':'Q1'} XMLservice=obiclient.service['XmlViewService'] result=XMLservice.executeSQLQuery(logicalSQL,'SAWRowsetData',executionOptions,sessionid) When I run it I get: executing SQL Query: 5968 Traceback (most recent call last): File C:\temp\obiee\obieetest.py, line 105, in module result=XMLservice.executeSQLQuery(logicalSQL,'SAWRowsetData',executionOptions,sessionid) File build\bdist.win32\egg\suds\client.py, line 542, in __call__ File build\bdist.win32\egg\suds\client.py, line 602, in invoke File build\bdist.win32\egg\suds\client.py, line 643, in send File build\bdist.win32\egg\suds\transport\https.py, line 64, in send File build\bdist.win32\egg\suds\transport\http.py, line 79, in send File C:\Python27\lib\socket.py, line 358, in read buf.write(data) MemoryError: out of memory -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: This Swift thing
On Thursday 12 June 2014 13:18:00 Chris Angelico did opine And Gene did reply: On Fri, Jun 13, 2014 at 3:04 AM, Steven D'Aprano I'm saying that, whatever the practical engineering limits turn out to be, we're unlikely to be close to them, and therefore there are very likely to be many and massive efficiency gains to be made in computing. And this I totally agree with. The limits of physics are so incredibly far from where we now are that we can utterly ignore them; the limits we face are generally engineering (with the exception of stuff designed for humans to use, eg minimum useful key size is defined by fingers and not by what we can build). ChrisA Thats a bit too blanketish a statement, we do see it in the real world. Some of the electronics stuff we've been using for nearly 50 years actually runs into the e=MC^2 effects, and it affects their performance in pretty deleterious ways. A broadcast power klystron, like a 4KM100LA, which is an electron beam device that does its amplifying by modulating the velocity of an electron beam which is being accelerated by nominally a 20,000 volt beam supply. But because of the beam speed from that high a voltage brings in relativity effects from e=MV^2 mass of the electrons in that beam, an equal amount of energy applied to speed it up does not get the same increase in velocity as that same energy applied to slow it down decreases it. This has the net effect of making the transit time greater when under high power drive conditions such as the sync pulses of the now out of style NTSC signal. The net result is a group delay characteristic that is uncorrectable when the baseband video is where you are trying to correct it. In a few words, the shape of the sync signal is damaged. Badly. Because most transmitters of that day used separate amplifiers for the audio, and the receivers have used the 4.5 mhz difference signal to recover the audio in the receiver for the last 63+ years, this Incidental Carrier Phase Modulation noise is impressed into the detected audio. And I am sure that there are many here that can recall back a decade that the UHF stations in your area, all had a what was often called chroma buzz in the audio that was only about 50 db down. Ear fatiguing at best. Market share effecting too. And that translates directly into station income minus signs. It was fixable, but at an additional cost in efficiency of about -20%, but consider what that 20% costs when a station using a 30kw rated transmitter, actually pulls around 225 kwh from the powerline for every hour it is on the air. Bean counters have heart attacks over such figures. Cheers, Gene Heskett -- There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order. -Ed Howdershelt (Author) Genes Web page http://geneslinuxbox.net:6309/gene US V Castleman, SCOTUS, Mar 2014 is grounds for Impeaching SCOTUS -- https://mail.python.org/mailman/listinfo/python-list
Re: Lines on a tkinter.Canvas
As Peter Otten did not see the same result that I saw, I prepared an image that shows the result on my notebook: http://izecksohn.com/pedro/python/canvas/tk_window.xcf For those that might not know: xcf is the Gimp's file format. - Original Message - From: Peter Otten To: python-list@python.org Sent: Thursday, June 12, 2014 4:02 AM Subject: Re: Lines on a tkinter.Canvas Pedro Izecksohn wrote: The code available from: http://izecksohn.com/pedro/python/canvas/testing.py draws 2 horizontal lines on a Canvas. Why the 2 lines differ on thickness and length? The Canvas' method create_line turns on at least 2 pixels. But I want to turn on many single pixels on a Canvas. How should I do this? Canvas has no method create_pixel or create_point. #!/usr/bin/python3 import tkinter as tk class Point (): def __init__ (self, x, y): self.x = x self.y = y class Board (tk.Frame): def __init__ (self, bg, dimensions): tk.Frame.__init__ (self, tk.Tk()) self.pack() self.canvas = tk.Canvas (self, bd = 0, bg = bg, width = dimensions.x, height = dimensions.y) self.canvas.pack (side = top) def drawLine (self, pa, pb, color): self.canvas.create_line (pa.x, pa.y, pb.x, pb.y, fill = color) def drawPoint (self, p, color): self.canvas.create_line (p.x, p.y, p.x, p.y, fill = color) dimensions = Point (500, 500) board = Board ('black', dimensions) color = 'red' p = Point (0, 250) while (p.x dimensions.x): board.drawPoint (p, color) p.x += 1 pa = Point (0, 350) pb = Point (499, 350) board.drawLine (pa, pb, color) board.mainloop() I just tried your script, and over here the line drawn with def drawLine (self, pa, pb, color): self.canvas.create_line (pa.x, pa.y, pb.x, pb.y, fill = color) has a width of 1 pixel and does not include the end point. Therefore the line drawn with def drawPoint (self, p, color): self.canvas.create_line (p.x, p.y, p.x, p.y, fill = color) does not show up at all. You could try to specify the line width explicitly: def drawPoint (self, p, color): self.canvas.create_line (p.x, p.y, p.x+1, p.y, fill=color, width=1) If that doesn't work (or there's too much overhead) use pillow to prepare an image and show that. Another random idea: if you have a high resolution display your OS might blow up everything. In that case there would be no fix on the application level. -- https://mail.python.org/mailman/listinfo/python-list
Re: idle glitch while building python 3.4 from sources
I just upgraded to Python 3.4.1 AMD64 for Windows 7 using the binaries, and this appears to have affected the Windows binary distribution. osmith@WOTSIT /c/Python34/Lib/idlelib $ python idle.py ** IDLE can't import Tkinter. Your Python may not be configured for Tk. ** -- https://mail.python.org/mailman/listinfo/python-list
Re: Lines on a tkinter.Canvas
- Original Message - From: Gregory Ewing To: python-list@python.org Sent: Thursday, June 12, 2014 8:38 AM Subject: Re: Lines on a tkinter.Canvas Pedro Izecksohn wrote: The Canvas' method create_line turns on at least 2 pixels. But I want to turn on many single pixels on a Canvas. You could try using a 1x1 rectangle instead. pedro@microboard:~/programming/python/tk/canvas$ diff old/testing.001.py testing.py 19c19 self.canvas.create_line (p.x, p.y, p.x, p.y, fill = color) --- self.canvas.create_rectangle (p.x, p.y, p.x, p.y, fill = color) The result that I got is: The line drawn by it is not shown. However, be aware that either of these will use quite a lot of memory per pixel. If you are drawing a very large number of pixels, this could cause performance problems. In that case, you might want to use a different approach, such as creating an image and telling the canvas to display the image. I did not try this yet. -- https://mail.python.org/mailman/listinfo/python-list
Re: Lines on a tkinter.Canvas
- Original Message - From: Gregory Ewing To: python-list@python.org Cc: Sent: Thursday, June 12, 2014 8:38 AM Subject: Re: Lines on a tkinter.Canvas Pedro Izecksohn wrote: The Canvas' method create_line turns on at least 2 pixels. But I want to turn on many single pixels on a Canvas. You could try using a 1x1 rectangle instead. However, be aware that either of these will use quite a lot of memory per pixel. If you are drawing a very large number of pixels, this could cause performance problems. In that case, you might want to use a different approach, such as creating an image and telling the canvas to display the image. Thank you Greg. Your second approach works and the script became: #!/usr/bin/python3 import tkinter as tk BITMAP = ''' #define im_width 1 #define im_height 1 static char im_bits[] = { 0xff }; ''' class Point (): def __init__ (self, x, y): self.x = x self.y = y class Board (tk.Frame): def __init__ (self, bg, dimensions): tk.Frame.__init__ (self, tk.Tk()) self.pack() self.canvas = tk.Canvas (self, bd = 0, bg = bg, width = dimensions.x, height = dimensions.y) self.canvas.pack (side = top) self.objects_drawn = [] def drawLine (self, pa, pb, color): self.canvas.create_line (pa.x, pa.y, pb.x, pb.y, fill = color) def drawPoint (self, p, color): bitmap = tk.BitmapImage (data=BITMAP, foreground = color) self.objects_drawn.append (bitmap) self.canvas.create_image (p.x, p.y, image = bitmap) dimensions = Point (500, 500) board = Board ('black', dimensions) color = 'red' p = Point (0, 250) while (p.x dimensions.x): board.drawPoint (p, color) p.x += 1 pa = Point (0, 350) pb = Point (499, 350) board.drawLine (pa, pb, color) board.mainloop() -- https://mail.python.org/mailman/listinfo/python-list
http://bugs.python.org/issue19495 timeit enhancement
The request is for a class within timeit that allows you to test code inside a with block. It strikes me as being useful but there's only one response on the issue, albeit a positive one. If others here think this would be a useful addition I'll see if I can take this forward, unless there are any timeit fans lurking who'd like to run with it themselves. -- 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: idle glitch while building python 3.4 from sources
On 6/12/2014 4:35 PM, kfs...@gmail.com wrote: I just upgraded to Python 3.4.1 AMD64 for Windows 7 using the binaries, Upgraded from what to what with what? Which binaries? Details matter. and this appears to have affected the Windows binary distribution. osmith@WOTSIT /c/Python34/Lib/idlelib $ python idle.py ** IDLE can't import Tkinter. Your Python may not be configured for Tk. ** Try idle.bat --- Running idle with binaries you compile from the sources, using the VS project files in pcbuild, is a different story. If you are actually doing that, read the devguide and ask me for the missing detail. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Lines on a tkinter.Canvas
Pedro Izecksohn wrote: Thank you Greg. Your second approach works and the script became: That's not really what I meant; doing it that way, you're still incurring the overhead of a tk canvas object for each point that you draw. However, if there are only 250 points or so, it might not matter. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: Asymmetry in globals __getitem__/__setitem__
Robert Lehmann wrote: I have noticed there is a slight asymmetry in the way the interpreter (v3.3.5, reproduced also in v3.5.x) loads and stores globals. While loading globals from a custom mapping triggers __getitem__ just fine, writing seems to silently ignore __setitem__. I didn't think that using a custom mapping object for globals was officially supported. Has that changed? -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: http://bugs.python.org/issue19495 timeit enhancement
On Fri, 13 Jun 2014 00:35:43 +0100, Mark Lawrence wrote: The request is for a class within timeit that allows you to test code inside a with block. It strikes me as being useful but there's only one response on the issue, albeit a positive one. If others here think this would be a useful addition I'll see if I can take this forward, unless there are any timeit fans lurking who'd like to run with it themselves. I have a Stopwatch() context manager which I have been using for a long time, very successfully. There's an early version here: http://code.activestate.com/recipes/577896 I'll clean it up and submit it on the bug tracker. -- Steven D'Aprano http://import-that.dreamwidth.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: This Swift thing
On Thursday, June 12, 2014 10:48:00 PM UTC+5:30, Chris Angelico wrote: On Fri, Jun 13, 2014 at 3:04 AM, Steven D'Aprano Take three numbers, speeds in this case, s1, s2 and c, with c a strict upper-bound. We can take: s1 s2 c without loss of generality. So in this case, we say that s2 is greater than s1: s2 s1 Adding the constant c to both sides does not change the inequality: c + s2 c + s1 As long as we accept that this is purely in a mathematical sense. Let's not get into the realm of actual speeds greater than c. You got a keen eye Chris -- didn't notice that! And captures my point better than my long-winded attempts -- https://mail.python.org/mailman/listinfo/python-list
Re: http://bugs.python.org/issue19495 timeit enhancement
On 13Jun2014 00:44, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Fri, 13 Jun 2014 00:35:43 +0100, Mark Lawrence wrote: The request is for a class within timeit that allows you to test code inside a with block. It strikes me as being useful but there's only one response on the issue, albeit a positive one. If others here think this would be a useful addition I'll see if I can take this forward, unless there are any timeit fans lurking who'd like to run with it themselves. I have a Stopwatch() context manager which I have been using for a long time, very successfully. There's an early version here: http://code.activestate.com/recipes/577896 I'll clean it up and submit it on the bug tracker. And I have a LogTimer context manager that emits a log message when a with suite exceeds a threshold. I'm sure it is far cruder and limited than Steven's; I'm mentioning it in support of the use case. Cheers, Cameron Simpson c...@zip.com.au 1993 Explorer - Cage? Hell, it's a prison. - Will Hartung vfr...@netcom.com -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: This Swift thing
On Fri, 13 Jun 2014 03:18:00 +1000, Chris Angelico wrote: On Fri, Jun 13, 2014 at 3:04 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: [...] Take three numbers, speeds in this case, s1, s2 and c, with c a strict upper-bound. We can take: s1 s2 c without loss of generality. So in this case, we say that s2 is greater than s1: s2 s1 Adding the constant c to both sides does not change the inequality: c + s2 c + s1 As long as we accept that this is purely in a mathematical sense. Let's not get into the realm of actual speeds greater than c. Well, yes, it is in the mathematical sense, and it doesn't require any actual physical thing to travel at faster than light speed. There is no implication here that there is something travelling at (c + s1). It's just a number. But note that even in *real* (as opposed to science fiction, or hypothetical) physics, you can have superluminal speeds. Both the phase velocity and group velocity of a wave may exceed c; the closing velocity of two objects approaching each other is limited to 2c. Distant galaxies are receding from us at greater than c. There are other situations where some measurable effect can travel faster than c, e.g. the superluminal spotlight effect. https://en.wikipedia.org/wiki/Faster-than-light -- Steven D'Aprano http://import-that.dreamwidth.org/ -- https://mail.python.org/mailman/listinfo/python-list
Python deepcopy to while statement
Hi, all I want to make the function use while statement,and without a deepcopy functions. this is my use deepcopy function correct codes, So, how can i to do a different way and use while statement: def foo(x): if not isinstance(x, list): return x return [foo(y) for y in x] -- https://mail.python.org/mailman/listinfo/python-list
C-API proper initialization and deallocation of subclasses
Hello all, I decided to play around with the C-API and have gotten stuck. I went through the Shoddy example (https://docs.python.org/3/extending/newtypes.html#subclassing-other-types) in the docs and tried to extend it by adding a method which creates and returns a shoddy instance. I dug around to find ways to allocate and initialize my shoddy instance and that seems to work well. However, I get segfaults when I try to delete my instance. The code is in the gist: https://gist.github.com/pbrady/f2daf50761e458bbe44a The magic happens in the make_a_shoddy function. Here's a sample session (Python 3.4.1) from shoddy import make_a_shoddy() shd = make_a_shoddy() tup build shd allocated list style allocation successful Py_SIZE(list) : 5 Py_SIZE(shoddy) : 5 type(shd) class 'shoddy.Shoddy' shd[:] [1, 2, 3, 4, 5] shd.increment() 1 shd.increment() 2 del shd Segmentation fault (core dumped) This happens even if I don't set the destructor. Any ideas on what I am doing wrong? Thanks, Peter. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python deepcopy to while statement
2014年6月13日金曜日 12時47分19秒 UTC+9 hito koto: Hi, all I want to make the function use while statement,and without a deepcopy functions. this is my use deepcopy function correct codes, So, how can i to do a different way and use while statement: def foo(x): if not isinstance(x, list): return x return [foo(y) for y in x] I write this code but this is not copy: maybe have to write one more the while statements: but i can't. def foo(x): y = [] i = len(x)-1 while i = 0: y.append(x[i]) i -= 1 return y -- https://mail.python.org/mailman/listinfo/python-list
Re: Python deepcopy to while statement
2014年6月13日金曜日 12時47分19秒 UTC+9 hito koto: Hi, all I want to make the function use while statement,and without a deepcopy functions. this is my use deepcopy function correct codes, So, how can i to do a different way and use while statement: def foo(x): if not isinstance(x, list): return x return [foo(y) for y in x] I write this code but this is not copy: maybe noe more write while statements: but i can't. def foo(x): y = [] i = len(x)-1 while i = 0: y.append(x[i]) i -= 1 return y -- https://mail.python.org/mailman/listinfo/python-list
[issue21707] modulefinder uses wrong CodeType signature in .replace_paths_in_code()
Berker Peksag added the comment: Here's a patch with a test. -- keywords: +patch nosy: +berker.peksag stage: - patch review type: - behavior Added file: http://bugs.python.org/file35587/issue21707.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21707 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21729] Use `with` statement in dbm.dumb
New submission from Claudiu.Popa: Hello. Here's a short patch for dbm.dumb, which uses in various places the `with` statement for opening and closing files. Thanks. -- components: Library (Lib) files: dbm_with_open.patch keywords: patch messages: 220335 nosy: Claudiu.Popa, serhiy.storchaka priority: normal severity: normal status: open title: Use `with` statement in dbm.dumb type: enhancement versions: Python 3.5 Added file: http://bugs.python.org/file35588/dbm_with_open.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21729 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21729] Use `with` statement in dbm.dumb
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - serhiy.storchaka priority: normal - low stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21729 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19884] Importing readline produces erroneous output
STINNER Victor added the comment: Attached readline_disable_meta_key.patch: Implement the workaround suggested in (*), but only use the workaround if stdout is not a TTY (ex: output redirected), to limit the risk of regression. (*) http://lists.gnu.org/archive/html/bug-readline/2011-04/msg9.html Extract of the patch: +if (!isatty(STDOUT_FILENO)) { +/* Issue #19884: Don't try to enable any meta modifier key the terminal + claims to support when it is called. On many terminals (ex: + xterm-256color), the meta key is used to send eight-bit characters + (ANSI sequence \033[1034h). */ +rl_variable_bind (enable-meta-key, off); +} This issue becomes very annoying on my Fedora 20. The output of any Mercurial command now starts with \033.[?1034h (Mercurial uses Python 2.7). Example: haypo@smithers$ hg root|hexdump -C 1b 5b 3f 31 30 33 34 68 2f 68 6f 6d 65 2f 68 61 |.[?1034h/home/ha| 0010 79 70 6f 2f 70 72 6f 67 2f 70 79 74 68 6f 6e 2f |ypo/prog/python/| 0020 64 65 66 61 75 6c 74 0a |default.| 0028 Fedora 18 changed the default TERM environment variable to xterm-256color: http://fedoraproject.org/wiki/Features/256_Color_Terminals Workaround in your application (to run on unpatched Python): set the TERM environment variable to dummy, or unset this variable. -- keywords: +patch nosy: +haypo Added file: http://bugs.python.org/file35589/readline_disable_meta_key.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19884 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21425] Interactive interpreter doesn't flush stderr prompty
Changes by Berker Peksag berker.pek...@gmail.com: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21425 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21205] Add __qualname__ attribute to Python generators and change default __name__
STINNER Victor added the comment: Discussion on python-dev: https://mail.python.org/pipermail/python-dev/2014-June/135026.html -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21205 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12387] IDLE save keyboard shortcut problem
Saimadhav Heblikar added the comment: Attached patch is an attempt to fix the issue, based on msg220332. With this patch, and with IDLE Classic Unix keybinding selected in IDLE, actions like cut=Control-Key-w, redo=Alt-Key-z Meta-Key-z, and emac's style actions like open-new-window=Control-Key-xControl-Key-n, can be performed by just pressing the respective keys, irrespective of CAPS. I would like to know if this patch is acceptable and whether it performs as expected on all platforms. -- Added file: http://bugs.python.org/file35590/keybinding-issue12387-v1.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12387 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12387] IDLE save keyboard shortcut problem
Changes by Saimadhav Heblikar saimadhavhebli...@gmail.com: Removed file: http://bugs.python.org/file35590/keybinding-issue12387-v1.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12387 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12387] IDLE save keyboard shortcut problem
Changes by Saimadhav Heblikar saimadhavhebli...@gmail.com: Added file: http://bugs.python.org/file35591/keybinding-issue12387-v1.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12387 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12387] IDLE save keyboard shortcut problem
Changes by Saimadhav Heblikar saimadhavhebli...@gmail.com: Removed file: http://bugs.python.org/file35591/keybinding-issue12387-v1.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12387 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12387] IDLE save keyboard shortcut problem
Changes by Saimadhav Heblikar saimadhavhebli...@gmail.com: Added file: http://bugs.python.org/file35592/keybinding-issue12387-v1.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12387 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21730] test_socket fails --without-threads
New submission from Berker Peksag: Here's the traceback (tested on Ubuntu 12.04): == ERROR: testBCM (test.test_socket.CANTest) -- Traceback (most recent call last): File /home/berker/projects/cpython-default/Lib/test/test_socket.py, line 231, in _setUp self.server_ready = threading.Event() AttributeError: 'NoneType' object has no attribute 'Event' == ERROR: testSendFrame (test.test_socket.CANTest) -- Traceback (most recent call last): File /home/berker/projects/cpython-default/Lib/test/test_socket.py, line 231, in _setUp self.server_ready = threading.Event() AttributeError: 'NoneType' object has no attribute 'Event' == ERROR: testSendMaxFrame (test.test_socket.CANTest) -- Traceback (most recent call last): File /home/berker/projects/cpython-default/Lib/test/test_socket.py, line 231, in _setUp self.server_ready = threading.Event() AttributeError: 'NoneType' object has no attribute 'Event' == ERROR: testSendMultiFrames (test.test_socket.CANTest) -- Traceback (most recent call last): File /home/berker/projects/cpython-default/Lib/test/test_socket.py, line 231, in _setUp self.server_ready = threading.Event() AttributeError: 'NoneType' object has no attribute 'Event' -- Patch attached. -- components: Tests files: test_socket_thread.diff keywords: patch messages: 220339 nosy: berker.peksag priority: normal severity: normal stage: patch review status: open title: test_socket fails --without-threads type: behavior versions: Python 3.4, Python 3.5 Added file: http://bugs.python.org/file35593/test_socket_thread.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21730 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20043] test_multiprocessing_main_handling fails --without-threads
Berker Peksag added the comment: This test is still failing on AMD64 Fedora without threads 3.x. http://buildbot.python.org/all/builders/AMD64%20Fedora%20without%20threads%203.x/builds/6743/steps/test/logs/stdio test test_multiprocessing_main_handling crashed -- Traceback (most recent call last): File /home/buildbot/buildarea/3.x.krah-fedora/build/Lib/test/regrtest.py, line 1271, in runtest_inner the_module = importlib.import_module(abstest) File /home/buildbot/buildarea/3.x.krah-fedora/build/Lib/importlib/__init__.py, line 109, in import_module return _bootstrap._gcd_import(name[level:], package, level) File frozen importlib._bootstrap, line 2203, in _gcd_import File frozen importlib._bootstrap, line 2186, in _find_and_load File frozen importlib._bootstrap, line 2175, in _find_and_load_unlocked File frozen importlib._bootstrap, line 1149, in _load_unlocked File frozen importlib._bootstrap, line 1420, in exec_module File frozen importlib._bootstrap, line 321, in _call_with_frames_removed File /home/buildbot/buildarea/3.x.krah-fedora/build/Lib/test/test_multiprocessing_main_handling.py, line 21, in module import multiprocessing File /home/buildbot/buildarea/3.x.krah-fedora/build/Lib/multiprocessing/__init__.py, line 16, in module from . import context File /home/buildbot/buildarea/3.x.krah-fedora/build/Lib/multiprocessing/context.py, line 3, in module import threading File /home/buildbot/buildarea/3.x.krah-fedora/build/Lib/threading.py, line 4, in module import _thread ImportError: No module named '_thread' But I couldn't reproduce it on Ubuntu 12.04 (built Python --without-threads): [1/1] test_multiprocessing_main_handling test_multiprocessing_main_handling skipped -- /home/berker/projects/cpython-default/build/lib.linux-x86_64-3.5-pydebug/_multiprocessing.cpython-35dm.so: undefined symbol: PyThread_get_thread_ident 1 test skipped: test_multiprocessing_main_handling -- resolution: fixed - stage: resolved - needs patch status: closed - open versions: +Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20043 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21731] Calendar Problem with Windows (XP)
New submission from Jürgen B: I had a problem with calendar.formatmonth() Error message was 'Unsupported Locale' Well, it seems that Windows (XP) does nothing accept to setlocale than '' I changed /lib/calendar.py line 488 ff to class different_locale: def __init__(self, locale): self.locale = locale def __enter__(self): _locale.setlocale(_locale.LC_TIME, '') # juebo self.oldlocale = _locale.getlocale(_locale.LC_TIME) # _locale.setlocale(_locale.LC_TIME, self.locale) # juebo def __exit__(self, *args): # _locale.setlocale(_locale.LC_TIME, self.oldlocale) #juebo _locale.setlocale(_locale.LC_TIME, '') Well, I am absolute new to Python. So could anybody look over it -- components: Library (Lib) messages: 220341 nosy: Juebo priority: normal severity: normal status: open title: Calendar Problem with Windows (XP) type: compile error versions: Python 2.7, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21731 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10445] _ast py3k : add lineno back to args node
Claudiu.Popa added the comment: This doesn't seem to be the case for Python 3.4. Also, _ast.arguments didn't have lineno and col_offset attributes neither in Python 2. But the _arg.arg nodes have those attributes, as seen in this example. from ast import parse parse( ... def test(a): pass ... ) _ast.Module object at 0x02E43330 f=_ f.body[0].args _ast.arguments object at 0x02E43390 f.body[0].args.lineno Traceback (most recent call last): File stdin, line 1, in module AttributeError: 'arguments' object has no attribute 'lineno' f.body[0].args.args [_ast.arg object at 0x02E43270] f.body[0].args.args[0].lineno 2 -- nosy: +Claudiu.Popa type: resource usage - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10445 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16512] imghdr doesn't support jpegs with an ICC profile
Changes by Claudiu.Popa pcmantic...@gmail.com: -- nosy: +Claudiu.Popa ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16512 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16512] imghdr doesn't support jpegs with an ICC profile
Changes by Claudiu.Popa pcmantic...@gmail.com: -- versions: +Python 3.5 -Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16512 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17911] Extracting tracebacks does too much work
Changes by STINNER Victor victor.stin...@gmail.com: -- components: +asyncio nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17911 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19816] test.regrtest: use tracemalloc to detect memory leaks?
STINNER Victor added the comment: I tried different options to show the memory leaks found by tracemalloc, but I'm not satisfied by any option. I get a lot of noise, the output is almost useless. Randomly, between 1 and 1000 KB are allocated or released in random files: in unittest or linecache modules for example. It looks like the major issue is that the unittest leaks memory. For example, there are still 4 TestCase instances alive after the execution of test_sys. But later, these instances are deleted. It looks like it creates reference leaks and so memory is only released late. Calling gc.collect() doesn't help. I remember that I already saw something strange with the _Outcome class used in unittest.TestCase.run(). See the issue #19880 (changeset 09658ea0b93d). The asyncio module has a similar issue: it stores an exception which indirectly contains a reference cycle in the Exception.__traceback__ attribute. http://bugs.python.org/issue17911 https://code.google.com/p/tulip/issues/detail?id=155 -- keywords: +patch Added file: http://bugs.python.org/file35594/regrtest.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19816 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19816] test.regrtest: use tracemalloc to detect memory leaks?
STINNER Victor added the comment: regrtest.patch is a work-in-progress patch. It shows the top 10 when the -R option is used, ex: python -m test -R 3:3 test_sys. -- nosy: +sahutd ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19816 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16512] imghdr doesn't support jpegs with an ICC profile
Claudiu.Popa added the comment: Using \xff\xd8 sounds good to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16512 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16512] imghdr doesn't support jpegs with an ICC profile
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16512 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16512] imghdr doesn't support jpegs with an ICC profile
Kovid Goyal added the comment: FYI, the test I currently use in calibre, which has not failed so far for millions of users: def test_jpeg(h, f): if (h[6:10] in (b'JFIF', b'Exif')) or (h[:2] == b'\xff\xd8' and (b'JFIF' in h[:32] or b'8BIM' in h[:32])): return 'jpeg' -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16512 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21731] Calendar Problem with Windows (XP)
R. David Murray added the comment: The code is mostly correct as it exists in the calendar module. You are running into issue 10466. Per my comment in that issue, it may be possible to put a workaround into the calendar module, but your suggestion isn't it, since your code would leave the locale modified, not restored to its value before the calendar function was called. What happens if you replace the original setlocale call in __enter__ with a try/except, and if the set fails, redo the set call using ''? Does the save of oldlocale and its restore work in that case? -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21731 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21727] Ambiguous sentence explaining `cycle` in itertools documentation
Matt Deacalion Stevens added the comment: It's probably just me then. The code example is what helped me grasp `cycle`, not the explanation. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21727 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10466] locale.py resetlocale throws exception on Windows (getdefaultlocale returns value not usable in setlocale)
R. David Murray added the comment: See issue 21731 for considering putting a workaround for this into the calendar module (noted here because of msg122065). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10466 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10466] locale.py resetlocale throws exception on Windows (getdefaultlocale returns value not usable in setlocale)
R. David Murray added the comment: Oh, I see I'd already previously opened issue 10498 for that. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10466 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10498] calendar.LocaleHTMLCalendar.formatyearpage() results in traceback with 'unsupported locale setting' on Windows
R. David Murray added the comment: I'm closing this in favor of issue 21731, which has a proposed (though I believe incorrect) patch. -- resolution: - duplicate stage: test needed - resolved status: open - closed superseder: - Calendar Problem with Windows (XP) ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10498 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21731] Calendar Problem with Windows (XP)
Jürgen B added the comment: Yes, Issue 10466 seems to be the same problem. One could fix this one instance higher, not necessarily in Calendar.py. As I said, I have no idea about Python (not yet). You could code this and I would test it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21731 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21652] Python 2.7.7 regression in mimetypes module on Windows
Gavin Carothers added the comment: Issue also exists in Pyramid (any wsgi server/framework) See https://github.com/Pylons/pyramid/issues/1360 for Pyramid bug. -- nosy: +gcarothers ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21652 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21733] mmap(size=9223372036854779904) failed message when running test_io on AMD64 Snow Leop 3.x buildbot
New submission from STINNER Victor: http://buildbot.python.org/all/builders/AMD64%20Snow%20Leop%203.x/builds/1734/steps/test/logs/stdio python.exe(59021,0x7fff71296cc0) malloc: *** mmap(size=9223372036854779904) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug python.exe(59021,0x7fff71296cc0) malloc: *** mmap(size=9223372036854779904) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug python.exe(59021,0x7fff71296cc0) malloc: *** mmap(size=9223372036854779904) failed (error code=12) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug [212/390] test_io -- assignee: ronaldoussoren components: Macintosh, Tests keywords: buildbot messages: 220356 nosy: haypo, ronaldoussoren priority: normal severity: normal status: open title: mmap(size=9223372036854779904) failed message when running test_io on AMD64 Snow Leop 3.x buildbot ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21733 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21732] SubprocessTestsMixin.test_subprocess_terminate() hangs on AMD64 Snow Leop 3.x buildbot
STINNER Victor added the comment: I checked builds 1722..1742: it looks like this issue only occured once. -- assignee: - ronaldoussoren components: +Macintosh nosy: +ronaldoussoren ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21732 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21732] SubprocessTestsMixin.test_subprocess_terminate() hangs on AMD64 Snow Leop 3.x buildbot
New submission from STINNER Victor: http://buildbot.python.org/all/builders/AMD64%20Snow%20Leop%203.x/builds/1742/steps/test/logs/stdio Timeout (1:00:00)! Thread 0x7fff71296cc0 (most recent call first): File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/selectors.py, line 311 in select File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/asyncio/base_events.py, line 822 in _run_once File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/asyncio/base_events.py, line 195 in run_forever File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/asyncio/base_events.py, line 215 in run_until_complete File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/test_asyncio/test_events.py, line 1492 in test_subprocess_terminate File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/unittest/case.py, line 577 in run File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/unittest/case.py, line 625 in __call__ File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/unittest/suite.py, line 125 in run File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/unittest/suite.py, line 87 in __call__ File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/unittest/suite.py, line 125 in run File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/unittest/suite.py, line 87 in __call__ File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/unittest/suite.py, line 125 in run File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/unittest/suite.py, line 87 in __call__ File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/unittest/runner.py, line 168 in run File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/support/__init__.py, line 1724 in _run_suite File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/support/__init__.py, line 1758 in run_unittest File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/test_asyncio/__init__.py, line 29 in test_main File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/regrtest.py, line 1278 in runtest_inner File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/regrtest.py, line 967 in runtest File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/regrtest.py, line 532 in main File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/regrtest.py, line 1562 in main_in_temp_cwd File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/regrtest.py, line 1587 in module File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/runpy.py, line 85 in _run_code File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/runpy.py, line 170 in _run_module_as_main Traceback (most recent call last): File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/runpy.py, line 170, in _run_module_as_main __main__, mod_spec) File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/runpy.py, line 85, in _run_code exec(code, run_globals) File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/__main__.py, line 3, in module regrtest.main_in_temp_cwd() File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/regrtest.py, line 1562, in main_in_temp_cwd main() File /Users/buildbot/buildarea/3.x.murray-snowleopard/build/Lib/test/regrtest.py, line 738, in main raise Exception(Child error on {}: {}.format(test, result[1])) Exception: Child error on test_asyncio: Exit code 1 [390/390] test_asyncio make: *** [buildbottest] Error 1 -- components: Tests, asyncio messages: 220354 nosy: gvanrossum, haypo, yselivanov priority: normal severity: normal status: open title: SubprocessTestsMixin.test_subprocess_terminate() hangs on AMD64 Snow Leop 3.x buildbot versions: Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21732 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21734] compilation of the _ctypes module fails on OpenIndiana: ffi_prep_closure_loc symbol is missing
New submission from STINNER Victor: http://buildbot.python.org/all/builders/AMD64%20OpenIndiana%203.x/builds/7900/steps/test/logs/stdio gcc -shared (...)Modules/_ctypes/_ctypes.o (...) -o build/lib.solaris-2.11-i86pc.64bit-3.5-pydebug/_ctypes.so (...) *** WARNING: renaming _ctypes since importing it failed: ld.so.1: python: fatal: relocation error: file build/lib.solaris-2.11-i86pc.64bit-3.5-pydebug/_ctypes.so: symbol ffi_prep_closure_loc: referenced symbol not found (...) Failed to build these modules: _ctypes _curses _curses_panel _lzma -- messages: 220357 nosy: haypo priority: normal severity: normal status: open title: compilation of the _ctypes module fails on OpenIndiana: ffi_prep_closure_loc symbol is missing type: compile error versions: Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21734 ___ ___ 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
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ 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
[issue20128] Re-enable test_modules_search_builtin() in test_pydoc
STINNER Victor added the comment: Many test_pydoc tests are failing on the FreeBSD 9 buildbot, example: http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%203.x/builds/6870/steps/test/logs/stdio == FAIL: test_html_doc (test.test_pydoc.PydocDocTest) -- Traceback (most recent call last): File /usr/home/buildbot/buildarea/3.x.krah-freebsd/build/Lib/test/test_pydoc.py, line 418, in test_html_doc self.fail(outputs are not equal, see diff above) AssertionError: outputs are not equal, see diff above == FAIL: test_text_doc (test.test_pydoc.PydocDocTest) -- Traceback (most recent call last): File /usr/home/buildbot/buildarea/3.x.krah-freebsd/build/Lib/test/test_pydoc.py, line 432, in test_text_doc self.fail(outputs are not equal, see diff above) AssertionError: outputs are not equal, see diff above -- ___ 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
[issue21735] test_threading.test_main_thread_after_fork_from_nonmain_thread() hangs on the FreeBSD 10 buildbot
New submission from STINNER Victor: http://buildbot.python.org/all/builders/AMD64%20FreeBSD%2010.0%203.x/builds/2220/steps/test/logs/stdio [390/390] test_threading Timeout (1:00:00)! Thread 0x000801c06400 (most recent call first): File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/selectors.py, line 364 in select File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/subprocess.py, line 1618 in _communicate File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/subprocess.py, line 971 in communicate File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/script_helper.py, line 45 in _assert_python File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/script_helper.py, line 69 in assert_python_ok File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/test_threading.py, line 536 in test_main_thread_after_fork_from_nonmain_thread File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/unittest/case.py, line 577 in run File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/unittest/case.py, line 625 in __call__ File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/unittest/suite.py, line 125 in run File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/unittest/suite.py, line 87 in __call__ File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/unittest/suite.py, line 125 in run File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/unittest/suite.py, line 87 in __call__ File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/unittest/suite.py, line 125 in run File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/unittest/suite.py, line 87 in __call__ File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/unittest/runner.py, line 168 in run File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/support/__init__.py, line 1724 in _run_suite File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/support/__init__.py, line 1758 in run_unittest File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/regrtest.py, line 1277 in lambda File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/regrtest.py, line 1278 in runtest_inner File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/regrtest.py, line 967 in runtest File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/regrtest.py, line 532 in main File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/regrtest.py, line 1562 in main_in_temp_cwd File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/regrtest.py, line 1587 in module File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/runpy.py, line 85 in _run_code File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/runpy.py, line 170 in _run_module_as_main Traceback (most recent call last): File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/runpy.py, line 170, in _run_module_as_main __main__, mod_spec) File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/runpy.py, line 85, in _run_code exec(code, run_globals) File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/__main__.py, line 3, in module regrtest.main_in_temp_cwd() File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/regrtest.py, line 1562, in main_in_temp_cwd main() File /usr/home/buildbot/koobs-freebsd10/3.x.koobs-freebsd10/build/Lib/test/regrtest.py, line 738, in main raise Exception(Child error on {}: {}.format(test, result[1])) Exception: Child error on test_threading: Exit code 1 *** Error code 1 -- components: Tests keywords: buildbot messages: 220359 nosy: haypo priority: normal severity: normal status: open title: test_threading.test_main_thread_after_fork_from_nonmain_thread() hangs on the FreeBSD 10 buildbot versions: Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21735 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12516] imghdr.what should take one argument
Changes by Claudiu Popa pcmantic...@gmail.com: -- nosy: +Claudiu.Popa versions: +Python 3.5 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12516 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21723] Float maxsize is treated as infinity in asyncio.Queue
Vajrasky Kok added the comment: It looks strange to use a float as maxsize. = It is. But the float could be coming programmatically. Float value interpreted as infinity could give a shock for some people. maybe to cast maxsize parameter to an int. = ceiling or flooring? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21723 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12516] imghdr.what should take one argument
Claudiu Popa added the comment: imghdr got a test file in 94813eab5a58. Your patch also needs documentation updates. Besides that, +1 from me. Maybe it would be okay to add a deprecation warning for the second argument? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12516 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21736] Add __file__ attribute to frozen modules
New submission from Marc-Andre Lemburg: The missing __file__ attribute on frozen modules causes lots of issues with the stdlib (see e.g. Issue21709 and the stdlib test suite) and other tools that expect this attribute to always be present. The attached patch for 3.4.1 adds this attribute to all frozen modules and resolves most issues. It cannot resolve the problem of not necessarily finding the directories/files listed in those attributes, but at least makes it possible to continue using code that only uses the attribute for error reporting. -- components: Interpreter Core, Library (Lib) messages: 220362 nosy: lemburg priority: normal severity: normal status: open title: Add __file__ attribute to frozen modules versions: Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21736 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21736] Add __file__ attribute to frozen modules
Changes by Marc-Andre Lemburg m...@egenix.com: -- keywords: +patch Added file: http://bugs.python.org/file35595/__file__-for-frozen-modules.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21736 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21709] logging.__init__ assumes that __file__ is always set
Marc-Andre Lemburg added the comment: While the current patch does not resolve the issue, I'm leaving the issue closed and have instead opened a new Issue21736 which tracks the idea to add a __file__ attribute to frozen modules per default. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21709 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21737] runpy.run_path() fails with frozen __main__ modules
New submission from Marc-Andre Lemburg: The logic in runpy.run_path() assumes that removing the __main__ entry from sys.modules is enough to be able to use the module search logic for e.g. importing packages and ZIP files (with embedded __main__.py files). In Python 3.4 (and probably also 3.3 where the importlib was added), this no longer works if a frozen __main__ module is present. The reason is that the sys.meta_path lists the FrozenImporter before the PathFinder. The runpy trick only works if the PathFinder gets a chance to do its magic, but never gets to play, since the FrozenImporter always returns the existing frozen __main__ module (causing all kinds of strange effects). Now, looking at the implementation, the frozen __main__ is imported by import.c, not the importlib, so a working solution is to not have the FrozenImporter work on __main__ modules at all. This then allows the PathFinder to deal with finding the __main__ module in directories or ZIP files and thus allows the hack in runpy to work again. BTW: In the long run, it would probably better to clean up runpy altogether. It's really messy code due to the many details that it has to address, but I guess this a larger project on its own. -- components: Interpreter Core messages: 220364 nosy: lemburg priority: normal severity: normal status: open title: runpy.run_path() fails with frozen __main__ modules versions: Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21737 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21737] runpy.run_path() fails with frozen __main__ modules
Changes by Marc-Andre Lemburg m...@egenix.com: -- keywords: +patch Added file: http://bugs.python.org/file35596/FrozenImporter-without-__main__-support.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21737 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21736] Add __file__ attribute to frozen modules
Changes by Barry A. Warsaw ba...@python.org: -- nosy: +barry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21736 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21736] Add __file__ attribute to frozen modules
Barry A. Warsaw added the comment: I'm -0 on this patch. I can understand that in some sense, frozen modules do semantically have an associated file, but OTOH, once they're frozen the connection to their file is broken. Also, I think anything that assumes __file__ exists is simply broken and should be fixed. There are other cases than frozen modules where a module would have no reasonable value for __file__ and thus shouldn't have one. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21736 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21230] imghdr does not accept adobe photoshop mime type
Claudiu Popa added the comment: Issue issue16512 has a patch which will recognize this format of JPEG, as well as others. -- nosy: +Claudiu.Popa ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21230 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21736] Add __file__ attribute to frozen modules
Marc-Andre Lemburg added the comment: On 12.06.2014 18:35, Barry A. Warsaw wrote: I'm -0 on this patch. I can understand that in some sense, frozen modules do semantically have an associated file, but OTOH, once they're frozen the connection to their file is broken. Also, I think anything that assumes __file__ exists is simply broken and should be fixed. There are other cases than frozen modules where a module would have no reasonable value for __file__ and thus shouldn't have one. This one falls into the practicality beats purity category. Of course, the __file__ attribute doesn't always makes sense as file path, but it does serve an information purpose. We're doing this in eGenix PyRun to get 3rd party code working (including parts of the Python stdlib :-)). Not doing so would simply lead to the whole freezing approach pretty much useless, since so much code uses the attribute without checking or providing a fallback solution. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21736 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21736] Add __file__ attribute to frozen modules
Barry A. Warsaw added the comment: PBP might be reasonably used to justify it for the frozen case. I just don't want to use that as a wedge to define __file__ in *all* cases, even when no reasonable file name exists. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21736 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21205] Add __qualname__ attribute to Python generators and change default __name__
STINNER Victor added the comment: @Antoine: Can you please review gen_qualname.patch? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21205 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21737] runpy.run_path() fails with frozen __main__ modules
Changes by Berker Peksag berker.pek...@gmail.com: -- nosy: +brett.cannon, eric.snow, ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21737 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21709] logging.__init__ assumes that __file__ is always set
Vinay Sajip added the comment: While the current patch does not resolve the issue, I'm leaving the issue closed That's fine - I will implement the changes we discussed in this issue, even if it's something of a stop-gap. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21709 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21733] mmap(size=9223372036854779904) failed message when running test_io on AMD64 Snow Leop 3.x buildbot
Changes by Ned Deily n...@acm.org: -- resolution: - duplicate stage: - resolved status: open - closed superseder: - Malloc errors in test_io ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21733 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com