Re: Hello and sorry for disturbing !

2014-05-27 Thread Bob Martin
in 722639 20140526 144904 Mark Lawrence breamore...@yahoo.co.uk wrote:
On 26/05/2014 10:27, Radu Ioan Barbos wrote:
 Greetings from Romania,sorry for my english,i just wanted to ask you if
 i need any other software/program beside the one software from the next
 pagehttps://www.python.org/downloads/
 https://www.python.org/downloads/ or is it enough the software on that
 page , download and install it ? This question goes for both windows 7 
 ubuntu (ubuntu). Il be waiting for your answer , thank you verry much !
 Barbos Rau
 Timisoara,Romania !


As you've had answers to your questions I'll just say please don't
apologise for your English, it's an extremely difficult language to
learn.  Thank you.

You could have added that his English is already very good.  :-)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re:Command prompt not shown when running Python script with subprocess on Windows

2014-05-27 Thread Dave Angel
ps16thypresenceisfullnessof...@gmail.com Wrote in message:
 I have written a Python script with a wxPython GUI that uses subprocess.Popen 
 to open a list of files that the user provides. One of my users would like to 
 be able to run a Python script with my application. The Python script he is 
 trying to run uses the command line and gets keyboard input from the user 
 several times.
 
 The problem is that if the Python script is run on Windows with 
 subprocess.Popen, no command prompt is shown (my GUI application is a .pyw 
 file). The user's script runs silently but then does not quit because it is 
 waiting for input, but there is no way for the input to be given, since there 
 is no command prompt visible.
 
 I think this may be related to the fact that I am calling subprocess.Popen 
 with shell=True. I tried calling it with shell=False (the default), but then 
 I got an error that the file is not a valid Win32 application.
 
 I would appreciate any help with this problem.
 
 -- Timothy
 

If you want to use shell=False, you need to specify the executable
 correctly.  Since you're on Windows,  the executable is named
 python.exe, not myscript. py

If you still get errors,  you need to get a lot more explicit. 
 Copy/paste, not paraphrase. 

-- 
DaveA

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


Re: Command prompt not shown when running Python script with subprocess on Windows

2014-05-27 Thread Stephen Hansen
You need to call python.exe path-to-script.py, I think, not just
path-to-script.py. See sys.executable (though that depends on if you're a
frozen app or not).

I can't be sure though because there's no code. Show code when asking
questions, it helps frame the discussion and get a better answer ;)


On Mon, May 26, 2014 at 5:03 PM,
ps16thypresenceisfullnessof...@gmail.comwrote:

 I have written a Python script with a wxPython GUI that uses
 subprocess.Popen to open a list of files that the user provides. One of my
 users would like to be able to run a Python script with my application. The
 Python script he is trying to run uses the command line and gets keyboard
 input from the user several times.

 The problem is that if the Python script is run on Windows with
 subprocess.Popen, no command prompt is shown (my GUI application is a .pyw
 file). The user's script runs silently but then does not quit because it is
 waiting for input, but there is no way for the input to be given, since
 there is no command prompt visible.

 I think this may be related to the fact that I am calling subprocess.Popen
 with shell=True. I tried calling it with shell=False (the default), but
 then I got an error that the file is not a valid Win32 application.

 I would appreciate any help with this problem.

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

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


Python box (home-use smart router)

2014-05-27 Thread animalize81

Home-use smart router is more and more popular.

If Python Software Foundation embeds Python into such router, and 
develops a framework that has the following features:


1, allow power-down at any time
2, dynamic domain name
3, local storage support (SD cards or Hard Disk)
4, telnet server
etc.

Then we can create micro private server on it.

Still can't see the full prospect, but it may be a great platform for 
people's imagination.


I think Python is very suitable for such role.

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


Check to see if the script has been previously used?

2014-05-27 Thread KC Sparks
Hi,

I was wondering if there was an extension or way that would allow me to
print instructions if it is the first the the user has used the script.

Thanks,
KC
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Check to see if the script has been previously used?

2014-05-27 Thread Chris Angelico
On Tue, May 27, 2014 at 5:45 PM, KC Sparks kcrspa...@gmail.com wrote:
 I was wondering if there was an extension or way that would allow me to
 print instructions if it is the first the the user has used the script.

The trickiest part is defining the 'user'. Generally, this sort of
thing is done by creating a file; if the file's not there, it's the
first time. Some versions of sudo will create a file called
.sudo_as_admin_successful in the user's home directory; others create
/var/lib/sudo/username as a directory, and storing information
there. Either technique works well for recognizing a first-time user.

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


Regular Expression for the special character | pipe

2014-05-27 Thread Aman Kashyap
I would like to create a regular expression in which i can match the | 
special character too.

e.g.

start=|ID=ter54rt543d|SID=ter54rt543d|end=|

I want to only |ID=ter54rt543d| from the above string but i am unable to write 
the  pattern match containing | pipe too.

By default python treat | as an OR operator.

But in my case I want to use to as a part of search string.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Check to see if the script has been previously used?

2014-05-27 Thread Dave Angel
Chris Angelico ros...@gmail.com Wrote in message:
 On Tue, May 27, 2014 at 5:45 PM, KC Sparks kcrspa...@gmail.com wrote:
 I was wondering if there was an extension or way that would allow me to
 print instructions if it is the first the the user has used the script.
 
 The trickiest part is defining the 'user'. Generally, this sort of
 thing is done by creating a file; if the file's not there, it's the
 first time. Some versions of sudo will create a file called
 .sudo_as_admin_successful in the user's home directory; others create
 /var/lib/sudo/username as a directory, and storing information
 there. Either technique works well for recognizing a first-time user.
 
 ChrisA
 

The problem can be simpler if you're assuming a machine with only
 one user, or more complicated if the obvious disk location is
 either read-only to the user, or volatile. 

You also might want to clear all such flags upon an upgrade.  If
 so, it's not just a file needed, but a sortable version
 string.

Preferred approach is usually to respond to one of the
 conventional argv switches.  And let the user decide.
 

-- 
DaveA

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


Re: Check to see if the script has been previously used?

2014-05-27 Thread Chris Angelico
On Tue, May 27, 2014 at 9:05 PM, Dave Angel da...@davea.name wrote:
 Preferred approach is usually to respond to one of the
  conventional argv switches.  And let the user decide.

Yes, this is a technique I've used when doing up important (and
dangerous) MUD commands. The command will be something like unload
foo and it gives its first-time spam, or unload confirm foo to
suppress it and go straight to the potentially-dangerous action. With
shell commands, a -f or --force parameter would be common for that.

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


Re: Regular Expression for the special character | pipe

2014-05-27 Thread Vlastimil Brom
2014-05-27 12:59 GMT+02:00 Aman Kashyap amankashyap1...@gmail.com:
 I would like to create a regular expression in which i can match the | 
 special character too.

 e.g.

 start=|ID=ter54rt543d|SID=ter54rt543d|end=|

 I want to only |ID=ter54rt543d| from the above string but i am unable to 
 write the  pattern match containing | pipe too.

 By default python treat | as an OR operator.

 But in my case I want to use to as a part of search string.
 --

Hi,
you can just escpape the pipe with backlash like any other metacharacter:

rstart=\|ID=ter54rt543d

be sure to use the raw string notation r..., or you can double all
backslashes in the string.

hth,
   vbr
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Regular Expression for the special character | pipe

2014-05-27 Thread Aman Kashyap
On Tuesday, 27 May 2014 16:39:19 UTC+5:30, Vlastimil Brom  wrote:
 2014-05-27 12:59 GMT+02:00 Aman Kashyap amankashyap1...@gmail.com:
 
  I would like to create a regular expression in which i can match the | 
  special character too.
 
 
 
  e.g.
 
 
 
  start=|ID=ter54rt543d|SID=ter54rt543d|end=|
 
 
 
  I want to only |ID=ter54rt543d| from the above string but i am unable to 
  write the  pattern match containing | pipe too.
 
 
 
  By default python treat | as an OR operator.
 
 
 
  But in my case I want to use to as a part of search string.
 
  --
 
 
 
 Hi,
 
 you can just escpape the pipe with backlash like any other metacharacter:
 
 
 
 rstart=\|ID=ter54rt543d
 
 
 
 be sure to use the raw string notation r..., or you can double all
 
 backslashes in the string.
 
 
 
 hth,
 
vbr


Thanks vbr for the quick response.

I have string = |SOH=|ID=re65dgt5dd|DS=fjkjf|SDID=fhkhkf|ID=fkjfkf|EOM=|

and want to replace 2 sub-strings
|ID=re65dgt5dd| with |ID=MAN|
|ID=fkjfkf| with |MAN|

I am using regular expression ID=[a-z]*[0-9]*[a-z]*[0-9]*[a-z]*|$

the output is |SOH=|ID=MAN|DS=fjkjf|SDID=MAN|ID=MAN|EOM=|ID=MAN

expected value is = |SOH=|ID=MAN|DS=fjkjf|SDID=fhkhkf|ID=MAN|EOM=|

could you please help me in this regard?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Regular Expression for the special character | pipe

2014-05-27 Thread Daniel

What about skipping the re and try this:

'start=|ID=ter54rt543d|SID=ter54rt543d|end=|'.split('|')[1][3:]

On 27.05.2014 14:09, Vlastimil Brom wrote:

2014-05-27 12:59 GMT+02:00 Aman Kashyap amankashyap1...@gmail.com:

I would like to create a regular expression in which i can match the | 
special character too.

e.g.

start=|ID=ter54rt543d|SID=ter54rt543d|end=|

I want to only |ID=ter54rt543d| from the above string but i am unable to write the  
pattern match containing | pipe too.

By default python treat | as an OR operator.

But in my case I want to use to as a part of search string.
--

Hi,
you can just escpape the pipe with backlash like any other metacharacter:

rstart=\|ID=ter54rt543d

be sure to use the raw string notation r..., or you can double all
backslashes in the string.

hth,
vbr


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


Re: Regular Expression for the special character | pipe

2014-05-27 Thread Aman Kashyap
On Tuesday, 27 May 2014 16:59:38 UTC+5:30, Daniel  wrote:
 What about skipping the re and try this:
 
 
 
 'start=|ID=ter54rt543d|SID=ter54rt543d|end=|'.split('|')[1][3:]
 
 
 
 On 27.05.2014 14:09, Vlastimil Brom wrote:
 
  2014-05-27 12:59 GMT+02:00 Aman Kashyap amankashyap1...@gmail.com:
 
  I would like to create a regular expression in which i can match the | 
  special character too.
 
 
 
  e.g.
 
 
 
  start=|ID=ter54rt543d|SID=ter54rt543d|end=|
 
 
 
  I want to only |ID=ter54rt543d| from the above string but i am unable to 
  write the  pattern match containing | pipe too.
 
 
 
  By default python treat | as an OR operator.
 
 
 
  But in my case I want to use to as a part of search string.
 
  --
 
  Hi,
 
  you can just escpape the pipe with backlash like any other metacharacter:
 
 
 
  rstart=\|ID=ter54rt543d
 
 
 
  be sure to use the raw string notation r..., or you can double all
 
  backslashes in the string.
 
 
 
  hth,
 
  vbr

Thanks for the response.

I got the answer finally.

This is the regular expression to be 
used:\\|ID=[a-z]*[0-9]*[a-z]*[0-9]*[a-z]*\\|
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Regular Expression for the special character | pipe

2014-05-27 Thread Wolfgang Maier

On 27.05.2014 13:39, Aman Kashyap wrote:

On 27.05.2014 14:09, Vlastimil Brom wrote:


you can just escpape the pipe with backlash like any other metacharacter:

rstart=\|ID=ter54rt543d

be sure to use the raw string notation r..., or you can double all



backslashes in the string.



Thanks for the response.

I got the answer finally.

This is the regular expression to be 
used:\\|ID=[a-z]*[0-9]*[a-z]*[0-9]*[a-z]*\\|



or, and more readable:

r'\|ID=[a-z]*[0-9]*[a-z]*[0-9]*[a-z]*\|'

This is what Vlastimil was talking about. It saves you from having to 
escape the backslashes.


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


Re: How keep Python 3 moving forward

2014-05-27 Thread wxjmfauth
Le lundi 26 mai 2014 01:09:31 UTC+2, Mark Lawrence a écrit :
 On 25/05/2014 23:22, Dennis Lee Bieber wrote:
 
  On Sun, 25 May 2014 11:34:59 -0700, Ethan Furman et...@stoneleaf.us
 
  declaimed the following:
 
 
 
  On 05/25/2014 10:38 AM, Rustom Mody wrote:
 
 
 
  Your unicode is mojibaked  Ethan! Voil�.
 
  You are hereby banished to a lonely island with python 1.5 and jmf for 
  company :D
 
 
 
  1.5 I could live with.  :(  Surely the company would count as cruel and
 
  unusual punishment?
 
 
 
  company... Or emergency rations?
 
 
 
 
 
 I suspect that chewing razor blades would be preferable to listening to 
 
 the permanent rant about what's wrong with the FSR.
 
 
 
 -- 
 
 My fellow Pythonistas, ask not what our language can do for you, ask 
 
 what you can do for our language.
 
 
 
===
===

It's just a mathematical absurdity.
(No problems, to explain this to some
other people, who are agreeing).

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


Re: Regular Expression for the special character | pipe

2014-05-27 Thread Roy Smith
In article mailman.10370.1401191774.18130.python-l...@python.org,
 Wolfgang Maier wolfgang.ma...@biologie.uni-freiburg.de wrote:

 On 27.05.2014 13:39, Aman Kashyap wrote:
  On 27.05.2014 14:09, Vlastimil Brom wrote:
 
  you can just escpape the pipe with backlash like any other metacharacter:
 
  rstart=\|ID=ter54rt543d
 
  be sure to use the raw string notation r..., or you can double all
 
  backslashes in the string.
 
  Thanks for the response.
 
  I got the answer finally.
 
  This is the regular expression to be 
  used:\\|ID=[a-z]*[0-9]*[a-z]*[0-9]*[a-z]*\\|
 
 
 or, and more readable:
 
 r'\|ID=[a-z]*[0-9]*[a-z]*[0-9]*[a-z]*\|'
 
 This is what Vlastimil was talking about. It saves you from having to 
 escape the backslashes.

Sometimes what I do, instead of using backslashes, I put the problem 
character into a character class by itself.  It's a matter of personal 
opinion which way is easier to read, but it certainly eliminates all the 
questions about how many backslashes do I need?

 r'[|]ID=[a-z]*[0-9]*[a-z]*[0-9]*[a-z]*[|]'

Another thing that can help make regexes easier to read is the VERBOSE 
flag.  Basically, it ignores whitespace inside the regex (see 
https://docs.python.org/2/library/re.html#module-contents for details).  
So, you can write something like:

pattern = re.compile(r'''[|]
 ID=
 [a-z]*
 [0-9]*
 [a-z]*
 [0-9]*
 [a-z]*
 [|]''',
 re.VERBOSE)

Or, alternatively, take advantage of the fact that Python concatenates 
adjacent string literals, and write it like this:

pattern = re.compile(r'[|]'
 r'ID='
 r'[a-z]*'
 r'[0-9]*'
 r'[a-z]*'
 r'[0-9]*'
 r'[a-z]*'
 r'[|]'
)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Regular Expression for the special character | pipe

2014-05-27 Thread Mark Lawrence

On 27/05/2014 12:39, Aman Kashyap wrote:

On Tuesday, 27 May 2014 16:59:38 UTC+5:30, Daniel  wrote:

What about skipping the re and try this:



'start=|ID=ter54rt543d|SID=ter54rt543d|end=|'.split('|')[1][3:]



On 27.05.2014 14:09, Vlastimil Brom wrote:


2014-05-27 12:59 GMT+02:00 Aman Kashyap amankashyap1...@gmail.com:



I would like to create a regular expression in which i can match the | 
special character too.







e.g.







start=|ID=ter54rt543d|SID=ter54rt543d|end=|







I want to only |ID=ter54rt543d| from the above string but i am unable to write the  
pattern match containing | pipe too.







By default python treat | as an OR operator.







But in my case I want to use to as a part of search string.



--



Hi,



you can just escpape the pipe with backlash like any other metacharacter:







rstart=\|ID=ter54rt543d







be sure to use the raw string notation r..., or you can double all



backslashes in the string.







hth,



 vbr


Thanks for the response.

I got the answer finally.

This is the regular expression to be 
used:\\|ID=[a-z]*[0-9]*[a-z]*[0-9]*[a-z]*\\|



I'm pleased to see that you have answers.  In return would you please 
use the mailing list 
https://mail.python.org/mailman/listinfo/python-list or read and action 
this https://wiki.python.org/moin/GoogleGroupsPython to prevent us 
seeing double line spacing and single line paragraphs, thanks.


--
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: is there a list/group for beginners?

2014-05-27 Thread John Ladasky
Hi, Deb.

Ten years ago (or eleven?), I was completely new to Python.  I could not begin 
to understand over 90 percent of what I was reading here in comp.lang.python.  
Still, I asked my newbie questions here.  For the most part, I got excellent 
responses.  I think you're in the right place.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python is horribly slow compared to bash!!

2014-05-27 Thread Grant Edwards
On 2014-05-26, Dennis Lee Bieber wlfr...@ix.netcom.com wrote:
 On Mon, 26 May 2014 19:00:11 +0200, Johannes Bauer dfnsonfsdu...@gmx.de
 declaimed the following:


Now let's all code Itanium assembler, yes?

 Naw... Let's beg Intel to bring back the iAPX-432, and beg AdaCore to
 port GNAT to it.

When the '432 datasheets came out, everybody thought it was pretty
cool.  Turns out it just didn't go.  So, Intel lowered its sights
and concentrated on the 8086 family, and we all suffered for the next
few decades as a result...

-- 
Grant Edwards   grant.b.edwardsYow! I smell like a wet
  at   reducing clinic on Columbus
  gmail.comDay!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: hashing strings to integers

2014-05-27 Thread Adam Funk
On 2014-05-23, Chris Angelico wrote:

 On Fri, May 23, 2014 at 8:27 PM, Adam Funk a24...@ducksburg.com wrote:
 I've also used hashes of strings for other things involving
 deduplication or fast lookups (because integer equality is faster than
 string equality).  I guess if it's just for deduplication, though, a
 set of byte arrays is as good as a set of int?

 Want a better way to do that? Use a set or dict and let Python do the
 hashing. It'll be every bit as fast as explicit hashing, plus you get
 the bonus of simplicity.

Well, here's the way it works in my mind:

   I can store a set of a zillion strings (or a dict with a zillion
   string keys), but every time I test if new_string in
   seen_strings, the computer hashes the new_string using some kind
   of short hash, checks the set for matching buckets (I'm assuming
   this is how python tests set membership --- is that right?), then
   checks any hash-matches for string equality.  Testing string
   equality is slower than integer equality, and strings (unless they
   are really short) take up a lot more memory than long integers.

So for that kind of thing, I tend to store MD5 hashes or something
similar.  Is that wrong?


-- 
With the breakdown of the medieval system, the gods of chaos, lunacy,
and bad taste gained ascendancy.
--- Ignatius J Reilly
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: hashing strings to integers

2014-05-27 Thread Adam Funk
On 2014-05-23, Terry Reedy wrote:

 On 5/23/2014 6:27 AM, Adam Funk wrote:

 that.  The only thing that really bugs me in Python 3 is that execfile
 has been removed (I find it useful for testing things interactively).

 The spelling has been changed to exec(open(...).read(), ... . It you use 
 it a lot, add a customized def execfile(filename, ... to your site 
 module or local utils module.

Are you talking about this?

https://docs.python.org/3/library/site.html

Is there a dummies/quick-start guide to using USER_SITE stuff?


-- 
No sport is less organized than Calvinball!
-- 
https://mail.python.org/mailman/listinfo/python-list


python

2014-05-27 Thread himanshulkce
Need of python in embedded systems???
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: hashing strings to integers

2014-05-27 Thread Steven D'Aprano
On Tue, 27 May 2014 16:13:46 +0100, Adam Funk wrote:

 On 2014-05-23, Chris Angelico wrote:
 
 On Fri, May 23, 2014 at 8:27 PM, Adam Funk a24...@ducksburg.com
 wrote:
 I've also used hashes of strings for other things involving
 deduplication or fast lookups (because integer equality is faster than
 string equality).  I guess if it's just for deduplication, though, a
 set of byte arrays is as good as a set of int?

 Want a better way to do that? Use a set or dict and let Python do the
 hashing. It'll be every bit as fast as explicit hashing, plus you get
 the bonus of simplicity.
 
 Well, here's the way it works in my mind:
 
I can store a set of a zillion strings (or a dict with a zillion
string keys), but every time I test if new_string in seen_strings,
the computer hashes the new_string using some kind of short hash,
checks the set for matching buckets (I'm assuming this is how python
tests set membership --- is that right?), 

So far so good. That applies to all objects, not just strings.


then checks any
hash-matches for string equality.  Testing string equality is slower
than integer equality, and strings (unless they are really short)
take up a lot more memory than long integers.

But presumably you have to keep the string around anyway. It's going to 
be somewhere, you can't just throw the string away and garbage collect 
it. The dict doesn't store a copy of the string, it stores a reference to 
it, and extra references don't cost much.

As for string equality, in pseudo-code it looks something like this:

def __eq__(self, other):
# Consider only the case where other is a string as well.
if self is other:  # object identity
return True
if len(self) != len(other):  # checking the length is fast
return False
# iterate over both strings in lock-step
for a in self, b in other:
if a != b: return False
return True

only written in fast C code. So the equality test bails out as quickly as 
possible, and the only time you have to look at every character is if the 
two strings are equal but not the same object.

MD5 hashing, on the other hand, *always* has to look at every character, 
and perform quite a complicated set of computations. It's expensive.


 So for that kind of thing, I tend to store MD5 hashes or something
 similar.  Is that wrong?

First rule of optimization: Don't do it.
Second rule of optimization (for experts only): Don't do it yet.

You're making the cardinal mistake of optimization, not what is slow, but 
what you *assume* will be slow. (Or, replace memory consumption for speed 
if you prefer.) Python is not C, and your intuitions for what's fast and 
slow (low and high memory consumption) are likely to be way off. Consider 
trying to store an MD5 hash instead of the string Hello World!. If I 
try this in Python 2.7, I get this:


py import md5, sys
py s = Hello World!
py n = int(md5.md5(s).hexdigest(), 16)
py sys.getsizeof(s)
33
py sys.getsizeof(n)
30


I save a lousy 3 bytes. But in order to save that 3 bytes, I have to 
generate an md5 object (32 bytes) and a hex string (53 bytes), both of 
which take time to create and then time to garbage collect.

Actually, I don't even save those 3 bytes, since for nearly all 
reasonable applications, I'll need to keep the string around somewhere. 
So instead of saving three bytes, it's costing me thirty bytes for the 
hash, plus who-knows-what needed to manage the book keeping to link that 
hash to the actual string.

Ah, but maybe we can save time hashing them?

py from timeit import Timer
py setup = from __main__ import s, n
py t1 = Timer(hash(s), setup)
py t2 = Timer(hash(n), setup)
py min(t1.repeat(5))
0.14668607711791992
py min(t2.repeat(5))
0.15973114967346191

Times are in seconds for one million iterations of the code being timed. 
Or alternatively, it costs about 0.14 microseconds to hash the string, 
and about 0.15 microseconds to hash the MD5 hash. **Not** to calculate 
the MD5 hash in the first place, that takes *much* longer:

py t3 = Timer(md5.md5(s).hexdigest(), import md5; s = 'Hello World!')
py min(t3.repeat(5))
2.3326950073242188

but merely to perform a lightweight hash on the long int so as to find 
which bucket of the dict it belongs to.

So, yes, chances are **very** good that you're supposed optimizations in 
this area are actually pessimizations. If you have not measured where the 
bottlenecks in your code are, you have no idea which parts of the code 
need to be optimized.

Now, it is conceivable that there may be some circumstances where your 
strategy makes sense. I'm guessing you would need something like this 
before you even come close to saving memory and/or time:

- rather than short keys like Hello World!, you are dealing with 
  keys that are typically many tens of thousands of characters long;

- most of the strings are the same length and have very similar 
  prefixes (e.g. the first 

Re: hashing strings to integers

2014-05-27 Thread Chris Angelico
On Wed, May 28, 2014 at 3:02 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 But I know that Python is a high-level language with
 lots of high-level data structures like dicts which trade-off time and
 memory for programmer convenience, and that I'd want to see some real
 benchmarks proving that my application was too slow before giving up that
 convenience with a complicated strategy like this.

And they trade off that time and memory on the basis of X years of
development expertise. A while ago (about ten years or so, now... wow,
that's quite a while) I wrote a C++ program that needed an
ever-growing array; for simplicity, I went with a very basic system of
doubling the size every time, from a base of something like 1024 or
8192. (Note that it was storing and moving around only pointers, so
it's comparable to Python's list.) That means it has an average 25%
slack space at all times, more until its first allocation, and every
now and then it has a huge job of copying a pile of pointers into a
new array. (Imagine it's now at 16777216 and it needs to add the
16,777,217th string to the array. Bye-bye CPU caches.) These
boundaries became *user-visible pauses*, fortunately at predictable
points, but on a not-terrible computer it could cause a 1s pause just
copying heaps of pointers. How do you think a Python list will
perform, under the same workload (periodic appending of single strings
or small groups of strings, very frequent retrieval based on index -
probably about a 20:1 read:write ratio)? Not only would it be far more
convenient, it's probably going to outperform my hand-rolled code -
unless I'm so brilliant (or lucky) that I can stumble to something as
good as can be achieved with years of dedicated development. Yeah, I
don't think so.

Same goes for hashing algorithms. I can at least boast that I've never
written one of those... although I have several times written a binary
tree of one form or another, in order to provide comparable features
to a dict. And once again, now that I know how convenient and
performant high level languages can be (which may or may not have been
true 15 years ago, but I certainly didn't know it), I don't rewrite
what can be done better by just tossing in a couple of curly braces
and saying here, map this to that.

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


help with memory leak

2014-05-27 Thread Neal Becker
I'm trying to track down a memory leak in a fairly large code.  It uses a lot 
of 
numpy, and a bit of c++-wrapped code.  I don't yet know if the leak is purely 
python or is caused by the c++ modules.

At each iteration of the main loop, I call gc.collect()
If I then look at gc.garbage, it is empty.

I've tried using objgraph.  I don't know how to interpret the result.  I don't 
know if this is the main leakage, but I see that each iteration there are more
'Burst' objects.  If I look at backrefs to them using this code:

   for frame in count(1): ## main loop starts here
gc.collect()
objs = objgraph.by_type('Burst')
print(objs)
if len (objs) != 0:
print(objs[0], gc.is_tracked (objs[0]))
objgraph.show_backrefs(objs[0], max_depth=10, refcounts=True)

I will get a graph like that attached

A couple of strange things.

The refcounts (9) of the Burst object don't match the number of arrows into it.
There are 2 lists with 0 refs.  Why weren't they collected?-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Hello and sorry for disturbing !

2014-05-27 Thread giacomo boffi
Rustom Mody rustompm...@gmail.com writes:

 For ubuntu you should need nothing for python.
 In other words python should run on a basic ubuntu installation.
 From the shell just type python and the interpreter should start.

 For more specialized work there are dozens (maybe hundreds?) of
 packages in the apt repos.

% apt-cache show pythonTABTAB
Display all 2776 possibilities? (y or n)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Hello and sorry for disturbing !

2014-05-27 Thread maksufff
I recommend to install PyCharm

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


Re: Hello and sorry for disturbing !

2014-05-27 Thread maksufff
I recommend you to install PyCharm
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Hello and sorry for disturbing !

2014-05-27 Thread maksufff
I recommend you to install PyCharm
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Hello and sorry for disturbing !

2014-05-27 Thread Chris Angelico
On Wed, May 28, 2014 at 5:56 AM, giacomo boffi pec...@pascolo.net wrote:
 Rustom Mody rustompm...@gmail.com writes:

 For ubuntu you should need nothing for python.
 In other words python should run on a basic ubuntu installation.
 From the shell just type python and the interpreter should start.

 For more specialized work there are dozens (maybe hundreds?) of
 packages in the apt repos.

 % apt-cache show pythonTABTAB
 Display all 2776 possibilities? (y or n)

Not quite fair, as some of those exist in multiple forms (python-* and
python3-*, or -dbg and -dev as well as the base package, or the
package-and-subpackage model of large stuff like python-django-*), and
on Debian Wheezy I have only (only!) 1890. But yep, that is a lot of
packages available in apt.

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


Re: help with memory leak

2014-05-27 Thread Chris Angelico
On Wed, May 28, 2014 at 5:56 AM, Neal Becker ndbeck...@gmail.com wrote:
 I'm trying to track down a memory leak in a fairly large code.  It uses a lot 
 of
 numpy, and a bit of c++-wrapped code.  I don't yet know if the leak is purely
 python or is caused by the c++ modules.

Something to try, which would separate the two types of leak: Run your
program in a separate namespace of some sort (eg a function), make
sure all your globals have been cleaned up, run a gc collection, and
then see if you still have a whole lot more junk around. If that
cleans everything up, it's some sort of refloop; if it doesn't, it's
either a global you didn't find, or a C-level refleak.

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


Re: Python box (home-use smart router)

2014-05-27 Thread Tim Chase
On 2014-05-27 15:33, animalize81 wrote:
 Home-use smart router is more and more popular.
 
 If Python Software Foundation embeds Python into such router, and 
 develops a framework that has the following features:
 
 1, allow power-down at any time
 2, dynamic domain name
 3, local storage support (SD cards or Hard Disk)
 4, telnet server
 etc.
 
 Then we can create micro private server on it.

It certainly can.  I've got a Buffalo router here that runs a
stripped-down version of Linux and has Python installed on it. No
need for the PSF to get involved because people are already creating
these without them.  I know that a lot of folks use an old router and
put OpenWRT, DD-WRT, or Tomato firmware on them.  This would give you
a Linux platform on which you can install Python, usually telnet (or
more likely, SSH) support, and can be integrated with a number of
dynamic-DNS services.

You could even grab a Raspberry Pi (model B with ethernet), add a USB
ethernet adaptor, and you'd have a pretty nice machine with 512MB of
RAM (the router platforms don't usually have more than ~64MB of RAM),
two ethernet ports for routing, and would support SD or USB drives.

-tkc



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


Re: Hello and sorry for disturbing !

2014-05-27 Thread Mark Lawrence

On 27/05/2014 21:02, maksu...@gmail.com wrote:

I recommend to install PyCharm



Three copies in three minutes of one line with no context, that's a 
record, congratulations :)


--
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: python

2014-05-27 Thread Tim Chase
On 2014-05-27 08:43, himanshul...@gmail.com wrote:
 Need of python in embedded systems???

Define embedded.

I've got a couple small low-powered devices here (a Digi ConnectPort,
a Raspberry Pi, a low-end 32-bit system with 32MB of RAM) all of
which run Python.

It might be trickier if you're talking about some super low-end
hardware where you don't have a memory management unit, a
full-fledged OS.

-tkc



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


Re: is there a list/group for beginners?

2014-05-27 Thread Deb Wyatt


 -Original Message-
 From: john_lada...@sbcglobal.net
 Sent: Tue, 27 May 2014 11:38:39 -0700 (PDT)
 To: python-list@python.org
 Subject: Re: is there a list/group for beginners?
 
 Hi, Deb.
 
 Ten years ago (or eleven?), I was completely new to Python.  I could not
 begin to understand over 90 percent of what I was reading here in
 comp.lang.python.  Still, I asked my newbie questions here.  For the most
 part, I got excellent responses.  I think you're in the right place.
 --
 https://mail.python.org/mailman/listinfo/python-list

thanks,John. I guess I was/am afraid to embarrass myself on this list, but then 
I accidentally posted a question meant for the tutor list and ended up getting 
more for my money than I expected :).  I really appreciate that the people on 
this list are so friendly and willing to help.


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
Check it out at http://www.inbox.com/earth


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


Re: is there a list/group for beginners?

2014-05-27 Thread Chris Angelico
On Wed, May 28, 2014 at 7:38 AM, Deb Wyatt codemon...@inbox.com wrote:
 thanks,John. I guess I was/am afraid to embarrass myself on this list, but 
 then I accidentally posted a question meant for the tutor list and ended up 
 getting more for my money than I expected :).  I really appreciate that the 
 people on this list are so friendly and willing to help.


Asking newbie questions isn't going to get you flamed here, we're
pretty friendly :) Anyway, we're all newbies in whatever areas we
haven't actually dug into. (I denewbified myself in Flask just last
week, and there's plenty more of Python that I've never touched.) So
go for it, ask those questions! Reveal your ignorance. Let us reveal
ours, as we make errors in responses. And by the end of the thread,
all the errors will have been corrected and the ignorance cured... and
we'll all have learned. That, in my books, is a recipe for an awesome
thread. Bring it on!

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


Re: Command prompt not shown when running Python script with subprocess on Windows

2014-05-27 Thread ps16thypresenceisfullnessofjoy
Sorry for not being explicit enough. I am aware that this would work if I 
called python.exe path-to-script.py with shell=False.

In my Python program, I parse an XML file like the one I have included below. 
Then I loop through the paths of the apps listed in it and run them by calling 
something like this:

for app_path in app_paths:
args = shlex.split(app_path.replace(\\, ))
args = [arg.replace(, \\) for arg in args]
args[0] = os.path.expandvars(args[0])
subprocess.Popen(args, shell='__WXMSW__' in wx.PlatformInfo)

I want users to be able to enter paths in the XML file exactly the way they 
would be entered in a Windows shortcut. Since it is possible to make a Windows 
shortcut for path-to-script.py without the python.exe in front of it and have 
it open in its own command prompt, I want to be able to do the same thing in my 
XML file, but this is what I cannot figure out.

By the way, is there a simpler way to use shlex.split and return valid Windows 
paths than the way I am doing (as shown above)?

Thank you.

-- Timothy

*** Contents of app_list.xml below ***

?xml version='1.0' encoding='utf-8'?
apps
  app name=Mozilla Firefox%ProgramFiles%\Mozilla Firefox\firefox.exe/app
  app name=Mozilla Thunderbird%ProgramFiles%\Mozilla 
Thunderbird\thunderbird.exe/app
  app name=LibreOffice Writer%ProgramFiles%\LibreOffice 
4\program\swriter.exe C:\Users\Timothy\Documents\myfile.odt/app
  app name=**Python 
script**C:\Users\Timothy\Documents\Python\myscript.py/app
/apps
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: hashing strings to integers

2014-05-27 Thread Dan Sommers
On Tue, 27 May 2014 17:02:50 +, Steven D'Aprano wrote:

 - rather than zillions of them, there are few enough of them that
  the chances of an MD5 collision is insignificant;

   (Any MD5 collision is going to play havoc with your strategy of
   using hashes as a proxy for the real string.)

 - and you can arrange matters so that you never need to MD5 hash a
   string twice.

Hmmm...  I'll use the MD5 hashes of the strings as a key, and the
strinsgs as the value (to detect MD5 collisions) ...

(But I'm sure that Steven was just waiting for someone to take that
bait...)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Command prompt not shown when running Python script with subprocess on Windows

2014-05-27 Thread Tim Golden

On 28/05/2014 00:01, ps16thypresenceisfullnessof...@gmail.com wrote:


I want users to be able to enter paths in the XML file exactly the
way they would be entered in a Windows shortcut. Since it is possible
to make a Windows shortcut for path-to-script.py without the
python.exe in front of it and have it open in its own command prompt,
I want to be able to do the same thing in my XML file, but this is
what I cannot figure out.


Anything done through shortcuts is making use of the Windows Shell API. 
To mimic that behaviour, you could try using that; in this case, 
ShellExecute[Ex]. For simple purposes, this is exposed in Python as 
os.startfile. If you need more control, you'd have to use the API call 
directly, either via ctypes or via the pywin32 libraries under the 
win32com.shell package.


To mimic the behaviour exactly (if that is a requirement), you could 
actually create a temporary shortcut with the desired information and 
invoke it via os.startfile.


I haven't followed the thread (and I'm offline at the moment) so I'll 
wait until I've seen it before I comment on the shlex.split / \\ dance 
above. On the surface, though, I'm not sure what it's achieving. [All 
right, I didn't wait :)].


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


[issue16638] support multi-line docstring signatures in IDLE calltips

2014-05-27 Thread Terry J. Reedy

Terry J. Reedy added the comment:

As I said previously, the only reason for the change was get all the docstring 
signature lines for builtins, after they were changed from 1 to many. I was not 
thrilled with having to do this. However, I felt that just presenting the 
arbitrary first of many lines was (and would be) a bug.

For 3.4+, this is a temporary measure until Argument Clinic is applied to 
enough builtins to make it sensible to switch calltips to using 
str(inspect.signature). See #19903. When A.C. is applied to a function, the 
signature is no longer in the docstring, which instead starts with 'Returns (or 
whatever) just as for python-coded functions.

Since A.C. and #19903 do not apply to 2.7, feel free to develop a more 
permanent alternative for 2.7. Perhaps just say expand multiple line 
signature and have a click on that line do the expansion instead of dismissing 
the box.

If you do, I can check whether the A.C conversion has been slow enough to make 
temporary application to 3.4 worthwhile, or if *really* slow, to 3.5. The click 
idea, while still needed, might be combined with using .signature, but I have 
to recheck its current behavior.

--
assignee: terry.reedy - 
type: behavior - enhancement
versions:  -Python 3.3, Python 3.4

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



[issue21477] Idle: improve idle_test.htest

2014-05-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 72a8a107eed1 by Terry Jan Reedy in branch '2.7':
Issue #21477: Idle htest: modify run; add more tests.
http://hg.python.org/cpython/rev/72a8a107eed1

--

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



[issue21498] configparser accepts keys beginning with comment_chars when writing

2014-05-27 Thread Łukasz Langa

Changes by Łukasz Langa luk...@langa.pl:


--
assignee:  - lukasz.langa

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



[issue10203] sqlite3.Row doesn't support sequence protocol

2014-05-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Compare with tuple:

 (1, 2)[2**1000]
Traceback (most recent call last):
  File stdin, line 1, in module
IndexError: cannot fit 'int' into an index-sized integer

--

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



[issue21477] Idle: improve idle_test.htest

2014-05-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e770d8c4291c by Terry Jan Reedy in branch '2.7':
Issue #21477: Add htests for Search and Replace dialogs.
http://hg.python.org/cpython/rev/e770d8c4291c

New changeset b8e4bb1e1090 by Terry Jan Reedy in branch '3.4':
Issue #21477: Add htests for Search and Replace dialogs.
http://hg.python.org/cpython/rev/b8e4bb1e1090

--

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



[issue10203] sqlite3.Row doesn't support sequence protocol

2014-05-27 Thread Claudiu.Popa

Claudiu.Popa added the comment:

Thanks. Patch modified.

--
Added file: http://bugs.python.org/file35376/issue10203_2.patch

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



[issue21477] Idle: improve idle_test.htest

2014-05-27 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I think it time to make running through all or just some of the tests more 
pleasant. If we reversed the order [next], [test name], test instruction, then 
[next] would not just up and down. If the window were set to a constant width, 
then it would not jump back and forth either. The width should be just wide 
enough for the longest lines we use in htest.py, or can we just allow them to 
wrap?

To select just a one or a few tests (like just Search, Replace, and Tree for 
the 2605.. patch), a drop down list box would be nice. It could be beside the 
next box. With a constant width, there would be room.

Doing the test reminded me that Search (find) and Replace have a severe bug on 
Windows of not highlighting the the found text while the box is still open. 
There was an issue where this was supposedly fixed, but it is not. Find is 
usable by closing the box and using cntl-G for find next. But this does not 
work for replace, making replace useless on windows unless one is really sure 
about replace all.

--

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



[issue21477] Idle: improve idle_test.htest

2014-05-27 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Ned, I recently saw that some of the builtin extensions call macosxsupport. I 
though then that it would be better if such calls were somehow handled 
automatically. I have no idea how and when to make them and so I don't know if 
the existing calls are needed or if other calls should be added. So I like your 
idea. It seems like it should be a separate issue.

--

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



[issue21468] NNTPLib connections become corrupt after long periods of activity

2014-05-27 Thread James Meneghello

James Meneghello added the comment:

Yeah, I didn't have a lot of time so I chose just to work around it. When I get 
a chance I'll have a better look.

Good point: I didn't think to try it with SSL off (SSL is enabled for all 
connections by default with this application). I'll test this and see if it 
still breaks.

I tested it with 3.2.5, 3.3.2, 3.4.0a (was the latest at the time) on Ubuntu 
64-bit. As said, didn't encounter the same problems with those versions on 
Windows 8 64-bit.

--

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



[issue16099] robotparser doesn't support request rate and crawl delay parameters

2014-05-27 Thread Nikolay Bogoychev

Nikolay Bogoychev added the comment:

Updated patch, all comments addressed, sorry for the 6 months delay. Please 
review

--
Added file: http://bugs.python.org/file35377/robotparser_v3.patch

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



[issue16446] pdb raises BdbQuit on 'quit' when started with set_trace

2014-05-27 Thread Richard Marko

Richard Marko added the comment:

Would be nice to have this commited as without this change

-if self.quitting:
-return # None
+if not self.botframe:
+self.botframe = frame

it's not possible to quit Bdb (and the code it's executing) as it just returns 
and doesn't raise BdbQuit.

--
nosy: +rmarko

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



[issue14776] Add SystemTap static markers

2014-05-27 Thread Bohuslav Slavek Kabrda

Bohuslav Slavek Kabrda added the comment:

@jcea: So here is my proposal for dealing with this: let's take what I 
currently have (e.g. tracepoints for function entry/function exit) and extend 
my patch to also work with DTrace in a similar fashion. Then, when we have a 
working patch for both Systemtap and DTrace, we can start adding more 
tracepoints as needed/as we see fit. Sounds good?

--

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



[issue14776] Add SystemTap static markers

2014-05-27 Thread Jesús Cea Avión

Jesús Cea Avión added the comment:

Could you possibly create a new issue and add me to its NOSY?

--

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



[issue21589] Use better idiom in unittest example

2014-05-27 Thread Claudiu.Popa

New submission from Claudiu.Popa:

Hello.

This patch proposes using `assertIn` in the first unittest example, instead of 
`assertTrue(x in seq)`. This is clearer and recommending it first is better for 
beginners.

--
assignee: docs@python
components: Documentation
files: unittest_better_idiom.patch
keywords: patch
messages: 219216
nosy: Claudiu.Popa, docs@python
priority: normal
severity: normal
status: open
title: Use better idiom in unittest example
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file35378/unittest_better_idiom.patch

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



[issue21589] Use better idiom in unittest example

2014-05-27 Thread Ezio Melotti

Ezio Melotti added the comment:

This is a duplicate of #11468.

--
nosy: +ezio.melotti, rhettinger
resolution:  - duplicate
stage:  - resolved
status: open - closed
superseder:  - Improve unittest basic example in the doc

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



[issue11468] Improve unittest basic example in the doc

2014-05-27 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
versions: +Python 3.5 -Python 3.3

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



[issue20689] socket.AddressFamily is absent in html pydoc

2014-05-27 Thread Vajrasky Kok

Vajrasky Kok added the comment:

I found the culprit. The AddressFamily is not registered in _socket module. I 
created a preliminary patch to show the culprit.

--
keywords: +patch
nosy: +vajrasky
Added file: http://bugs.python.org/file35379/pydoc_display_AddressFamily.patch

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



[issue21590] Systemtap and DTrace support

2014-05-27 Thread Bohuslav Slavek Kabrda

New submission from Bohuslav Slavek Kabrda:

This is a tracking bug for development of combined systemtap and dtrace patch 
for Python. The separate patches were submitted at [1] (systemtap) and [2] 
(dtrace).
Since it was agreed that it'd be best to merge the two patches to reuse as much 
code as possible between them, I'm opening this issue to track the progress and 
discuss possible improvements and suggestions.

[1] http://bugs.python.org/issue14776
[2] http://bugs.python.org/issue13405

--
components: Interpreter Core
messages: 219219
nosy: bkabrda, jcea
priority: normal
severity: normal
status: open
title: Systemtap and DTrace support
type: enhancement
versions: Python 3.5

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



[issue14776] Add SystemTap static markers

2014-05-27 Thread Bohuslav Slavek Kabrda

Bohuslav Slavek Kabrda added the comment:

I opened a bug for tracking progress of development of the combined dtrace and 
systemtap support: http://bugs.python.org/issue21590

--

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



[issue13405] Add DTrace probes

2014-05-27 Thread Bohuslav Slavek Kabrda

Bohuslav Slavek Kabrda added the comment:

I opened a bug for tracking progress of development of the combined dtrace and 
systemtap support: http://bugs.python.org/issue21590

--
nosy: +bkabrda

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



[issue21590] Systemtap and DTrace support

2014-05-27 Thread Jesús Cea Avión

Jesús Cea Avión added the comment:

Bohuslav, do you have Jabber/XMPP?. Mine is j...@jabber.org. This thing will 
require real time communication.

I rather prefer XMPP/Jabber, but I could accept IRC :-)

--

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



[issue20689] socket.AddressFamily is absent in html pydoc

2014-05-27 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy:  -berker.peksag

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



[issue21590] Systemtap and DTrace support

2014-05-27 Thread Dave Malcolm

Changes by Dave Malcolm dmalc...@redhat.com:


--
nosy: +dmalcolm

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



[issue21235] importlib's spec module create algorithm is not exposed

2014-05-27 Thread Brett Cannon

Brett Cannon added the comment:

I'm not torn so let that settle your torment. =) Considering we are talking 
about the standard library for a language that has a mantra of explicit is 
better than implicit I think worrying about an added line to very little code 
since so few people muck with this stuff is enough to not worry about it.

--

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



[issue20383] Add a keyword-only spec argument to types.ModuleType

2014-05-27 Thread Brett Cannon

Brett Cannon added the comment:

Why do you want a one-liner wrapper for the functions for the public API when 
they are exactly the same?

--

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



[issue21581] Consider dropping importlib.abc.Loader.create_module()

2014-05-27 Thread Brett Cannon

Brett Cannon added the comment:

This issue is not talking about dropping create_module() from the algorithm (I 
need it for the lazy loader), just from the ABC since it's a do-nothing 
implementation that doesn't have to be there.

Otherwise it should be made a required method and possibly even not have its 
``return None`` special-casing.

--

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



[issue20689] socket.AddressFamily is absent in html pydoc

2014-05-27 Thread STINNER Victor

STINNER Victor added the comment:

I found the culprit. The AddressFamily is not registered in _socket module. I 
created a preliminary patch to show the culprit.

That's not surprising, this type is created in socket (socket.py), not in 
_socket (the C module). Your patch is wrong.

--
nosy: +haypo

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



[issue21539] pathlib's Path.mkdir() should allow for mkdir -p functionality

2014-05-27 Thread Barry A. Warsaw

Changes by Barry A. Warsaw ba...@python.org:


--
nosy: +barry

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



[issue21539] pathlib's Path.mkdir() should allow for mkdir -p functionality

2014-05-27 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

I've just been writing some new code to use pathlib and ran into this one 
myself.  An exist_ok=False is fine, although it's a slight shame that for 
backward compatibility we can't adopt os.makedirs() signature exactly.

--

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



[issue18807] Allow venv to create copies, even when symlinks are supported

2014-05-27 Thread Dominic Cerquetti

Dominic Cerquetti added the comment:

Requesting re-open of this issue, using --closes to force no symlinks to be 
created still results in venv trying to create symlinks.

I'm using Python 3.4 with the following command inside a vagrant Ubuntu 14.04 
virtualbox image.  The folder is a SMB mount from a windows host, which does 
not allow symlinks.

Expected behavior: os.symlink() is never called when you run:
python3.4 -m venv --copies

Actual behavior: os.symlink() is still called in a few places such as:
http://hg.python.org/cpython/file/b8e4bb1e1090/Lib/venv/__init__.py
line: 147
line: 215

I have a fix for line 215 that I'm testing now (basically just need to call 
copier() instead of os.symlink()). 

I don't want to mess with line 147 due to it being OSX specific and I have no 
way to test it.  But in theory it should also just be a call to copier()

--
nosy: +Dominic.Cerquetti

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



[issue20383] Add a keyword-only spec argument to types.ModuleType

2014-05-27 Thread Eric Snow

Eric Snow added the comment:

You're right that it doesn't have to be a one-line wrapper or anything more 
than an import-from in importlib.util. :)

--

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



[issue21578] Misleading error message when ImportError called with invalid keyword args

2014-05-27 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the review, Eric. Here's a new patch.

--
Added file: http://bugs.python.org/file35381/issue21578_v2.diff

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



[issue16446] pdb raises BdbQuit on 'quit' when started with set_trace

2014-05-27 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Yes the patch does change the semantics of the quit command:

* no change when pdb is run as a script or with 'python -m pdb 
script_name'. As stated in the doc, the 'quit command': Quit from the 
debugger. The program being executed is aborted.

* but when a set_trace() breakpoint is inserted, 'quit' just terminates the 
debugger and the program continues its execution. It is the purpose of the 
patch to prevent an inconvenient crash with BdbQuit in that case. The idea is 
that the hard-coded breakpoint was set to investigate a local problem and one 
may want to let it run afterwards (for example to check its behavior after 
having changed some its internal state with pdb).

Sorry, I should have documented that behavior change.

--

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



[issue21439] Numerous minor issues in Language Reference

2014-05-27 Thread Zachary Ware

Zachary Ware added the comment:

A few comments on the committed patch.  The quoted diff is trimmed to just the 
hunks I have comments on.

On Tue, May 27, 2014 at 12:21 AM, raymond.hettinger 
python-check...@python.org wrote:
 diff --git a/Doc/reference/compound_stmts.rst 
 b/Doc/reference/compound_stmts.rst
 --- a/Doc/reference/compound_stmts.rst
 +++ b/Doc/reference/compound_stmts.rst
 @@ -170,17 +170,25 @@
  A :keyword:`break` statement executed in the first suite terminates the loop
  without executing the :keyword:`else` clause's suite.  A :keyword:`continue`
  statement executed in the first suite skips the rest of the suite and 
 continues
 -with the next item, or with the :keyword:`else` clause if there was no next
 +with the next item, or with the :keyword:`else` clause if there is no next
  item.

 -The suite may assign to the variable(s) in the target list; this does not 
 affect
 -the next item assigned to it.
 +The for-loop makes assignments to the variables(s) in the target list.
 +This overwrites all previous assignments to those variables including
 +those made in the suite of the for-loop::
 +
 +   for i in range(10):
 +   print(i)
 +   i = 5 # this will not affect the for-loop
 + # be i will be overwritten with the next

Typo here, looks like an unfinished thought. because rather than be?

 + # index in the range
 +

  .. index::
 builtin: range

  Names in the target list are not deleted when the loop is finished, but if 
 the
 -sequence is empty, it will not have been assigned to at all by the loop.  
 Hint:
 +sequence is empty, they will not have been assigned to at all by the loop.  
 Hint:
  the built-in function :func:`range` returns an iterator of integers suitable 
 to
  emulate the effect of Pascal's ``for i := a to b do``; e.g., 
 ``list(range(3))``
  returns the list ``[0, 1, 2]``.

 diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
 --- a/Doc/reference/expressions.rst
 +++ b/Doc/reference/expressions.rst
 @@ -520,11 +521,11 @@

  The primary must evaluate to an object of a type that supports attribute
  references, which most objects do.  This object is then asked to produce the
 -attribute whose name is the identifier (which can be customized by overriding
 -the :meth:`__getattr__` method).  If this attribute is not available, the
 -exception :exc:`AttributeError` is raised.  Otherwise, the type and value of 
 the
 -object produced is determined by the object.  Multiple evaluations of the 
 same
 -attribute reference may yield different objects.
 +attribute whose name is the identifier.  This production can be customized by
 +overriding the :meth:`__getattr__` method).  If this attribute is not 
 available,

Orphaned ')' on this line.

 +the exception :exc:`AttributeError` is raised.  Otherwise, the type and 
 value of
 +the object produced is determined by the object.  Multiple evaluations of the
 +same attribute reference may yield different objects.


  .. _subscriptions:
 @@ -1244,10 +1245,9 @@
 lambda_expr: lambda [`parameter_list`]: `expression`
 lambda_expr_nocond: lambda [`parameter_list`]: `expression_nocond`

 -Lambda expressions (sometimes called lambda forms) have the same syntactic 
 position as
 -expressions.  They are a shorthand to create anonymous functions; the 
 expression
 -``lambda arguments: expression`` yields a function object.  The unnamed 
 object
 -behaves like a function object defined with ::
 +Lambda expressions (sometimes called lambda forms) are create anonymous

Unfinished thought here; are create - are used to create?

 +functions. The expression ``lambda arguments: expression`` yields a function
 +object.  The unnamed object behaves like a function object defined with ::

While we're here, the object is in fact named, its name (__name__) is 
lambda.  It's not a valid identifier, but it is its name.


 def lambda(arguments):
 return expression
 @@ -1310,13 +1310,15 @@

  .. index:: pair: operator; precedence

 -The following table summarizes the operator precedences in Python, from 
 lowest
 +The following table summarizes the operator precedence in Python, from lowest

This sentence still doesn't read correctly to me; the simplest fix that makes 
sense to my brain is to remove the (... summarizes operator precedence 
...).  I would welcome any other better wording.

  precedence (least binding) to highest precedence (most binding).  Operators 
 in
  the same box have the same precedence.  Unless the syntax is explicitly 
 given,
  operators are binary.  Operators in the same box group left to right (except 
 for
 -comparisons, including tests, which all have the same precedence and chain 
 from
 -left to right --- see section :ref:`comparisons` --- and exponentiation, 
 which
 -groups from right to left).
 +exponentiation, which groups from right to left).
 +
 +Note that comparisons, membership tests, and identity tests, 

[issue20689] socket.AddressFamily is absent in html pydoc

2014-05-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ah, now I see what is wrong.

Actually AddressFamily is missing in text output of pydoc too. Because 
AddressFamily is not included in the __all__ list. SocketType is included, 
but this is different SocketType, SocketType from _socket (see issue20386).

Here is a patch which fixes this issue.

--
assignee:  - serhiy.storchaka
stage:  - patch review
versions: +Python 3.5
Added file: http://bugs.python.org/file35380/socket__all__.patch

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



[issue21439] Numerous minor issues in Language Reference

2014-05-27 Thread Zachary Ware

Changes by Zachary Ware zachary.w...@gmail.com:


--
stage: test needed - commit review

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



[issue20689] socket.AddressFamily is absent in pydoc output

2014-05-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
title: socket.AddressFamily is absent in html pydoc - socket.AddressFamily is 
absent in pydoc output

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



[issue20689] socket.AddressFamily is absent in pydoc output

2014-05-27 Thread STINNER Victor

STINNER Victor added the comment:

I suggested to not document new enums of the socket module (ex: AddressFamily, 
SocketType) when they were added. I don't think that they should be part of 
Python public API.

--

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



[issue20140] UnicodeDecodeError in ntpath.py when home dir contains non-ascii signs

2014-05-27 Thread honglei jiang

honglei jiang added the comment:

Python:canopy-1.3.0.1715.win-x86_64\
OS:Win8.1 64

directory
'F:\\Flask\\EmberJS\\\xd6\xd0\xce\xc4\\Prj\\static'
os.path.isdir(directory)
True
filename
u'todomvc/architecture-examples/angularjs/index.html'
os.path.join(directory,filename)
Traceback (most recent call last):
  File 
c:\Users\honglei\AppData\Local\Enthought\Canopy\User\Lib\site-packages\flask\helpers.py,
 line 1, in module
# -*- coding: utf-8 -*-
  File 
C:\Users\honglei\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.3.0.1715.win-x86_64\Lib\ntpath.py,
 line 108, in join
path += \\ + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd6 in position 17: 
ordinal not in range(128)

f=os.path.join(directory.decode(sys.getfilesystemencoding()),filename)
os.path.isfile(f)
True

--
nosy: +jhonglei

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



[issue11468] Improve unittest basic example in the doc

2014-05-27 Thread Zachary Ware

Changes by Zachary Ware zachary.w...@gmail.com:


--
nosy: +zach.ware

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



[issue18807] Allow venv to create copies, even when symlinks are supported

2014-05-27 Thread Vinay Sajip

Vinay Sajip added the comment:

While you may be right about line 215, line 147 isn't analogous, because in the 
latter case it's a symlink to a directory. We don't really want the entire lib 
directory tree *copied* into lib64 (and in any case, the populating of lib will 
happen much after venv creatuion, when things are installed into the venv: a 
copy is of no use here).

--

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



[issue17172] Add turtledemo to IDLE menu

2014-05-27 Thread Lita Cho

Lita Cho added the comment:

I am currently in the process of editing this patch such that the Turtle Demo 
launches from the Help Menu and spawns a separate process. 

However, I am deciding whether if the separate process should be asynchronous 
or not. Currently, I have it working with the subprocess module, but the IDLE 
window is hanging. 

I can use the multiprocess module or Popen to make it asynchronous. However, I 
am not sure where the clean-up should happen once the turtle process has been 
terminated.

--

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



[issue21539] pathlib's Path.mkdir() should allow for mkdir -p functionality

2014-05-27 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Le 27/05/2014 20:32, Barry A. Warsaw a écrit :

 I've just been writing some new code to use pathlib and ran into
 this
one myself. An exist_ok=False is fine, although it's a slight shame that
for backward compatibility we can't adopt os.makedirs() signature exactly.

What do you mean by that? The os.makedirs() signature is 
os.makedirs(name, mode=0o777, exist_ok=False)

--

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



[issue21539] pathlib's Path.mkdir() should allow for mkdir -p functionality

2014-05-27 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On May 27, 2014, at 08:48 PM, Antoine Pitrou wrote:

What do you mean by that? The os.makedirs() signature is 
os.makedirs(name, mode=0o777, exist_ok=False)

Right, but this is Path.mkdir's signature:

Path.mkdir(mode=0o777, parents=False)

so it's too late to make exist_ok=False the second argument (i.e. the one
after `mode`).  Oh well.

--

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



[issue21578] Misleading error message when ImportError called with invalid keyword args

2014-05-27 Thread Eric Snow

Eric Snow added the comment:

Looks good to me.  Thanks for doing this.  If no one objects in the meantime, 
I'll commit this in a few days.

--
assignee:  - eric.snow
stage: patch review - commit review

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



[issue18807] Allow venv to create copies, even when symlinks are supported

2014-05-27 Thread Dominic Cerquetti

Dominic Cerquetti added the comment:

Preliminary patch for line 215, per earlier description.

While this doesn't appear to break anything and creates both copies and 
symlinks correctly, I do have these four failing unit tests:

test_multiprocessing_fork 
test_multiprocessing_forkserver
test_multiprocessing_main_handling 
test_multiprocessing_spawn

I don't have time right now to look into it to see if they're related to my 
change (at first glance, it looks like not).

--
keywords: +patch
Added file: http://bugs.python.org/file35382/venv-symlink-fix.patch

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



[issue18807] Allow venv to create copies, even when symlinks are supported

2014-05-27 Thread Dominic Cerquetti

Dominic Cerquetti added the comment:

Ok cool, as you said line 215 then seems to be the only one that needs it.

--

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



[issue17172] Add turtledemo to IDLE menu

2014-05-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

 the IDLE window is hanging

Check to make sure it is actually hung.  The event-loop can make it look hung 
but it is actually just waiting for an event.  An IDLE restart suffices to kill 
it sometimes.

--

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



[issue11468] Improve unittest basic example in the doc

2014-05-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

FWIW, I'm going to test some other module (math or somesuch) rather than the 
built-in string methods.  The normal use of unittest is to import both the 
unittest module and the module under test.  I want to show that pattern (which 
is somewhat different from doctests where the tests are typically in the same 
file as the code being tested).

--

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



[issue17172] Add turtledemo to IDLE menu

2014-05-27 Thread Lita Cho

Lita Cho added the comment:

Okay, maybe hanging is not the right word. The IDLE window becomes busy since 
it spawned off the Turtle demo subprocess, and it is waiting for the subprocess 
to finish. After I close the Turtle window, it returns back to normal.

I was wondering if the Turtle Demo should be a separate asynchronous process so 
that users could use the IDLE window as well as the Turtle demo.

--

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



[issue18132] buttons in turtledemo disappear on small screens

2014-05-27 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
nosy: +terry.reedy

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



[issue17172] Add turtledemo to IDLE menu

2014-05-27 Thread Lita Cho

Lita Cho added the comment:

I currently have a patch where the Turtle Demo now shows up in the Help menu 
rather than in File menu.

I also have it such that Turtle is now launched as a separate process rather 
than within the IDLE process. Currently, the commend is calling ./python.exe so 
it uses my build of Python rather than my system's python. But I can change 
that once people agree this is the right way to go.

--
Added file: http://bugs.python.org/file35383/turtle_demo.patch

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



[issue3015] tkinter with wantobjects=False has been broken for some time

2014-05-27 Thread Lita Cho

Lita Cho added the comment:

Serhiy, does that mean this is fixed the way it is? Do I need to do anything 
else to close out this issue? It looks like wantobjects is set to False, 
currently.

--

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



[issue6639] turtle: _tkinter.TclError: invalid command name .10170160

2014-05-27 Thread Lita Cho

Lita Cho added the comment:

So I have a patch that fixes the original problem, but doesn't fix the crash 
with the tdemo_round_dance.py. However, I was wondering why 
TurtleScreen._RUNNING = True in the _destroy method. Can anyone shed some light 
on this? Here is the current state of my patch.

--
keywords: +patch
Added file: http://bugs.python.org/file35384/turtle_bug.patch

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



[issue21208] Change default behavior of arguments with type bool when options are specified

2014-05-27 Thread paul j3

paul j3 added the comment:

Last year someone asked on Stackoverflow about using 'type=bool'.  My answer is 
at:

http://stackoverflow.com/questions/15008758/parsing-boolean-values-with-argparse/19233287#19233287

'type' is supposed to be a function that takes a string, and converts to a 
desired Python object (e.g. number), and in the process validates it.

The builtin 'bool()' is not a good choice for this. 'bool()' returns False, 
all other strings return True, that includes strings like false, no, 
False.  If you want those strings to be interpreted as boolean False, you 
need to write your own 'str2bool' function.

But normally boolean values are entered via 'store_true' and 'store_false' 
actions.

--
nosy: +paul.j3

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



[issue21416] argparse should accept bytes arguments as originally passed

2014-05-27 Thread paul j3

paul j3 added the comment:

Two points to keep in mind:

'argparse' works with 'sys.argv[1:]'.  If that does not contain what you want, 
then you can pass your own 'argv' to 'parse_args'.

'type=bytes' means, call the builtin 'bytes' function with one of the argv 
strings. If 'bytes' does not handle the string as you want, then you need to 
write your own function.

--
nosy: +paul.j3

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



[issue21416] argparse should accept bytes arguments as originally passed

2014-05-27 Thread paul j3

paul j3 added the comment:

'invalid bytes value' is the error message generated by 'argparse'.  The 
underlying error (for a string like 'xxx') is:

print(bytes(sys.argv[1]))
TypeError: string argument without an encoding

You could use 'bytes' if you somehow supply the encoding, as in:

def mybytes(astr):
   return bytes(astr, 'utf-8')

--

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



[issue10523] argparse has problem parsing option files containing empty rows

2014-05-27 Thread paul j3

Changes by paul j3 ajipa...@gmail.com:


--
nosy: +paul.j3

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



[issue17172] Add turtledemo to IDLE menu

2014-05-27 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I think a patch should reuse the run module function that Idle already has. No 
need to re-invent something. I will say more tomorrow after sleeping.

--

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



[issue1683368] object.__init__ shouldn't allow args/kwds

2014-05-27 Thread Jason R. Coombs

Jason R. Coombs added the comment:

I recently ran into this error again. I was writing this class to provide 
backward-compatible context manager support for zipfile.ZipFile on Python 2.6 
and 3.1:

class ContextualZipFile(zipfile.ZipFile):

Supplement ZipFile class to support context manager for Python 2.6


def __enter__(self):
return self

def __exit__(self, type, value, traceback):
self.close()

def __new__(cls, *args, **kwargs):

Construct a ZipFile or ContextualZipFile as appropriate

if hasattr(zipfile.ZipFile, '__exit__'):
return zipfile.ZipFile(*args, **kwargs)
return super(ContextualZipFile, cls).__new__(cls, *args, **kwargs)


At the point where super is called, the author is unaware of the details of the 
function signature for zipfile.ZipFile.__new__, so simply passes the same 
arguments as were received by the derived class. However, this behavior raises 
a DeprecationWarning on Python 2.6 and 3.1 (and would raise an error on Python 
3.2 if the code allowed it).

What's surprising is that the one cannot simply override a constructor or 
initializer without knowing in advance which of those methods are implemented 
(and with what signature) on the parent class.

It seems like the construction (calling of __new__) is special-cased for 
classes that don't implement __new__.

What is the proper implementation of ContextualZipFile.__new__? Should it use 
super but omit the args and kwargs? Should it call object.__new__ directly? 
Should it check for the existence of __new__ on the parent class (or compare it 
to object.__new__)?

--

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



[issue20430] Make argparse.SUPPRESS work as an argument dest

2014-05-27 Thread paul j3

paul j3 added the comment:

If we make this change to '_StoreAction', we need to do it to 4 other 
subclasses which take the same 'setattr(namespace, self.dest, values)'.

An alternative would be to define a 'Namespace' function that does this 
conditional 'setattr'.

How should this 'SUPPRESS' affect the usage and help?  I'm seeing --foo 
==SUPPRESS==.

Do you have practical need for such a 'SUPPRESS', or are you just trying to 
make behavior consistent?  'SUPPRESS' is used for '--help' and subparsers 
because those Actions have important side effects, and we don't want default 
values to appear in the Namespace.  With '_StoreAction', the only effect is to 
store a value in the Namespace.

--
nosy: +paul.j3

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



  1   2   >