Re: Python programming

2014-03-07 Thread Larry Hudson

snip


I spotted a device on the table of the company calibration office...

As I recall, it was a 100A capable resistor... 0.10 OHM.

No idea what it was meant for; big binding posts at one end, and a slab
of sheet steel in a W shape (smooth curves, not sharp bends).


External shunt for an ammeter?



More likely a dummy load for power supply testing.  (Normally, ammeter shunts 
are sized to dissipate as little power as possible.)

-Bill



Another (OT) story...

I used to work in an electronic calibration lab, but I don't recall having a resistor of that 
description -- however, it reminds me of another story...


While our job was calibrating and maintaining our company's electronics, we occasionally had to 
do some incoming inspection work -- checking incoming components for accuracy.  This particular 
time I had a batch of 0.1 ohm 1% resistors (I think those were the numbers, at least something 
on that order).  I found by checking them right at the body of the resistors they were 
out-of-spec low, and checking at the end of the leads they were out-of-spec high.  Fun!   :-)


To measure them, I used the lab's Current Calibrator -- a special power supply whose voltage was 
controlled to give a constant (dialed-in) current.  Then with a DVM and mini-hooks I could 
attach these DVM leads anyplace along the resistor's leads.  At 1 amp, the voltage (read on the 
DVM) was equal to the resistance.  Ohm's law, of course:  R = E/I, where I is a constant 1.  And 
1 amp was well within the power specs of these resistors.


I ended up checking them at a distance of about a quarter inch from the body, because I expected 
that would be about the way they would be eventually mounted.  They all passed that way.  And 
fortunately I never had another batch of these resistors!   :-)


 -=- Larry -=-

--
https://mail.python.org/mailman/listinfo/python-list


Re: why does python --version write to standard error?

2014-03-07 Thread Ned Deily
In article 20140307075744.ga43...@cskk.homeip.net,
 Cameron Simpson c...@zip.com.au wrote:

 This seems to write the python version to standard error. That seems
 very wrong. And at variance with the manual entry.

Fixed in Python 3.4:
http://bugs.python.org/issue18338

-- 
 Ned Deily,
 n...@acm.org

-- 
https://mail.python.org/mailman/listinfo/python-list


problem running python 3.3 on mac os mavericks

2014-03-07 Thread Romil Agrawal
I currently installed python 3.3.4 on mac os mavericks, and want to run it
on Wing IDE. Previously it was running python 2.7.6. When I tried to change
the python excitable in the wing ide configuration mode, and then restarted
it, a dialog box was displayed that said the interpreter of python 3.3.4 on
the specified path may not exist. Please help me sort this out. Also,
python 3.3.4 is installed on my mac and running on the IDLE, but the
terminal shows that the current version of python is 2.7.6. how can it be
possible. Please suggest something to sort this thing out.

Thanking you.
Regards,
Romil Agrawal
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tuples and immutability

2014-03-07 Thread Duncan Booth
Chris Angelico ros...@gmail.com wrote:

 On Sat, Mar 1, 2014 at 1:41 AM, Joshua Landau jos...@landau.ws
 wrote: 
 Would it be better to add a check here, such that if this gets raised
 to the top-level it includes a warning (Addition was inplace;
 variable probably mutated despite assignment failure)?
 
 That'd require figuring out whether or not the variable was actually
 mutated, and that's pretty hard to work out. So there's a FAQ entry,
 which Zachary already posted:
 
 http://docs.python.org/3/faq/programming.html#why-does-a-tuple-i-item-r
 aise-an-exception-when-the-addition-works 
 
 Also, we just answer this question every now and then :) Presumably
 more often on -tutor than here.
 
 ChrisA
Another take on this that I haven't seen discussed in this thread:

Is there any reason why tuples need to throw an exception on assigning to 
the element if the old value and new value are the same object?

If I say:

a = (spam, [10, 30], eggs)

then

a[0] = a[0]

won't actually mutate the object. So tuples could let that silently pass. 
Then you would be able to safely do:

a[1] += [50]

but this would still throw an exception:

a[0] += x



-- 
Duncan Booth http://kupuguy.blogspot.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: why does python --version write to standard error?

2014-03-07 Thread Cameron Simpson
On 07Mar2014 00:31, Ned Deily n...@acm.org wrote:
 In article 20140307075744.ga43...@cskk.homeip.net,
  Cameron Simpson c...@zip.com.au wrote:
  This seems to write the python version to standard error. That seems
  very wrong. And at variance with the manual entry.
 
 Fixed in Python 3.4:
 http://bugs.python.org/issue18338

Excellent! My thanks to Berker Peksag and Michael Dickens and the
other ticket participants.
-- 
Cameron Simpson c...@zip.com.au

The double cam chain setup on the 1980's DOHC CB750 was another one of
Honda's pointless engineering breakthroughs. You know the cycle (if you'll
pardon the pun :-), Wonderful New Feature is introduced with much fanfare,
WNF is fawned over by the press, WNF is copied by the other three Japanese
makers (this step is sometimes optional), and finally, WNF is quietly dropped
by Honda.
- Blaine Gardner, blgar...@sim.es.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: gdb unable to read python frame information

2014-03-07 Thread Wesley
Then, how to make python get debug symbols? 

Install python from source with some special configure options?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tuples and immutability

2014-03-07 Thread Ben Finney
Duncan Booth duncan.booth@invalid.invalid writes:

 Is there any reason why tuples need to throw an exception on assigning
 to the element if the old value and new value are the same object?

Special cases aren't special enough to break the rules.

-- 
 \   “I do not believe in forgiveness as it is preached by the |
  `\church. We do not need the forgiveness of God, but of each |
_o__)other and of ourselves.” —Robert G. Ingersoll |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tuples and immutability

2014-03-07 Thread Chris Angelico
On Fri, Mar 7, 2014 at 8:33 PM, Duncan Booth
duncan.booth@invalid.invalid wrote:
 Is there any reason why tuples need to throw an exception on assigning to
 the element if the old value and new value are the same object?

It'd be easy enough to implement your own tuple subclass that behaves
that way. Try it! See how many situations it actually helps.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Assertions are bad, m'kay?

2014-03-07 Thread Steven D'Aprano
On Fri, 07 Mar 2014 18:16:55 +1100, Chris Angelico wrote:

 They produce the wrong exception type, they disappear when you least
 expect them, and now we have another reason not to use assert.
 
 http://xkcd.com/1339/
 
 Abusing assert for arg checking violates XKCD 1339. Write
 standards-compliant code!

Assertions are not bad! They're just misunderstood and abused.

(By the way, assertions are not the same as assumptions. Asserts can be 
used to check that assumptions are correct, or to check the internal 
logic of your reasoning. Whereas assumptions are just accepted as if they 
were correct, no questions asked.


You should read this guy's blog post on when to use assert:

http://import-that.dreamwidth.org/676.html

It's pretty damn good, if I do say so myself...

*whistles innocently*


-- 
Steven D'Aprano
http://import-that.dreamwidth.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Assertions are bad, m'kay?

2014-03-07 Thread Chris Angelico
On Fri, Mar 7, 2014 at 10:11 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 http://xkcd.com/1339/

 Abusing assert for arg checking violates XKCD 1339. Write
 standards-compliant code!

 Assertions are not bad! They're just misunderstood and abused.

 (By the way, assertions are not the same as assumptions. Asserts can be
 used to check that assumptions are correct, or to check the internal
 logic of your reasoning. Whereas assumptions are just accepted as if they
 were correct, no questions asked.

The XKCD does draw a distinction between assuming and asserting. And I
do say for arg checking, which is the most common *abuse* of assert.
But mainly, I just like to share laughs :)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tuples and immutability

2014-03-07 Thread Peter Otten
Chris Angelico wrote:

 On Fri, Mar 7, 2014 at 8:33 PM, Duncan Booth
 duncan.booth@invalid.invalid wrote:
 Is there any reason why tuples need to throw an exception on assigning to
 the element if the old value and new value are the same object?
 
 It'd be easy enough to implement your own tuple subclass that behaves
 that way. Try it! See how many situations it actually helps.

 class T(tuple):
... def __setitem__(self, index, value):
... if value is not self[index]:
... raise TypeError({} is not {}.format(value, 
self[index]))
... 
 for i, k in zip(range(250, 260), range(250, 260)):
... T([i])[0] = k
... 
Traceback (most recent call last):
  File stdin, line 2, in module
  File stdin, line 4, in __setitem__
TypeError: 257 is not 257

I'm not sure help is the right word here ;)

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tuples and immutability

2014-03-07 Thread Chris Angelico
On Fri, Mar 7, 2014 at 10:38 PM, Peter Otten __pete...@web.de wrote:
 TypeError: 257 is not 257

 I'm not sure help is the right word here ;)

It doesn't help with non-small integers, yes, but the original case
was a list. Personally, I don't think there are many situations that
would benefit from it, plus it'd be confusing (I can use += with a
list but not a number, why not?!).

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tuples and immutability

2014-03-07 Thread Alister
On Fri, 07 Mar 2014 09:33:49 +, Duncan Booth wrote:

 Chris Angelico ros...@gmail.com wrote:
 
 On Sat, Mar 1, 2014 at 1:41 AM, Joshua Landau jos...@landau.ws wrote:
 Would it be better to add a check here, such that if this gets raised
 to the top-level it includes a warning (Addition was inplace;
 variable probably mutated despite assignment failure)?
 
 That'd require figuring out whether or not the variable was actually
 mutated, and that's pretty hard to work out. So there's a FAQ entry,
 which Zachary already posted:
 
 http://docs.python.org/3/faq/programming.html#why-does-a-tuple-i-item-r
 aise-an-exception-when-the-addition-works
 
 Also, we just answer this question every now and then :) Presumably
 more often on -tutor than here.
 
 ChrisA
 Another take on this that I haven't seen discussed in this thread:
 
 Is there any reason why tuples need to throw an exception on assigning
 to the element if the old value and new value are the same object?
 
 If I say:
 
 a = (spam, [10, 30], eggs)
 
 then
 
 a[0] = a[0]
 
 won't actually mutate the object. So tuples could let that silently
 pass.
 Then you would be able to safely do:
 
 a[1] += [50]
 
 but this would still throw an exception:
 
 a[0] += x

I would think it would be better if the exception was thrown before the 
assignment to the list took place
simply seeing that a modification action was being applied to a tupple 
should be enough.
this would alert the programmer to the fact that he was trying something 
that may have undesired consequences
 



-- 
Old age is the harbor of all ills.
-- Bion
-- 
https://mail.python.org/mailman/listinfo/python-list


GOLLY! HUMANS HAVE ORIGINS IN THE DEVONIAN!

2014-03-07 Thread thrinaxodon . of . use . net123
==
HOLY F*CKING GOD DAMNED NEWS!
==

WELCOME TO YOUR NUMBER ONE SOURCE FOR PRESTIGIOUS BULLLSHIT! THE KIND YOU CAN 
ONLY GET FROM THRINAXODON CRAZY CHEESY!

NOW FOR YOUR FAVORITE TIME SLOT:

==

THRINAXODON FOUND 3  HUMAN FOSSILS FROM DEVONIAN STRATA IN GREENLAND.

ONE OF THEM WAS A NICE KNEECAP.

THE MOST BEAUTIFUL KNEECAP EVER DISCOVERED.

I CALLED OUT CARTER N.

CARTER CAME RUSHING OVER. WE TOOK THE KNEECAP FROM THE INUIT SAVAGES AND FLEW 
TO THE SMITHSONIAN.

THEY CALLED US KOOKS AND SLAMMED THE DOOR.

==
EVIDENCE THAT HUMANS LIVED IN THE DEVONIAN: 

https://groups.google.com/group/sci.bio.paleontology/browse_thread/thread/6f501c469c7af24f#
 
https://groups.google.com/group/sci.bio.paleontology/browse_thread/thread/3aad75c16afb0b82#
 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: gdb unable to read python frame information

2014-03-07 Thread Neal Becker
dieter wrote:

 Wesley nisp...@gmail.com writes:
 
 I wanna use gdb to attach my running python scripts.
 Successfully import libpython in gdb, but seems all py operations failed to
 read python information.

 Here is the snippet:
 (gdb) python
import libpython
end
 (gdb) py-bt
 #3 (unable to read python frame information)
 #5 (unable to read python frame information)
 
 The simplest possible interpretation would be that your
 Python lacks debugging symbols. That often happens with
 system installed Python installations (which usually are stripped
 to the bare minimal symbol set - as normal users do not need
 debugging).
 
 Try with a Python that you have generated yourself.

You probably need to install the python-debuginfo package

-- 
https://mail.python.org/mailman/listinfo/python-list


debugging on windows

2014-03-07 Thread Robin Becker

Using


Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:18:40) [MSC v.1600 32 bit 
(Intel)] on win32
Type help, copyright, credits or license for more information.


to run a tkinter + pmw2 application I have the following error on windows xp sp3


Unhandled exception at 0x1e0aebb8 in python.exe: 0xC005: Access violation 
reading location 0x0048.


the main window has appeared and the app is in a module search to find 
files/classes that might be relevant. VS 2010 indicates the error is some where 
 in the python33 dll. The code appears to run fine in 2.7, but should be 
compatible with 3.3.x


Is my only hope to add more print statements or use pdb or should I try and 
compile python 3.3.x myself and get the search narrowed with VS? The issue is 
complicated by my having redirected all outputs to some message windows using 
fake files for stderr  stdout.



--
Robin Becker

--
https://mail.python.org/mailman/listinfo/python-list


Re: Tuples and immutability

2014-03-07 Thread Roy Smith
In article XnsA2E95FA1E1EB6duncanbooth@127.0.0.1,
 Duncan Booth duncan.booth@invalid.invalid wrote:

 Is there any reason why tuples need to throw an exception on assigning to 
 the element if the old value and new value are the same object?
 
 If I say:
 
 a = (spam, [10, 30], eggs)
 
 then
 
 a[0] = a[0]
 
 won't actually mutate the object. So tuples could let that silently pass. 

But, why would you want them to?  What a way to introduce bugs which are 
difficult to test for.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python programming

2014-03-07 Thread Grant Edwards
On 2014-03-07, William Ray Wing w...@mac.com wrote:
 On Mar 6, 2014, at 8:24 PM, Roy Smith r...@panix.com wrote:

 I spotted a device on the table of the company calibration office...
 
 As I recall, it was a 100A capable resistor... 0.10 OHM.
 
 No idea what it was meant for; big binding posts at one end, and a
 slab of sheet steel in a W shape (smooth curves, not sharp bends).
 
 External shunt for an ammeter?
  

 More likely a dummy load for power supply testing.

Could be.  Back when I was working on PWM controllers for golf cart
and small car motors, we used to use steel coathangers for test loads,
but once they got past orange and more towards yellow, they started to
get too soft.  An appropriately dimensioned chunk of sheet steel would
have been ideal.

 (Normally, ammeter shunts are sized to dissipate as little power as
 possible.)

I've used chunks of coathanger for that too, but I don't think the
resistance was stable enough over temperature to trust the results at
higher currents.

-- 
Grant Edwards   grant.b.edwardsYow! If elected, Zippy
  at   pledges to each and every
  gmail.comAmerican a 55-year-old
   houseboy ...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python programming

2014-03-07 Thread John Ladasky
On Thursday, February 13, 2014 12:30:39 AM UTC-8, larry@gmail.com wrote:
 On Wed, Feb 12, 2014 at 10:56 PM, William Ray Wing w...@mac.com wrote:
 
  OK, and how many of you remember the original version of the 
  tongue-in-cheek essay Real Programmers Don't Use Pascal from the back 
  page of Datamation?
 
 I do remember it.
 
 http://www.webcitation.org/659yh1oSh


As do I, though I couldn't have been more than about 16 years old when it came 
out.  I just re-read it, and this comment jumped out at me:

Neither OS/370 nor FORTRAN show any signs of dying out, despite all the 
efforts of Pascal programmers the world over.

Well, OS/370, RIP.

As for FORTRAN?  This week, I actually downloaded an application which required 
a FORTRAN compiler.  This is the only FORTRAN application I've ever needed.  
It's not old code, the first revision came out about 10 years ago.  More than 
once, I have queried Google with the phrase Why isn't FORTRAN dead yet?  For 
some reason, it lives on.  I can't say that I understand why.  
-- 
https://mail.python.org/mailman/listinfo/python-list


Is their a command to view code?

2014-03-07 Thread NexusRAwesome1995 .
I am making a text based aventure game for my assignment and a friends test
run has somehow saved over the entire code file and now im using an earlier
version of the code. I have 0 idea if there is anyway to look at the code
using the IDLE and i need to do it to see how i fixed the fatal error left
behind by a friend. My on computer backup has not worked and the backup on
my memory stick also has the same problem.
If anyone knows of a way to get my code back i will be grateful as this is
my 1st project and i'm not that used to the syntax.
the item added is the outcome of what happened.
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on 
win32
Type copyright, credits or license() for more information.
 RESTART 
 
REMEMBER TO TYPE ALL YOUR ANSWERS IN LOWERCASE (EXCEPT YOUR OWN NAME)
 
  RESTART 
 
REMEMBER TO TYPE ALL YOUR ANSWERS IN LOWERCASE (EXCEPT YOUR OWN NAME)
BECAUSE THIS IS OUR FIRST GAME, ANY ANSWERS NOT ENTERED PERFECTLY WILL RESULT 
IN THE GAME ENDING, SO BE CAREFUL!
Hello, please enter your name:
Marcus Hyde
Marcus Hyde, You begin your adventure in the forest, with Princess Violet.
You proceed to climb a tree to pick an apple when you hear her scream.
A group of Orcs have taken the princess!
What will you do?
 Attack
 Run
attack
You try to attack one of the Orcs but they are too strong!
You are knocked out!
...
You awaken moments later to see a spirit in front of you.
The spirit presents you with three choices, select one.
 Sword
 Staff
 Bow
staff
You chose Staff!
('Staff does ', 4, ' damage!')
You are now equiped with a weapon!
Weapons increase your attack power, making you capable of defeating stronger 
opponents!
When you are given a choice, you can check your stats by typing 'stats'
Give it a try!
What will you do?
 Stats
stats
('HP = ', 10)
('Attack = ', 4)
('Defense = ', 0)
As you advance through the game, you may find items to increase your stats.
...
Before you can move, you are attacked by a Rogue!
Rogue HP = 3
What will you do?
 Attack
 Run
attack
('You attack the Rogue and deal ', 4, ' damage.')
You defeated the Rogue!
Rogue droped an item!
What will you do?
 Check
 Leave
check
You found a Wooden Shield!
Defense = 1
What will you do?
 Stats
 Continue
continue
You continue in search of the Princess and find a cave.
There is a lit torch at the entrance of the cave.
You take the torch and proceed to enter the cave.
As you walk through the cave you notice strange symbols on the walls, what 
could they mean?
You continue walking and come across two paths.
You hear the sound of several Orcs coming from the Left path.
You feel the wind coming from the Right path, this way is the fastest to the 
exit.
What will you do?
 Left
 Right
left
Despite hearing several Orcs, you choose to take the left path.
You fall into a pit with 5 Orcs, one of them attacks you!
Orc HP = 6
What will you do?
 Attack
 Run
run
You try to run away but the Orcs grab you.
The Orcs beat you to death.
GAME OVER
 fuck

Traceback (most recent call last):
  File pyshell#0, line 1, in module
fuck
NameError: name 'fuck' is not defined
 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tuples and immutability

2014-03-07 Thread Ian Kelly
On Fri, Mar 7, 2014 at 4:51 AM, Alister alister.w...@ntlworld.com wrote:
 I would think it would be better if the exception was thrown before the
 assignment to the list took place
 simply seeing that a modification action was being applied to a tupple
 should be enough.
 this would alert the programmer to the fact that he was trying something
 that may have undesired consequences

Then the behavior of tuples would be inconsistent with other immutable
types.  This can't be applied generally, because the Python
interpreter doesn't generally know whether a given type is supposed to
be immutable or not.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python programming

2014-03-07 Thread Gene Heskett
On Friday 07 March 2014 12:29:38 Grant Edwards did opine:

 On 2014-03-07, William Ray Wing w...@mac.com wrote:
  On Mar 6, 2014, at 8:24 PM, Roy Smith r...@panix.com wrote:
  I spotted a device on the table of the company calibration office...
  
  As I recall, it was a 100A capable resistor... 0.10 OHM.
  
  No idea what it was meant for; big binding posts at one end, and a
  slab of sheet steel in a W shape (smooth curves, not sharp bends).
  
  External shunt for an ammeter?
  
  More likely a dummy load for power supply testing.
 
 Could be.  Back when I was working on PWM controllers for golf cart
 and small car motors, we used to use steel coathangers for test loads,
 but once they got past orange and more towards yellow, they started to
 get too soft.  An appropriately dimensioned chunk of sheet steel would
 have been ideal.
 
  (Normally, ammeter shunts are sized to dissipate as little power as
  possible.)
 
 I've used chunks of coathanger for that too, but I don't think the
 resistance was stable enough over temperature to trust the results at
 higher currents.

This is really really offtopic but since its turned into war stories,
I recall one time that I needed to test a 5v 200amp supply that there were 
2 of in an old NEC Digital Video Effects unit,  I looked up the R per 1000' 
of standard romex in the various gauges  went over the Lowes and bought a 
100' roll of of 10/2.  Soldered the inside end together after striping and 
twisting it together,  It worked well, but the PSU didn't.  Made by HP back 
when they _thought_ they knew about how to build cement block sized power 
supplies. The psu went into foldback at about 20 amps.  All the bugs were 
good, nothing running warm.  Analyzing backwards in view of the curie point 
on some ferrite's being below the boiling point of water, I finally came to 
the conclusion that the ferrite in the output transformer had gone 
austenitic, eg totally non-magnetic, like it was just so much air, which is 
what many of those compounds will do if magnetized near saturation when 
they hit the curie point, and will never recover from.  HP of course didn't 
have the transformer or a replacement supply, but I found some Pioneer's 
with a suitable rating at M.P.Jones in FL and broke their hands putting a 
check for 2 of them in them, shipped yesterday.  That was in about 1997  
they were still in service when we turned analog tv off June 30, 2008. 

Cheers, Gene
-- 
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

NOTICE: Will pay 100 USD for an HP-4815A defective but
complete probe assembly.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is their a command to view code?

2014-03-07 Thread Ian Kelly
On Fri, Mar 7, 2014 at 10:55 AM, NexusRAwesome1995 .
nexusrawes...@gmail.com wrote:
 I am making a text based aventure game for my assignment and a friends test
 run has somehow saved over the entire code file and now im using an earlier
 version of the code. I have 0 idea if there is anyway to look at the code
 using the IDLE and i need to do it to see how i fixed the fatal error left
 behind by a friend. My on computer backup has not worked and the backup on
 my memory stick also has the same problem.
 If anyone knows of a way to get my code back i will be grateful as this is
 my 1st project and i'm not that used to the syntax.
 the item added is the outcome of what happened.

Sorry, Python doesn't keep the source code in memory.  If the game is
still running in the interpreter, you can ask it for the source code
of a particular code object, but it implements this by opening the
source file and reading it in.  Since you've overwritten the file, the
source code would be wrong.  The best that you could do in this case
would be to disassemble the code objects using the dis.dis() function,
and then try to reverse-engineer the Python code from the byte code.
If the interpreter is no longer running, then there is nothing you can
do.

For the future, I strongly recommend using a version control system,
such as the free and relatively lightweight Mercurial.  Then when you
have these kinds of mishaps all you have to do is check the most
recent version of the code out of the repository again.  You should of
course continue to create backups as well, in case of more disastrous
events (although memory sticks are far too failure-prone to be
considered a reliable backup solution IMO).
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is their a command to view code?

2014-03-07 Thread Joel Goldstick
On Mar 7, 2014 1:16 PM, NexusRAwesome1995 . nexusrawes...@gmail.com
wrote:

 I am making a text based aventure game for my assignment and a friends
test run has somehow saved over the entire code file and now im using an
earlier version of the code. I have 0 idea if there is anyway to look at
the code using the IDLE and i need to do it to see how i fixed the fatal
error left behind by a friend. My on computer backup has not worked and the
backup on my memory stick also has the same problem.
 If anyone knows of a way to get my code back i will be grateful as this
is my 1st project and i'm not that used to the syntax.
 the item added is the outcome of what happened.

You will be better off asking on python tutor list. However, go back to the
source you have and debug it
 --
 https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


extract from json

2014-03-07 Thread teddybubu
I can't find any example on how to do this.
I have a json file like so:
{bostock:[{url:http://bl.ocks.org/mbostock/9360565,title:titleplaceholder,date:dateplaceholder},
{url:http://bl.ocks.org/mbostock/9265674,title:titleplaceholder,date:dateplaceholder},
{url:http://bl.ocks.org/mbostock/9265467,title:titleplaceholder,date:dateplaceholder},
{url:http://bl.ocks.org/mbostock/9234731,title:titleplaceholder,date:dateplaceholder},
{url:http://bl.ocks.org/mbostock/9232962,title:titleplaceholder,date:dateplaceholder},

this goes on for more than 700 entries. only thing unique is the number at the 
end of the url. I am going to load the url in python, get the date and title 
and write it in the json itself. 
Right now I am stuck on just reading the url in the json. Here is my code:

import json

with open(bostock.json) as json_file:
json_data = json.load(json_file)
print(json_data)

I have tried json_data[0], json_data.url and a few others I forget right now 
and it does not seem to work.  

I have already figured out how to get the title and date.
First things first: How can i just get the url for each line of the above json 
file? 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: gdb unable to read python frame information

2014-03-07 Thread Ned Deily
In article c583c21d-d0a2-449a-93e2-37db713b3...@googlegroups.com,
 Wesley nisp...@gmail.com wrote:
 Then, how to make python get debug symbols? 
 
 Install python from source with some special configure options?

If your distribution doesn't have a debug version of Python and you need 
to build your own, add --with-pydebug to your ./configure options.  See:

./configure --help

-- 
 Ned Deily,
 n...@acm.org

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: extract from json

2014-03-07 Thread Kev Dwyer
teddyb...@gmail.com wrote:

 I can't find any example on how to do this.
 I have a json file like so:
 {bostock:
[{url:http://bl.ocks.org/mbostock/9360565,title:titleplaceholder,date:dateplaceholder},
 
{url:http://bl.ocks.org/mbostock/9265674,title:titleplaceholder,date:dateplaceholder},
 
{url:http://bl.ocks.org/mbostock/9265467,title:titleplaceholder,date:dateplaceholder},
 
{url:http://bl.ocks.org/mbostock/9234731,title:titleplaceholder,date:dateplaceholder},
 
{url:http://bl.ocks.org/mbostock/9232962,title:titleplaceholder,date:dateplaceholder},
 
 this goes on for more than 700 entries. only thing unique is the number at
 the end of the url. I am going to load the url in python, get the date and
 title and write it in the json itself. Right now I am stuck on just
 reading the url in the json. Here is my code:
 
 import json
 
 with open(bostock.json) as json_file:
 json_data = json.load(json_file)
 print(json_data)
 
 I have tried json_data[0], json_data.url and a few others I forget right
 now and it does not seem to work.
 
 I have already figured out how to get the title and date.
 First things first: How can i just get the url for each line of the above
 json file?


Hello 

Try:

Python 2.7.2 (default, Aug 19 2011, 20:41:43) [GCC] on linux2   

Type help, copyright, credits or license for more information.  


 import  json
 with open('/tmp/bostock.json') as f:
... json_data = json.load(f)
... 
 json_data
{u'bostock': [{u'url': u'http://bl.ocks.org/mbostock/9360565', u'date': 
u'dateplaceholder', u'title': u'titleplaceholder'}, {u'url': 
u'http://bl.ocks.org/mbostock/9265674', u'date': u'dateplaceholder', 
u'title': u'titleplaceholder'}, {u'url': 
u'http://bl.ocks.org/mbostock/9265467', u'date': u'dateplaceholder', 
u'title': u'titleplaceholder'}, {u'url': 
u'http://bl.ocks.org/mbostock/9234731', u'date': u'dateplaceholder', 
u'title': u'titleplaceholder'}, {u'url': 
u'http://bl.ocks.org/mbostock/9232962', u'date': u'dateplaceholder', 
u'title': u'titleplaceholder'}]}

 urls = [x['url'] for x in json_data['bostock']]
 urls
[u'http://bl.ocks.org/mbostock/9360565', 
u'http://bl.ocks.org/mbostock/9265674', 
u'http://bl.ocks.org/mbostock/9265467', 
u'http://bl.ocks.org/mbostock/9234731', 
u'http://bl.ocks.org/mbostock/9232962']

Python loads the json in the file into a dictionary.  In this case, the 
dictionary has a single key, 'bostock', and the value in the dictionary for 
that key is a list (of dictionaries).  

To get the urls, you need to get the list 

json_data['bostock']

 and then iterate over it's elements, getting the value for the key url for 
each one.  
This is what the list comprehension 

[x['url'] for x in json_data['bostock']]

does.

I hope that helps,

Kev


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Assertions are bad, m'kay?

2014-03-07 Thread Dan Stromberg
On Fri, Mar 7, 2014 at 3:11 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:


 Assertions are not bad! They're just misunderstood and abused.

 You should read this guy's blog post on when to use assert:

 http://import-that.dreamwidth.org/676.html

Nice article.

BTW, what about:

if value = 3:
   raise AssertionError('value must be = 3')

?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Assertions are bad, m'kay?

2014-03-07 Thread Ben Finney
Dan Stromberg drsali...@gmail.com writes:

 BTW, what about:

 if value = 3:
raise AssertionError('value must be = 3')

That would be very confusing, since it would only appear when the value
is = 3. Were you making some other point?

-- 
 \“If this is your first visit to the USSR, you are welcome to |
  `\  it.” —hotel room, Moscow |
_o__)  |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Assertions are bad, m'kay?

2014-03-07 Thread Irmen de Jong
On 8-3-2014 1:15, Dan Stromberg wrote:
 On Fri, Mar 7, 2014 at 3:11 AM, Steven D'Aprano
 steve+comp.lang.pyt...@pearwood.info wrote:
 

 Assertions are not bad! They're just misunderstood and abused.
 
 You should read this guy's blog post on when to use assert:

 http://import-that.dreamwidth.org/676.html
 
 Nice article.
 
 BTW, what about:
 
 if value = 3:
raise AssertionError('value must be = 3')
 
 ?

I don't think this qualifies as an assertion. Also, because AssertionError is 
documented
as Raised when an assert statement fails, I would never use it myself 
explicitly like
this.

You should use ValueError instead (or a more precise exception such as 
IndexError, if
appropriate).

Irmen




-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Function and turtle help

2014-03-07 Thread Lee Harr
 I am completely new to programming so thanks for any help!

Not sure it will help, and hopefully I am not self-promoting too much,
but this may be of interest to you:

http://pynguin.googlecode.com/

http://code.google.com/p/pynguin/wiki/StartProgramming


I am interested in feedback from new programmers.   
  
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Function and turtle help

2014-03-07 Thread Scott W Dunning

On Mar 7, 2014, at 6:16 PM, Lee Harr miss...@hotmail.com wrote:

 I am completely new to programming so thanks for any help!
 
 Not sure it will help, and hopefully I am not self-promoting too much,
 but this may be of interest to you:
 
 http://pynguin.googlecode.com/
 
 http://code.google.com/p/pynguin/wiki/StartProgramming
 
Awesome!  Looks fun, I’ll definitely check it out and let you know!!

Scott
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tuples and immutability

2014-03-07 Thread Gregory Ewing

Duncan Booth wrote:
Is there any reason why tuples need to throw an exception on assigning to 
the element if the old value and new value are the same object?


It would make introspection misleading, because tuples
would have a __setitem__ method event though they don't
actually support item assignment.

Also, it would solve the problem for tuples in particular,
but not for any other immutable type -- they would all
have to implement the same behaviour independently to
enjoy the benefit.

Here's another idea: If the __iadd__ method returns the
same object, *and* the LHS doesn't have a __setitem__
method, then do nothing instead of raising an exception.

Peter Otten wrote:

 Traceback (most recent call last):
   File stdin, line 2, in module
   File stdin, line 4, in __setitem__
 TypeError: 257 is not 257

 I'm not sure help is the right word here ;)

I don't think that's a problem, because the use case
being addressed is where the object performs in-place
modification and always returns itself. Any object that
doesn't return itself is not modifying in-place, even
if the returned object happens to be equal to the
original one.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: extract from json

2014-03-07 Thread teddybubu
On Friday, March 7, 2014 3:05:15 PM UTC-6, Kev Dwyer wrote:
  wrote:
  I can't find any example on how to do this.
 
  I have a json file like so:
 
  {bostock:[{url:http://bl.ocks.org/mbostock/9360565,title:titleplaceholder,date:dateplaceholder},{url:http://bl.ocks.org/mbostock/9265674,title:titleplaceholder,date:dateplaceholder},{url:http://bl.ocks.org/mbostock/9265467,title:titleplaceholder,date:dateplaceholder},{url:http://bl.ocks.org/mbostock/9234731,title:titleplaceholder,date:dateplaceholder},{url:http://bl.ocks.org/mbostock/9232962,title:titleplaceholder,date:dateplaceholder},
  this goes on for more than 700 entries. only thing unique is the number at
 
  the end of the url. I am going to load the url in python, get the date and
 
  title and write it in the json itself. Right now I am stuck on just
 
  reading the url in the json. Here is my code:
  import json
  with open(bostock.json) as json_file:
 
  json_data = json.load(json_file)
 
  print(json_data)
  I have tried json_data[0], json_data.url and a few others I forget right
 
  now and it does not seem to work.
  I have already figured out how to get the title and date.
 
  First things first: How can i just get the url for each line of the above
 
  json file?
 Hello 
 Try:
 
 Python 2.7.2 (default, Aug 19 2011, 20:41:43) [GCC] on linux2 
   
 
 Type help, copyright, credits or license for more information.
   

  import  json
 
  with open('/tmp/bostock.json') as f:
 
 ... json_data = json.load(f)
  json_data
 {u'bostock': [{u'url': u'http://bl.ocks.org/mbostock/9360565', u'date': 
 u'dateplaceholder', u'title': u'titleplaceholder'}, {u'url': 
 u'http://bl.ocks.org/mbostock/9265674', u'date': u'dateplaceholder', 
 u'title': u'titleplaceholder'}, {u'url': 
 u'http://bl.ocks.org/mbostock/9265467', u'date': u'dateplaceholder', 
 
 u'title': u'titleplaceholder'}, {u'url': 
 
 u'http://bl.ocks.org/mbostock/9234731', u'date': u'dateplaceholder', 
 u'title': u'titleplaceholder'}, {u'url': 
 u'http://bl.ocks.org/mbostock/9232962', u'date': u'dateplaceholder', 
 u'title': u'titleplaceholder'}]} 
  urls = [x['url'] for x in json_data['bostock']]
 
  urls
 
 [u'http://bl.ocks.org/mbostock/9360565', 
 
 u'http://bl.ocks.org/mbostock/9265674', 
 
 u'http://bl.ocks.org/mbostock/9265467', 
 
 u'http://bl.ocks.org/mbostock/9234731', 

 u'http://bl.ocks.org/mbostock/9232962']
 
 Python loads the json in the file into a dictionary.  In this case, the 
 dictionary has a single key, 'bostock', and the value in the dictionary for 
 
 that key is a list (of dictionaries).  

 To get the urls, you need to get the list 
 
 json_data['bostock']
  and then iterate over it's elements, getting the value for the key url for 
  each one.  
 This is what the list comprehension 
 [x['url'] for x in json_data['bostock']]
 does.
 I hope that helps, 
 Kev

Kev your the man. Thanks
-- 
https://mail.python.org/mailman/listinfo/python-list


PYTHON BASTARDS STILL CAN'T ANSWER THIS QUESTION:

2014-03-07 Thread thrinaxodon666
== 
HOLY F*CKING GOD DAMNED NEWS! 
== 
 
WELCOME TO YOUR NUMBER ONE SOURCE FOR PRESTIGIOUS BULLLSHIT! THE KIND YOU CAN 
ONLY GET FROM THRINAXODON CRAZY CHEESY! 
 
NOW FOR YOUR FAVORITE TIME SLOT: 
 
== 
 
THRINAXODON FOUND 3  HUMAN FOSSILS FROM DEVONIAN STRATA IN GREENLAND. 
 
ONE OF THEM WAS A NICE KNEECAP. 
 
THE MOST BEAUTIFUL KNEECAP EVER DISCOVERED. 
 
I CALLED OUT CARTER N. 
 
CARTER CAME RUSHING OVER. WE TOOK THE KNEECAP FROM THE INUIT SAVAGES AND FLEW 
TO THE SMITHSONIAN. 
 
THEY CALLED US KOOKS AND SLAMMED THE DOOR. 
 
== 
EVIDENCE THAT HUMANS LIVED IN THE DEVONIAN: 

https://groups.google.com/group/sci.bio.paleontology/browse_thread/thread/6f501c469c7af24f#
 
  
https://groups.google.com/group/sci.bio.paleontology/browse_thread/thread/3aad75c16afb0b82#
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: extract from json

2014-03-07 Thread thrinaxodon666
On Friday, March 7, 2014 3:27:27 PM UTC-5, tedd...@gmail.com wrote:
 I can't find any example on how to do this.
 
 I have a json file like so:
 
 {bostock:[{url:http://bl.ocks.org/mbostock/9360565,title:titleplaceholder,date:dateplaceholder},
 
 {url:http://bl.ocks.org/mbostock/9265674,title:titleplaceholder,date:dateplaceholder},
 
 {url:http://bl.ocks.org/mbostock/9265467,title:titleplaceholder,date:dateplaceholder},
 
 {url:http://bl.ocks.org/mbostock/9234731,title:titleplaceholder,date:dateplaceholder},
 
 {url:http://bl.ocks.org/mbostock/9232962,title:titleplaceholder,date:dateplaceholder},
 
 
 
 this goes on for more than 700 entries. only thing unique is the number at 
 the end of the url. I am going to load the url in python, get the date and 
 title and write it in the json itself. 
 
 Right now I am stuck on just reading the url in the json. Here is my code:
 
 
 
 import json
 
 
 
 with open(bostock.json) as json_file:
 
 json_data = json.load(json_file)
 
 print(json_data)
 
 
 
 I have tried json_data[0], json_data.url and a few others I forget right now 
 and it does not seem to work.  
 
 
 
 I have already figured out how to get the title and date.
 
 First things first: How can i just get the url for each line of the above 
 json file?

I think it's better if you f*ck off.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python programming

2014-03-07 Thread William Ray Wing
On Mar 7, 2014, at 1:03 PM, John Ladasky john_lada...@sbcglobal.net wrote:

 
 As for FORTRAN?  This week, I actually downloaded an application which 
 required a FORTRAN compiler.  This is the only FORTRAN application I've ever 
 needed.  It's not old code, the first revision came out about 10 years ago.  
 More than once, I have queried Google with the phrase Why isn't FORTRAN dead 
 yet?  For some reason, it lives on.  I can't say that I understand why.  
 -- 
 https://mail.python.org/mailman/listinfo/python-list

Well, I’d claim that for what it was designed for (FORTRAN stands for FORmula 
TRANslator after all), it is still pretty da*mn good.  It generates extremely 
fast, robust code that requires much less debugging effort than the equivalent 
C or C++ requires.  Most of the physicists I know still write FORTRAN, although 
they no longer do so exclusively.

Of course, as has been pointed out, the HUGE code base of scientific and 
numerical analysis code that already exists in FORTRAN makes rewriting sort of 
a waste of grant (or company) money.

-Bill
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: extract from json

2014-03-07 Thread Chris Angelico
On Sat, Mar 8, 2014 at 2:21 PM,  thrinaxodon...@gmail.com wrote:
 I think it's better if you (CENSORED) off.

Teddybubu, please understand that the above comment is from a spammer
and does not reflect the prevailing attitude of this list. I don't
like to make content-free posts like this, but as you already have the
answer you need, there's not a lot for me to add :)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tuples and immutability

2014-03-07 Thread Ian Kelly
On Fri, Mar 7, 2014 at 7:17 PM, Gregory Ewing
greg.ew...@canterbury.ac.nz wrote:
 Here's another idea: If the __iadd__ method returns the
 same object, *and* the LHS doesn't have a __setitem__
 method, then do nothing instead of raising an exception.

Maybe it doesn't have a __setitem__ because the object that was
retrieved is computed rather than stored, and the result of the
__iadd__ will simply be discarded.  Somewhat contrived example:

class LessThanFilter:

def __init__(self, the_list):
self._the_list = the_list

def __getitem__(self, bound):
return [x for x in self._the_list if x  bound]


filter = LessThanFilter([10, 20, 30, 40, 50])
filter[25] += [15, 17, 23]

Should that last line not raise an exception?  The __iadd__ call will
return the same object, and the LHS doesn't have a __setitem__ method.

 I don't think that's a problem, because the use case
 being addressed is where the object performs in-place
 modification and always returns itself. Any object that
 doesn't return itself is not modifying in-place, even
 if the returned object happens to be equal to the
 original one.

I already mentioned this earlier in the thread, but a balanced binary
tree might implement += as node insertion and then return a different
object if the balancing causes the root node to change.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: gdb unable to read python frame information

2014-03-07 Thread dieter
Wesley nisp...@gmail.com writes:

 Install python from source with some special configure options?

When I last generated Python from source, there was no need
to do anything special to get debugging symbols (the option
(gcc) option -g was automatically included).

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: debugging on windows

2014-03-07 Thread dieter
Robin Becker ro...@reportlab.com writes:

 Using

 Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:18:40) [MSC v.1600 32 bit 
 (Intel)] on win32
 Type help, copyright, credits or license for more information.

 to run a tkinter + pmw2 application I have the following error on windows xp 
 sp3

 Unhandled exception at 0x1e0aebb8 in python.exe: 0xC005: Access 
 violation reading location 0x0048.

This is a C level error -- likely some memory corruption.
You will need a C level debugger to analyse the problem -
and likely, it will not be easy.

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue20863] IDLE not opening

2014-03-07 Thread Chester Burns

New submission from Chester Burns:

I installed python 3.3.3 and it was working fine for the moment, however the 
next day when I tried to open it, the idle app showed on the dock for a second 
and straight away quit.  I am using a macbook pro on osx version 10.9.1

--
messages: 212863
nosy: chester.burns
priority: normal
severity: normal
status: open
title: IDLE not opening
versions: Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20863
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20863] IDLE not opening

2014-03-07 Thread Ned Deily

Ned Deily added the comment:

Try launching IDLE from a Terminal shell window by typing:

/usr/local/bin/idle3.3

and see if it fails there and, if so, any messages shown.  One possibility is 
the problem reported in http://bugs.python.org/issue18270 which was fixed in 
the IDLE shipped with Python 3.3.4.

--
nosy: +ned.deily

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20863
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20761] os.path.join doesn't strip LF or CR

2014-03-07 Thread Georg Brandl

Georg Brandl added the comment:

Agreed.

--
nosy: +georg.brandl
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20761
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20863] IDLE not opening

2014-03-07 Thread Chester Burns

Chester Burns added the comment:

I tried that and it came up with this:

Traceback (most recent call last):
  File /usr/local/bin/idle3.3, line 5, in module
main()
  File 
/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/idlelib/PyShell.py,
 line 1572, in main
shell.interp.runcommand(''.join((print(', tkversionwarning, '
AttributeError: 'NoneType' object has no attribute 'interp'

I also tried typing 'open /usr/local/bin/idle3.3' and it returned this:

No application knows how to open /usr/local/bin/idle3.3.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20863
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20863] IDLE not opening

2014-03-07 Thread Ned Deily

Ned Deily added the comment:

Thanks for the update.  That is indeed the symptom of the problem documented in 
Issue18270.  The best solution is to download and install Python 3.3.4 which 
has a fix for it.

--
resolution:  - duplicate
stage:  - committed/rejected
superseder:  - IDLE on OS X fails with Attribute Error if no initial shell and 
Tk out-of-date

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20863
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20788] distutils.msvccompiler - flags are hidden inside initialize()

2014-03-07 Thread Éric Araujo

Éric Araujo added the comment:

It may be a good idea to make this information directly available in the 
sysconfig module, for example.  Before working on a patch right away, I’d 
recommend getting in touch with build tools developers and ask them what other 
hidden information they are extracting from distutils internals, so that a 
clean, comprehensive proposal can be made for Python 3.5 (as a new feature, 
this cannot go into existing stable versions).

--
nosy: +eric.araujo, mhammond, tim.golden
type:  - enhancement
versions: +Python 3.5 -Python 2.7, Python 3.1, Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20788
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue809163] Can't add files with spaces

2014-03-07 Thread Éric Araujo

Éric Araujo added the comment:

Yes, this issue is not addressed.  A test is added by the latest patch and 
reproduces the issue; now bdist_rpm should be changed to make the test pass.  
See also my previous comment.

--
components:  -Distutils2
stage: patch review - needs patch
versions: +Python 3.3, Python 3.4, Python 3.5 -3rd party, Python 3.1, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue809163
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20744] shutil should not use distutils

2014-03-07 Thread Éric Araujo

Éric Araujo added the comment:

Patch looks good to me.

--
stage: needs patch - patch review
versions: +Python 3.5 -Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20744
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13936] RFE: change bool(datetime.time(0, 0, 0)) to evaluate as True

2014-03-07 Thread Nick Coghlan

Nick Coghlan added the comment:

More proposals from the thread (paraphrased):

- make any aware time() object always True (leave naive midnight as False)
- make any aware time() object with a non-zero UTC offset always True (leave 
naive midnight and UTC midnight as False)
- deprecate aware time() entirely (raises the thorny question of what to return 
from .time() on an aware datetime() object)
- add helpers to retrieve naivemidnight and utcmidnight constants, and 
calculate a localmidnight value (needs to be dynamic in case the local timezone 
is changed)


Independent observation:

- if time() objects are supposed to be interpreted as representing a time 
difference relative to midnight rather than a structured object, why is it so 
hard to actually convert them to an appropriate time delta? There's no method 
for it, you can't just subtract midnight, there's no constructor on time delta 
that accepts a time object, you can't easily attach a date to the time to 
calculate a time delta.

Use case presented for the current behaviour:

- a simulation that tracks the time and date of the simulation independently 
and relies on the implicit bool behaviour of time objects (not stated why this 
is considered more maintainable than explicit comparisons with appropriate 
midnight objects)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13936
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4508] distutils compiler not handling spaces in path to output/src files

2014-03-07 Thread Éric Araujo

Éric Araujo added the comment:

Thanks Brian, let’s try and get this fixed.

 I've put together a patch adding the test requested. There is no problem on
 my Ubuntu machine with python 3.3.

Are you saying the test does not reproduce the bug discussed here?

 There is a comment in the file saying Don't load the xx module more than
 once, I am unsure whether my patch (using a renamed c file) violates this?

Hm I’m not quite sure if it’s enough that the extensions use different file 
names, or if they should also have different names inside the code.  Existing 
tests already create and import xx multiple times though…

 One can create a python file my file.py and can import it with
 __import__(my file). I couldn't do the same for a C extension.

One can’t do “import my file” though, so I would sweep this under the rug as an 
obscure corner case :‑)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4508
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16484] pydoc generates invalid docs.python.org link for xml.etree.ElementTree and other modules

2014-03-07 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
stage: needs patch - test needed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16484
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13936] RFE: change bool(datetime.time(0, 0, 0)) to evaluate as True

2014-03-07 Thread Nick Coghlan

Nick Coghlan added the comment:

Current status of thread discussion (yes, I'm biased, and that shows in the 
phrasing below):

Arguments raised for status quo:

- the module is behaving exactly as described in the documentation
- removing false time values will require affected users to update their code 
to instead explicitly compare with appropriate midnight values before migrating 
to Python 3.5 (or, since deprecation warnings are silent by default, except if 
a test framework enables them, Python 3.6)
- it wasn't an accident, it was designed so modulo arithmetic could reasonably 
be implemented for time() objects (which hasn't been demanded or implemented 
since the datetime module was created)
- changing behaviour so that a current subtle data driven bug instead becomes a 
harmless violation of recommended style for comparison against a sentinel value 
is encouraging bad programming practices

Arguments in favour of changing the behaviour:

- datetime.time() objects don't behave like a number in any other way (they 
don't support arithmetic and attempting to convert them with int, float, etc 
explicitly tells you they're not numbers), and don't even provide an easy way 
to convert them to a time delta relative to midnight (and hence to seconds 
since midnight via total_seconds), so it's surprising that they behave like a 
number in boolean context by having a concept of zero
- the current behaviour takes something that would be a harmless style error 
for most structured data types (including datetime and date objects) and 
instead makes it a subtle data driven behavioural bug (but only if you're using 
naive times or a timezone with a non-negative UTC offset)
- the current behaviour cannot even be accurately summarised as midnight 
evaluates as False, because it is actually naive midnight and UTC midnight 
with a non-negative UTC offset evaluate as false, while UTC midnight with a 
negative UTC offset evaluates as true. That's incoherent and really should be 
changed, and if we're going to change the behaviour anyway, we may as well 
change it to something less dangerous.
- any affected code that relies on some variants of midnight being False is 
already hard to understand (since most readers won't be aware of this subtlety 
of the behaviour of time objects) and would be made clearer by explicitly 
comparing against appropriate midnight objects

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13936
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19021] AttributeError in Popen.__del__

2014-03-07 Thread Larry Hastings

Larry Hastings added the comment:

Those six revisions have been cherry-picked into 3.4.0.

--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19021
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20808] 3.4 cherry pick: 6a1711c96fa6 (Popen.__del__ traceback)

2014-03-07 Thread Larry Hastings

Larry Hastings added the comment:

ok.

--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20808
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19021] AttributeError in Popen.__del__

2014-03-07 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
stage: needs patch - committed/rejected

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19021
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20864] getattr does not work well with descriptor

2014-03-07 Thread Martin Thurau

New submission from Martin Thurau:

If you have a descriptor (in my case it was an SQLAlchemy column) on an 
instance and this descriptor returns None for a call to __get__ then getattr 
with a given default value, will not return the default, but None.

I have no knowledge on the implementation details of getattr but I guess the 
logic is something like this:
- getattr looks at the given object and sees that the attribute in question is 
not None (since it is the descriptor object)
- getattr returns the descriptor
- the descriptors __get__ method is called
- __get__ return None

Maybe it should be more like this:
- getattr looks at the given object and sees that the attribute in question is 
not None (since it is the descriptor object)
- getattr sees that the attribute has __get__
- getattr calls __get__ method and looks if the return value is None

I'm not sure if this is really a bug but it's highly confusing and somewhat 
un-pythonic. I really should not care of an attribute of an object is a value 
or a descriptor. This is especially true since this problem also applies to 
@property. Effectively this means that if you call getattr you have *know* if 
the name in question is a property or not and one can't simply swap out an 
objects value for a property without risking to break calling code.

If this is actually *not* a bug, we should at least update the documentation to 
getattr, to mention this fact. Because currently it states that getattr(x, 
'foobar') is equivalent to x.foobar which is obviously not true.

--
components: Interpreter Core
files: python_descriptor_bug.py
messages: 212876
nosy: Martin.Thurau
priority: normal
severity: normal
status: open
title: getattr does not work well with descriptor
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file34299/python_descriptor_bug.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20864
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2818] pulldom cannot handle xml file with large external entity properly

2014-03-07 Thread M. Volz

Changes by M. Volz marie...@gmail.com:


--
nosy: +mvolz

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2818
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13936] RFE: change bool(datetime.time(0, 0, 0)) to evaluate as True

2014-03-07 Thread Skip Montanaro

Skip Montanaro added the comment:

 the current behaviour takes something that would be a harmless style error 
 for most structured data types ...

I'm not sure what a structured data type is, but in my mind the original 
poster's construct is more than a style error. He was using None as a sentinel, 
but not explicitly testing for its presence. The same error would be present if 
he used None as a sentinel value where the range of possible values was the set 
of all integers.

If there are problems with the definition of false time such that there are 
some combinations of time and timezone where UTC midnight is not zero, I would 
prefer to correct them.

Further, playing the devil's advocate, if you dispense with any false elements 
of time objects, why not simply zero out the nb_nonzero slot in time_as_number? 
Once that's gone, the time_as_number structure is all zeros, so the 
tp_as_number slot in PyDateTime_TimeType can be cleared.

--
nosy: +skip.montanaro

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13936
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17128] OS X system openssl deprecated - installer should build local libssl

2014-03-07 Thread Piotr Dobrogost

Changes by Piotr Dobrogost p...@bugs.python.dobrogost.net:


--
nosy: +piotr.dobrogost

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17128
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13968] Support recursive globs

2014-03-07 Thread Nick Coghlan

Nick Coghlan added the comment:

Oops, Python 3.4 has ** support in pathlib, but we missed Serhiy's patch for 
the glob module itself. We should resolve that discrepancy for 3.5 :)

--
versions: +Python 3.5 -Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13968
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13936] RFE: change bool(datetime.time(0, 0, 0)) to evaluate as True

2014-03-07 Thread Nick Coghlan

Nick Coghlan added the comment:

Structured data is just a shorthand way of referring to any Python object
which is neither a number or a container and exhibits the default boolean
behaviour where all instances are true.

The problem datetime.time is both that its current behaviour is internally
incoherent (whether or not an aware time is false depends on the current
timezone in unpredictable ways) and *also* inconsistent with its other
behaviours that indicate it should be handled as a non-numeric value. Since
it isn't a container either, standard conventions suggest that it should
always be true. No *compelling* justifications for its atypical behaviour
have been presented, just a case of Tim wanting to leave the door open to
adding modular arithmetic directly on time instances.

I suggest it makes far more sense to instead eliminate the quirky behaviour
entirely and instead provide an easy way to convert a time to a timedelta
relative to midnight.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13936
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13936] RFE: change bool(datetime.time(0, 0, 0)) to evaluate as True

2014-03-07 Thread R. David Murray

R. David Murray added the comment:

 it wasn't an accident, it was designed so modulo arithmetic could reasonably 
 be implemented for time() objects (which hasn't been demanded or implemented 
 since the datetime module was created)

Ah, interesting.  I just wrote a program last month where I was baffled that 
time didn't support arithmetic, and had to dodge painfully through datetime 
instances to do the arithmetic.  I asked about it on IRC and someone said it 
was because arithmetic on times was ambiguous because of timezones, and I just 
accepted that rather than wonder why it hadn't been implemented.

Otherwise I'm pretty sympathetic to the RFE, but I'd really like time 
arithmetic to work, so I guess I'd have to be -1 in that case, wouldn't I?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13936
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13936] RFE: change bool(datetime.time(0, 0, 0)) to evaluate as True

2014-03-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Otherwise I'm pretty sympathetic to the RFE, but I'd really like time
 arithmetic to work, so I guess I'd have to be -1 in that case,
 wouldn't I?

Adding times of the day sounds as well-defined to me as adding
centigrade temperatures.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13936
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19915] int.bit_at(n) - Accessing a single bit in O(1)

2014-03-07 Thread HCT

HCT added the comment:

then I guess it's either a new function to int or a new type of int for this 
type of operations. similar to bytearray/ctypes and memoryview

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19915
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13936] RFE: change bool(datetime.time(0, 0, 0)) to evaluate as True

2014-03-07 Thread R. David Murray

R. David Murray added the comment:

As does adding dates.  I'm talking about timedelta arithmetic, just like for 
datetimes.  I believe that still requires modulo arithmetic :)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13936
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13936] RFE: change bool(datetime.time(0, 0, 0)) to evaluate as True

2014-03-07 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

 On Mar 7, 2014, at 10:12 AM, R. David Murray rep...@bugs.python.org wrote:
 
  I asked about it on IRC and someone said it was because arithmetic on times 
 was ambiguous because of timezones, and I just accepted that rather than 
 wonder why it hadn't been implemented.
 
 Otherwise I'm pretty sympathetic to the RFE, but I'd really like time 
 arithmetic to work, so I guess I'd have to be -1 in that case, wouldn't I?

See http://bugs.python.org/issue17267

--
nosy: +Alexander.Belopolsky

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13936
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20865] A run has overwrite my code save

2014-03-07 Thread NexusRAwesome1995 .

New submission from NexusRAwesome1995 .:

I am making a text based aventure game for my assignment and a friends test run 
has somehow saved over the entire code file and now im using an earlier version 
of the code. I have 0 idea if there is anyway to look at the code using the 
IDLE and i need to do it to see how i fixed the fatal error left behind by a 
friend. My on computer backup has not worked and the backup on my memory stick 
also has the same problem.
If anyone knows of a way to get my code back i will be grateful as this is my 
1st project and i'm not that used to the syntax

--
messages: 212885
nosy: NexusRAwesome1995..
priority: normal
severity: normal
status: open
title: A run has overwrite my code save
type: behavior
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20865
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13936] RFE: change bool(datetime.time(0, 0, 0)) to evaluate as True

2014-03-07 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

 On Mar 7, 2014, at 10:15 AM, Antoine Pitrou rep...@bugs.python.org wrote:
 
 Adding times of the day sounds as well-defined to me as adding
 centigrade temperatures.

What is wrong with adding temperatures?  Climate people do it all the time when 
computing the averages.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13936
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20865] A run has overwrite my code save

2014-03-07 Thread Zachary Ware

Zachary Ware added the comment:

Sorry, the bug tracker is not the place to look for help like this.  Please 
redirect your question to python-list[1], where several very knowledgeable 
people listen in and are ready to render assistance for any manner of problems 
using Python.

[1] https://mail.python.org/mailman/listinfo/python-list

--
nosy: +zach.ware
resolution:  - invalid
stage:  - committed/rejected
status: open - closed
type: behavior - 

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20865
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17267] datetime.time support for '+' and '-'

2014-03-07 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17267
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8902] add datetime.time.now() for consistency

2014-03-07 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8902
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20271] urllib.parse.urlparse() accepts wrong URLs

2014-03-07 Thread STINNER Victor

STINNER Victor added the comment:

Oh, by the way my patch fixes also #18191.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20271
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20271] urllib.parse.urlparse() accepts wrong URLs

2014-03-07 Thread STINNER Victor

STINNER Victor added the comment:

Here is a patch for Python 3.5 which breaks backward compatibility: urlparse 
functions now raise a ValueError if the IPv6 address, port or host is invalid.

Examples of invalid URLs:

- HTTP://WWW.PYTHON.ORG:65536/doc/#frag: 65536 is invalid
- http://www.example.net:foo;
- http://::1/;
- http://[127.0.0.1]/;
- http://[host]/;

According to unit tests, Python 3.4 is more tolerant: it only raises an error 
when the port number is read (obj.port) from an URL with an invalid port. There 
error is not raised when the whole URL is parsed.

Is it ok to break backward compatibility?

--
keywords: +patch
nosy: +gvanrossum, haypo
Added file: http://bugs.python.org/file34300/urlparse.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20271
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20271] urllib.parse.urlparse() accepts wrong URLs

2014-03-07 Thread STINNER Victor

STINNER Victor added the comment:

My patch urlparse.patch may be modified to fix also #18191 in Python 2.7, 3.3 
and 3.4: splitport() should handle IPv6 ([::1]:80) and auth 
(user:passowrd@host) but not raises an exception.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20271
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18191] urllib2/urllib.parse.splitport does not handle IPv6 correctly

2014-03-07 Thread STINNER Victor

STINNER Victor added the comment:

I posted a patch to #20271 which should fix the issue. I wrote the patch for 
Python 3.5, but it can be adapted to be tolerant (don't make extensive tests on 
port number, host and IPv6) for older versions.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18191
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13936] RFE: change bool(datetime.time(0, 0, 0)) to evaluate as True

2014-03-07 Thread Tim Peters

Tim Peters added the comment:

[Nick]
 - deprecate aware time() entirely (raises the thorny question of what to 
 return from .time() on an aware datetime() object)

aware_datetime_object.time() already returns a naive time object.  The thorny 
question is what .timetz() should return - but if aware time objects _were_ 
deprecated, .timetz() itself would presumably be deprecated too.

 ... you can't easily attach a date to the time to calculate a time delta.

The class constructor datetime.combine(date_object, time_object) makes it easy 
to combine any two date and time objects into a datetime object.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13936
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20812] Explicitly cover application migration in the 2-3 guide

2014-03-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2a922153463e by Brett Cannon in branch 'default':
Issue #20812: Add a short opener to the Python 2/3 porting HOWTO.
http://hg.python.org/cpython/rev/2a922153463e

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20812
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20812] Explicitly cover application migration in the 2-3 guide

2014-03-07 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20812
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20813] Backport revised 2to3 guide to older branches

2014-03-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a24085e1b1f5 by Brett Cannon in branch '3.3':
Issue #20813: Backport Python 2/3 HOWTO updates
http://hg.python.org/cpython/rev/a24085e1b1f5

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20813
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20812] Explicitly cover application migration in the 2-3 guide

2014-03-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c83ce2a1841c by Brett Cannon in branch 'default':
null merge for issue #20812
http://hg.python.org/cpython/rev/c83ce2a1841c

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20812
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20813] Backport revised 2to3 guide to older branches

2014-03-07 Thread Brett Cannon

Brett Cannon added the comment:

Same version now in default, 3.3, and 2.7.

--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20813
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13936] RFE: change bool(datetime.time(0, 0, 0)) to evaluate as True

2014-03-07 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


--
nosy: +mark.dickinson

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13936
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20866] segfailt with os.popen and SIGPIPE

2014-03-07 Thread Hanno Boeck

New submission from Hanno Boeck:

I experience a segmentation fault with python 2.7 (both 2.7.5 and 2.7.6 tested 
on Ubuntu and Gentoo) when a large file is piped, the pipe is passed to 
os.popen and the process sends a SIGPIPE signal.

To create an easy to reproduce testcase grep can be used. See example attached.

To test first create a dummy file containing zeros, around 1 megabyte is enough:
for i in `seq 1 10`; do echo 0123456789  dummy.txt; done

Then pipe it to the script attached like this:
cat dummy.txt | python2 minimal.py

Result is a Segmentation fault. The same code doesn't segfault with python 3.

--
components: Interpreter Core
files: sigpipe_crash.py
messages: 212897
nosy: hanno
priority: normal
severity: normal
status: open
title: segfailt with os.popen and SIGPIPE
type: crash
versions: Python 2.7
Added file: http://bugs.python.org/file34301/sigpipe_crash.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20866
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20863] IDLE not opening

2014-03-07 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20863
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13936] RFE: change bool(datetime.time(0, 0, 0)) to evaluate as True

2014-03-07 Thread Westley Martínez

Changes by Westley Martínez aniko...@gmail.com:


--
nosy: +westley.martinez

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13936
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17267] datetime.time support for '+' and '-'

2014-03-07 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

I think the timezone related problems are a red herring.  Aware datetime +/- 
timedelta arithmetics is naive - tzinfo is ignored in calculations and copied 
to the result:

http://hg.python.org/cpython/file/c83ce2a1841c/Lib/datetime.py#l1711

The utcoffset only will only come into play if we want to implement time - time 
- timedelta, but this problem is already there in time comparisons:

http://hg.python.org/cpython/file/c83ce2a1841c/Lib/datetime.py#l1091

It is up to tzinfo subclass implementation writers to handle inability to 
compute utcoffset without date fields by raising an exception if necessary.  It 
is perfectly fine for time - time to fail with an error coming from 
.utcoffset().

I also don't think the fate of #13936 has any bearing on this issue.  As long 
as we are not trying to implement time + time - time, we are not introducing 
any new notion of zero time.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17267
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20867] fix_import in 2to3 adds spurious relative import (windows)

2014-03-07 Thread Claudio Canepa

New submission from Claudio Canepa:

0. windows specific

i. In the pyglet library, written for py2 and officially running in 3 after the 
stock installation that does the 2to3 conversion

ii. Omitting files which are unimportant for the issue, the package dir looks as

pyglet
   image
  codecs
 pil.py
(each package - subpackage has a proper __init__.py)

iii. In the pyglet repository checkout, near the begining of pil.py theres the 
block

try:
import Image
except ImportError:
from PIL import Image

That PIL refers to the pillow package (fork of PIL, and yes it its the 
recommended import line in pillow's doc)

iv. after installing with
   cd working_copy
   py -3.3 setup.py install

the same block looks as

try:
import Image
except ImportError:
from .PIL import Image

which is wrong, and precludes pyglet to import Pillow.

v. I tracked the problem to (CPython) LIB/lib2to3/fixes/fix_import.py

In  method FixImport.probably_a_local_import the heuristic is
if 'import name' is seen, look if theres a sibling file with that name, and if 
exists assume it needs to be a relative import

The problem is that the implementation uses os.path.exists to check sibling 
existence, but that has false positive cases due to Windows case-insensivity 
for filenames.

Module names are case-sensitive.

So, the import machinery would never match PIL to pil, but the code in 
fix_import.py will merrily match.

vi. To verify the issue I patched fix_import.py, deleted the old pyglet install 
under 3, reinstalled: Now the block is unmolested.
Attached the diff with the fixed code (diff obtained with the GNU C utils)

vii. This was seen in python 3.3.1 , on Windows xp sp3.
I see in the cpython repo the same issue will happen in the default branch (the 
offending lines in fix_import.py are unchanged, so I assume 3.4 will show the 
same defect)

viii. as a reference, the original issue in pyglet can be found at
http://code.google.com/p/pyglet/issues/detail?id=707

ix. Anyone can suggest a workaround, a change in the problematic block in 
pyglet that would tell 2to3 to not change the block ?

--
components: 2to3 (2.x to 3.x conversion tool)
files: fix_import.diff
keywords: patch
messages: 212899
nosy: ccanepa
priority: normal
severity: normal
status: open
title: fix_import in 2to3 adds spurious relative import (windows)
type: behavior
versions: Python 3.3
Added file: http://bugs.python.org/file34302/fix_import.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20867
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue809163] Can't add files with spaces

2014-03-07 Thread Matheus Vieira Portela

Matheus Vieira Portela added the comment:

I tried to apply the last patch but it returned me and error of failing hunk. I 
think it was based on an old version of the test_bdist_rpm.py file.

Hence, I made this updated version of the patch and could get the expected 
failure during the tests.

I should try and solve this bug soon.

--
Added file: 
http://bugs.python.org/file34303/test_bdist_rpm_filename_with_whitespaces.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue809163
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20867] fix_import in 2to3 adds spurious relative import (windows)

2014-03-07 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
nosy: +benjamin.peterson

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20867
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1580] Use shorter float repr when possible

2014-03-07 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
nosy: +eric.snow

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1580
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20849] add exist_ok to shutil.copytree

2014-03-07 Thread Éric Araujo

Éric Araujo added the comment:

Contrary to makedirs, there could be two interpretations for exist_ok in 
copytree: a) if a directory or file already exists in the destination, ignore 
it and go ahead  b) only do that for directories.

The proposed patch does b), but the cp tool does a).  It’s not clear to me 
which is best.  Can you start a discussion on the python-ideas mailing list?

--
nosy: +eric.araujo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20849
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20851] Update devguide to cover testing from a tarball

2014-03-07 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +eric.araujo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20851
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20847] asyncio docs should call out that network logging is a no-no

2014-03-07 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +eric.araujo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20847
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20840] AttributeError: 'module' object has no attribute 'ArgumentParser'

2014-03-07 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +eric.araujo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20840
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20819] reinitialize_command doesn't clear install_lib on install and install_lib commands

2014-03-07 Thread Éric Araujo

Éric Araujo added the comment:

If there is indeed a bug, I fear this is one of these areas where a fix 
actually breaks other build tools reusing distutils internals.

--
nosy: +eric.araujo
versions:  -Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20819
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20837] Ambiguity words in base64 documentation

2014-03-07 Thread Éric Araujo

Éric Araujo added the comment:

Additional edit to make the patch crystal-clear:

“using all three alphabets (normal, URL and Filesystem safe alphabet).”
→ “using all three alphabets defined in the RFC (normal, URL-safe and 
filesystem-safe)”

--
nosy: +eric.araujo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20837
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13936] RFE: change bool(datetime.time(0, 0, 0)) to evaluate as True

2014-03-07 Thread Ethan Furman

Ethan Furman added the comment:

If no one else has gotten to this in the next six months or so, I will.  :)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13936
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18882] Add threading.main_thread() function

2014-03-07 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Implementation uses the first choice:
main_thread() returns the original _MainThread instance, even if it's dead in 
the child process.

I'm sorry, would you guess desired documentation change?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18882
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue694339] IDLE: Dedenting with Shift+Tab

2014-03-07 Thread Sean Wolfe

Sean Wolfe added the comment:

I did a couple tests and the shift-tab and tab work pretty much as expected. 
There's a small quirk for a single-line edit:

* place cursor on beginning of line
* tab forward
-- the text indents as expected
* shift-tab
-- the entire line is highlighted
-- the cursor now appears beneath the line
-- subsequent typing however affects the highlighted line

For the single-line case, it would be cleaner to have it stay on the same line 
without highlighting.

This is OSX 10.9, python 2.7.6+ and 3.4.rc1+

--
nosy: +Sean.Wolfe

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue694339
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >