ANN: Urwid 0.9.9.2 - Console UI Library

2011-07-14 Thread Ian Ward
Announcing Urwid 0.9.9.2


Urwid home page:
  http://excess.org/urwid/

Screen shots:
  http://excess.org/urwid/examples.html

Tarball:
  http://excess.org/urwid/urwid-0.9.9.2.tar.gz


About this release:
===

This release is *not* the big, exciting,
wow-look-at-all-those-new-features release that just might be coming out
very soon.  It does, however fix a number of bugs in the previous release.


New in this release:


  * Fix for an Overlay get_cursor_coords(), and Text top-widget bug

  * Fix for a Padding rows() bug when used with width=PACK

  * Fix for a bug with large flow widgets used in an Overlay

  * Fix for a gpm_mev bug

  * Fix for Pile and GraphVScale when rendered with no contents

  * Fix for a Python 2.3 incompatibility (0.9.9 is the last release to
claim support Python 2.3)


About Urwid
===

Urwid is a console UI library for Python. It features fluid interface
resizing, Unicode support, multiple text layouts, simple attribute
markup, powerful scrolling list boxes and flexible interface design.

Urwid is released under the GNU LGPL.



-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


[TWISTED] Howto Deferred

2011-07-14 Thread marco
Hello gals and guys,

I'm an experienced Python user and I'd like to begin playing with
Twisted.
I started RTFM the tutorial advised on the official site and I found it
really useful and well done.

Now I'd like to practice a bit by coding a little program that reads
strings from a serial device and redirects them remotely via TCP. For
that sake I'm trying to use deferred.

In the tutorial, a deferred class is instantiated at factory level, then
used and destroyed.

And here things get harder for me.
Now, in my test program I need to manage data which comes in a random
manner, and I thought about doing it in a few possible ways:

1. create a deferred at factory level and every time I read something
from the serial port add some callbacks:

class SerToTcpProtocol(Protocol):

  def dataReceived(self, data):
# deferred is already instantiated and launched
# self.factory.sendToTcp sends data to the TCP client
self.factory.deferred.addCallback(self.factory.sendToTcp, data)

2. or, either, create a deferred at protocol level every time I receive
something, then let the deferred do what I need and destroy it:

class SerToTcpProtocol(Protocol):

  def dataReceived(self, data):
d = defer.Deferred()
d.addCallback(self.factory.sendToTcp, data)
d.callback(data)

3. or again, use a deferred list:

class SerToTcpProtocol(Protocol):

  def dataReceived(self, data):
d = defer.Deferred()
d.addCallback(self.factory.sendToTcp, data)
self.factory.listDeferred.addCallback(lambda d)
d.callback(data)

Or I don't know.. hints are welcome.

Thank you in advance and sorry for my english.

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


Re: [TWISTED] Howto Deferred

2011-07-14 Thread Chris Angelico
On Thu, Jul 14, 2011 at 5:07 PM, marco ma...@minasithil.org wrote:
 Now I'd like to practice a bit by coding a little program that reads
 strings from a serial device and redirects them remotely via TCP. For
 that sake I'm trying to use deferred.

The obvious solution (to my mind) is two threads, one for each
direction. On receipt of data, the thread immediately sends it on to
the other end. I'm not familiar with deferred; it might work easily,
or might need some fancy footwork to make it go.

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


Re: Functional style programming in python: what will you talk about if you have an hour on this topic?

2011-07-14 Thread Jonathan Hartley
On Jul 13, 1:39 pm, Anthony Kong anthony.hw.k...@gmail.com wrote:
 (My post did not appear in the mailing list, so this is my second try. 
 Apology if it ends up posted twice)

 Hi, all,

 If you have read my previous posts to the group, you probably have some idea 
 why I asked this question.

 I am giving a few presentations on python to my colleagues who are mainly 
 java developers and starting to pick up python at work.

 personal opinion
 So I have picked this topic for one of my presentation. It is because 
 functional programming technique is one of my favorite in my bag  of python 
 trick. It also takes me to the rabbit hole of the functional programming 
 world, which is vastly more interesting than the conventional procedural/OO 
 languages.
 /personal opinion

 I think I will go through the following items:

 itertools module
 functools module
 concept of currying ('partial')

 I would therefore want to ask your input e.g.

 Is there any good example to illustrate the concept?
 What is the most important features you think I should cover?
 What will happen if you overdo it?

 Cheers

I'd think you'd want to at least mention the relatively new
'lru_cache' decorator, for memoizing the return value expensive
functions, providing they are deterministic / pure, etc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Functional style programming in python: what will you talk about if you have an hour on this topic?

2011-07-14 Thread Jonathan Hartley
On Jul 14, 4:32 am, Gregory Ewing greg.ew...@canterbury.ac.nz wrote:
 Anthony Kong wrote:
  So I have picked this topic for one of my presentation. It is because
  functional programming technique is one of my favorite in my bag  of python 
  trick.

 I'm not sure it's a good idea to emphasise functional
 programming too much. Python doesn't really lend itself
 to a heavily functional style. While you *can* write
 Python code that way, it's not idiomatic, and you're
 likely to give beginners a distorted idea of how Python
 is normally written.

 --
 Greg

Maybe the talk would work well if not aimed at complete all-round
beginners, but instead aimed at Pythonistas who are interested in
functional programming, or functionistas who are py-curious (I think
the same talk would work well for both groups)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Functional style programming in python: what will you talk about if you have an hour on this topic?

2011-07-14 Thread Carl Banks
On Wednesday, July 13, 2011 5:39:16 AM UTC-7, Anthony Kong wrote:
[snip]
 I think I will go through the following items:
 
 itertools module
 functools module
 concept of currying ('partial')
 
 
 I would therefore want to ask your input e.g.
 
 Is there any good example to illustrate the concept? 
 What is the most important features you think I should cover?
 What will happen if you overdo it?

Java is easily worst language I know of for support of functional programming 
(unless they added delegates or some other tacked-on type like that), so my 
advice would be to keep it light, for two reasons:

1. It won't take a lot to impress them
2. Too much will make them roll their eyes

Thinking about it, one of the problems with demonstrating functional features 
is that it's not obvious how those features can simplify things.  To get the 
benefit, you have to take a step back and redo the approach somewhat.

Therefore, I'd recommend introducing these features as part of a demo on how a 
task in Python can be solved much more concisely than in Java.  It's kind of an 
art to find good examples, though.  Off the top of my head, I can think of 
using functools module to help with logging or to apply patches, whereas in 
Java they'd have to resort to a code weaver or lots of boilerplate.


Carl Banks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Howto Deferred

2011-07-14 Thread Jean-Paul Calderone
On Jul 14, 3:07 am, marco ma...@minasithil.org wrote:
 Hello gals and guys,

 I'm an experienced Python user and I'd like to begin playing with
 Twisted.
 I started RTFM the tutorial advised on the official site and I found it
 really useful and well done.

 Now I'd like to practice a bit by coding a little program that reads
 strings from a serial device and redirects them remotely via TCP. For
 that sake I'm trying to use deferred.


Deferreds probably aren't a good solution for this problem.  They're
useful
for one-time events, but you have an event that repeats over and over
again
with different data.

 In the tutorial, a deferred class is instantiated at factory level, then
 used and destroyed.

 And here things get harder for me.
 Now, in my test program I need to manage data which comes in a random
 manner, and I thought about doing it in a few possible ways:

 1. create a deferred at factory level and every time I read something
 from the serial port add some callbacks:

 class SerToTcpProtocol(Protocol):

   def dataReceived(self, data):
     # deferred is already instantiated and launched
     # self.factory.sendToTcp sends data to the TCP client
     self.factory.deferred.addCallback(self.factory.sendToTcp, data)


Or you could do self.factory.sendToTcp(data)

 2. or, either, create a deferred at protocol level every time I receive
 something, then let the deferred do what I need and destroy it:

 class SerToTcpProtocol(Protocol):

   def dataReceived(self, data):
     d = defer.Deferred()
     d.addCallback(self.factory.sendToTcp, data)
     d.callback(data)


Same here. :)

 3. or again, use a deferred list:

 class SerToTcpProtocol(Protocol):

   def dataReceived(self, data):
     d = defer.Deferred()
     d.addCallback(self.factory.sendToTcp, data)
     self.factory.listDeferred.addCallback(lambda d)
     d.callback(data)


I'm not sure what the listDeferred is there for.

Deferreds are a good abstraction for do one thing and then tell
me what the result was.  You have a different sort of thing here,
where there isn't much of a result (sending to tcp probably always
works until you lose your connection).  A method call works well
for that.

Jean-Paul
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: I don't know list, I not good at list.

2011-07-14 Thread Ellerbee, Edward
Thank you all for the advice, let me spin this in a different way.

I've built a program that goes to the NANPA website, scrapes area
code/exchange (npa/nxx) digits for a specified area - be it carolina,
alabama, texas, etc - drops it into a file, then massages the data and
prints out the correct format to insert into a voice router. The code is
ugly, but it works great.

The thing I haven't been able to get my script to do is to reduce the
amount of dial-peers. Hence the need to reduce the numbers to the least
common denominator, and put it in the x[xx] format.If we had a set
number of digits, we could build a dictionary(unless it's possible to do
that dynamically). 

So, a couple assertions:
1. the data will always be 6 digit numbers (in a string format)
2. the data is in a txt file after being put there from my script
3. the data will never be the same (I'm going to use this for site
conversions/new site builds
e.g. today I might be dealing with 252-, 919- and 704- area
codes, tomorrow might be 304- and 754-
4. I wanted a script to reduce the time taking to build the dial-peers
manually. I'd previously spent 3-4 hours
   on gathering and processing data. The script I have so far pulls data
and massages in about 6 seconds
5. I'm using python 2.7 - it seems like it had more module availability
than 3

And a couple question:
1. Would lists be the best way to handle this data? Would it be better
to process this data from a file?
2. Is there a way to determine the common (first-5 digits) denominator
among a list (or file) of data?
3. and... Could those common numbers be inserted in a dict for
processing?

Sorry for the book!

thanks

Edward Ellerbee


-Original Message-
From: python-list-bounces+eellerbee=bbandt@python.org
[mailto:python-list-bounces+eellerbee=bbandt@python.org] On Behalf
Of MRAB
Sent: Wednesday, July 13, 2011 5:59 PM
To: python-list@python.org
Subject: Re: I don't know list, I not good at list.


  I've been beating my head against the desk trying to figure out a  
method to accomplish this:
 
  Take a list (this example is 5 items, It could be 150 or more - i.e.
  it's variable length depending on the city/local calling zones)
The first 6 digits of phone numbers(NPA/NXX) in a local calling area.
  I want to concatenate the last digit for insertion into a call  
routing pattern.
 
  I tried this and failed miserably:
 
  list1=['252205','252246','252206','252247','252248']
  for item in list1:
  try:
  item1=list1[0]
  item2=list1[1]
  if item1[0:5] == item2[0:5]:
  print item1[0:5] + '[' + item1[5:6] + 
item2[5:6] + ']'
  list1.pop(0)
  else:
  print item1
  list1.pop(0)
  except:
  try:
  print item1
  list1.pop(0)
  except:
  pass
 
  #-
  My intent is to have the end data come out (from the example list  
above) in the format of   25220[56]   25224[678] I tried putting
together a variable inserted into a regular   expression, and it
doesn't seem to like:
  Item1=list1[0]
  Itemreg = re.compile(Item1[0:5])
  For stuff in itemreg.list1:
  #do something
 
  Can somebody throw me a bone, code example or module to read on  
python.org? I'm a n00b, so I'm still trying to understand functions  
and classes.
 
  I thought the experts on this list might take pity on my pathetic  
code skillz!
 
defaultdict comes in handy:

  list1 = ['252205','252246','252206','252247','252248']
  from collections import defaultdict   d = defaultdict(set)  
for item in list1:
d[item[ : 5]].add(item[5 : ])


  d
defaultdict(class 'set', {'25224': {'8', '7', '6'}, '25220': {'5',
'6'}})   for k, v in d.items():
print(k + [ + .join(v) + ])


25224[876]
25220[56]
--
http://mail.python.org/mailman/listinfo/python-list

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


PyDev 2.2.1 Released

2011-07-14 Thread Fabio Zadrozny
Hi All,

PyDev 2.2.1 has been released

Details on PyDev: http://pydev.org
Details on its development: http://pydev.blogspot.com

Release Highlights:
---

Quick-outline

 * Parent methods may be shown with a 2nd Ctrl+O.
 * The initial node is selected with the current location in the file.

Extract local refactoring

 * Option to replace duplicates.
 * Fixed issue where wrong grammar could be used.

Others

 * Improved handling of Ctrl+Shift+T so that no keybinding conflict
takes place (now it'll be only active on the PyDev views/editor).
 * PyLint markers always removed on a project clean.
 * If the standard library source files are not found, more options
are presented.
 * If the completion popup is focused and shift is pressed on a
context insensitive completion, a local import is done.
 * Fixed issue where a local import wasn't being added to the correct location.
 * Fixed error message in debugger when there was no caught/uncaught
exception set in an empty workspace.
 * Performance improvements on hierarchy view.
 * Django commands may be deleted on dialog with backspace.


What is PyDev?
---

PyDev is a plugin that enables users to use Eclipse for Python, Jython
and IronPython development -- making Eclipse a first class Python IDE
-- It comes with many goodies such as code completion, syntax
highlighting, syntax analysis, refactor, debug and many others.


Cheers,

-- 
Fabio Zadrozny
--
Software Developer

Appcelerator
http://appcelerator.com/

Aptana
http://aptana.com/

PyDev - Python Development Environment for Eclipse
http://pydev.org
http://pydev.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An interesting beginner question: why we need colon at all in the python language?

2011-07-14 Thread Grant Edwards
On 2011-07-13, Thorsten Kampe thors...@thorstenkampe.de wrote:
 * Grant Edwards (Wed, 13 Jul 2011 13:03:22 + (UTC))
 On 2011-07-13, Thorsten Kampe thors...@thorstenkampe.de wrote:
 
  and that that block is to be considered in relation to what was just
  said, before the colon.
 
  The indentation makes it abundantly clear to the human reader that
  that indented block is to be considered in relation to what was just
  said, before the indentation.

 You would think so, but human readers like redundancy.

 I also like redundancy (and consistency). That's why I'd much more 
 prefer a then than a colon which is easily overlooked while reading 
 /and/ while writing.

How is the then going to be consistent with other things that also
introduce blocks (def, try, with, etc.).

-- 
Grant Edwards   grant.b.edwardsYow! !  I'm in a very
  at   clever and adorable INSANE
  gmail.comASYLUM!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Suppressing newline writing to file after variable

2011-07-14 Thread Chris Angelico
On Fri, Jul 15, 2011 at 12:04 AM, Ellerbee, Edward eeller...@bbandt.com wrote:
 Hey Chris,

 I was reading over this again, trying to understand the logic (I'm a
 n00b)

 Could you explain this a bit? I'd like to build this emit function, but
 I still don't have a firm grasp on functions. All of my code is line by
 line. I'll convert it as a learn more.

I'm responding on-list as I believe others will wish to weigh in (if
only to point out some improvements to my code - it's hastily put
together). Caution, post is long.

Defining functions in Python is, broadly speaking, just a matter of
collecting up a bunch of statements and giving it a name. Compare:

if x5:
   do_this()
   do_that()
   etc()

with:

def abcde():
   do_this()
   do_that()
   etc()

The first one does the three statements, in order, if and only if the
condition is true. The second one gives a name to those three
statements, so you can use it as a new statement:

abcde()

It'll do the same three things, every time you call it. It's
effectively the same as putting the function's body in where you call
it (that's an extremely sloppy explanation, but near enough).

 So, I'd want this to go after the sort step, and before the format step.
 I can figure that piece out, just trying to get this little block of
 code to work.

Yes, that would be the place to put it.

Here's a reworked version that you can test in IDLE:


def combine(list_of_numbers, position):
 lastprefix=tails=lastsuffix=None
 result=[]
 for cur in list_of_numbers:
  prefix=cur[:position]; tail=cur[position]; suffix=cur[position+1:]
  if prefix!=lastprefix or suffix!=lastsuffix:
   if lastprefix!=None:
if len(tails)1: result.append(%s[%s]%s%(lastprefix,tails,lastsuffix))
else: result.append(lastprefix+tails+lastsuffix)
   lastprefix,tails,lastsuffix=prefix,,suffix
  tails+=tail
 if lastprefix!=None:
  if len(tails)1: result.append(%s[%s]%s%(lastprefix,tails,lastsuffix))
  else: result.append(lastprefix+tails+lastsuffix)
 return result

It incorporates some of the enhancements I mentioned in the original post.

 combine(['252205','252206','252208'],5)
['25220[568]']
 combine(['252205','252215','252225'],4)
['2522[012]5']

Notice that the 'emit' function is now 'result.append()' - it builds
up a list to return. You can now chain the calls; start with a list of
numbers and then call combine() in a loop.

# List of numbers from your previous post
numbers = ['252205', '252206', '252208', '252220', '252221', '25',
'252223', '919745', '919725', '919785', '704770', '704771', '704772',
'704773', '704774', '704775', '704776', '704777', '704778', '704779',
'704780', '704781', '704782', '704783', '704784', '704785', '704786',
'704787', '704788', '704789', '704790', '704791', '704792', '704793',
'704794', '704795', '704796', '704797', '704798', '704799']


numbers = combine(numbers,5)

numbers = combine(numbers,4)

numbers = combine(numbers,3)

numbers = combine(numbers,2)

numbers = combine(numbers,1)

numbers = combine(numbers,0)

If you do these statements one at a time in IDLE and inspect the
'numbers' list each time, you'll see the combinations sorting
themselves out. (With this starting list, only the first two will have
any effect.)

The last set of calls can be turned into a for loop:
for pos in range(5,-1,-1):
   numbers = combine(numbers,pos)

In fact, you could actually take it out of being a function, if you wanted to:

list_of_numbers = ['252205', '252206', '252208', '252220', '252221',
'25', '252223', '919745', '919725', '919785', '704770', '704771',
'704772', '704773', '704774', '704775', '704776', '704777', '704778',
'704779', '704780', '704781', '704782', '704783', '704784', '704785',
'704786', '704787', '704788', '704789', '704790', '704791', '704792',
'704793', '704794', '704795', '704796', '704797', '704798', '704799']

for position in range(5,-1,-1):
 lastprefix=tails=lastsuffix=None
 result=[]
 for cur in list_of_numbers:
  prefix=cur[:position]; tail=cur[position]; suffix=cur[position+1:]
  if prefix!=lastprefix or suffix!=lastsuffix:
   if lastprefix!=None:
if len(tails)1: result.append(%s[%s]%s%(lastprefix,tails,lastsuffix))
else: result.append(lastprefix+tails+lastsuffix)
   lastprefix,tails,lastsuffix=prefix,,suffix
  tails+=tail
 if lastprefix!=None:
  if len(tails)1: result.append(%s[%s]%s%(lastprefix,tails,lastsuffix))
  else: result.append(lastprefix+tails+lastsuffix)
 list_of_numbers = result

That's what the function definition does - it takes a block of code
and gives it a new name. (There's a lot more to it than that, thank
you pedants I know, but in this simple example that's what it's
doing.)

Hope that's of use!

Chris Angelico
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Suppressing newline writing to file after variable

2011-07-14 Thread Ellerbee, Edward
Holy cow, that's perfect!

Thanks so much :) 

Would it be alright if I post my code on the list for critiquing? I'm
learning python to supplement my voice engineering position - time
consuming tasks that can be automated will take less time.


Edward Ellerbee


-Original Message-
From: python-list-bounces+eellerbee=bbandt@python.org
[mailto:python-list-bounces+eellerbee=bbandt@python.org] On Behalf
Of Chris Angelico
Sent: Thursday, July 14, 2011 10:39 AM
To: python-list@python.org
Subject: Re: Suppressing newline writing to file after variable

On Fri, Jul 15, 2011 at 12:04 AM, Ellerbee, Edward
eeller...@bbandt.com wrote:
 Hey Chris,

 I was reading over this again, trying to understand the logic (I'm a
 n00b)

 Could you explain this a bit? I'd like to build this emit function, 
 but I still don't have a firm grasp on functions. All of my code is 
 line by line. I'll convert it as a learn more.

I'm responding on-list as I believe others will wish to weigh in (if
only to point out some improvements to my code - it's hastily put
together). Caution, post is long.

Defining functions in Python is, broadly speaking, just a matter of
collecting up a bunch of statements and giving it a name. Compare:

if x5:
   do_this()
   do_that()
   etc()

with:

def abcde():
   do_this()
   do_that()
   etc()

The first one does the three statements, in order, if and only if the
condition is true. The second one gives a name to those three
statements, so you can use it as a new statement:

abcde()

It'll do the same three things, every time you call it. It's effectively
the same as putting the function's body in where you call it (that's an
extremely sloppy explanation, but near enough).

 So, I'd want this to go after the sort step, and before the format
step.
 I can figure that piece out, just trying to get this little block of 
 code to work.

Yes, that would be the place to put it.

Here's a reworked version that you can test in IDLE:


def combine(list_of_numbers, position):
 lastprefix=tails=lastsuffix=None
 result=[]
 for cur in list_of_numbers:
  prefix=cur[:position]; tail=cur[position]; suffix=cur[position+1:]
  if prefix!=lastprefix or suffix!=lastsuffix:
   if lastprefix!=None:
if len(tails)1:
result.append(%s[%s]%s%(lastprefix,tails,lastsuffix))
else: result.append(lastprefix+tails+lastsuffix)
   lastprefix,tails,lastsuffix=prefix,,suffix
  tails+=tail
 if lastprefix!=None:
  if len(tails)1:
result.append(%s[%s]%s%(lastprefix,tails,lastsuffix))
  else: result.append(lastprefix+tails+lastsuffix)
 return result

It incorporates some of the enhancements I mentioned in the original
post.

 combine(['252205','252206','252208'],5)
['25220[568]']
 combine(['252205','252215','252225'],4)
['2522[012]5']

Notice that the 'emit' function is now 'result.append()' - it builds up
a list to return. You can now chain the calls; start with a list of
numbers and then call combine() in a loop.

# List of numbers from your previous post numbers = ['252205', '252206',
'252208', '252220', '252221', '25', '252223', '919745', '919725',
'919785', '704770', '704771', '704772', '704773', '704774', '704775',
'704776', '704777', '704778', '704779', '704780', '704781', '704782',
'704783', '704784', '704785', '704786', '704787', '704788', '704789',
'704790', '704791', '704792', '704793', '704794', '704795', '704796',
'704797', '704798', '704799']


numbers = combine(numbers,5)

numbers = combine(numbers,4)

numbers = combine(numbers,3)

numbers = combine(numbers,2)

numbers = combine(numbers,1)

numbers = combine(numbers,0)

If you do these statements one at a time in IDLE and inspect the
'numbers' list each time, you'll see the combinations sorting themselves
out. (With this starting list, only the first two will have any effect.)

The last set of calls can be turned into a for loop:
for pos in range(5,-1,-1):
   numbers = combine(numbers,pos)

In fact, you could actually take it out of being a function, if you
wanted to:

list_of_numbers = ['252205', '252206', '252208', '252220', '252221',
'25', '252223', '919745', '919725', '919785', '704770', '704771',
'704772', '704773', '704774', '704775', '704776', '704777', '704778',
'704779', '704780', '704781', '704782', '704783', '704784', '704785',
'704786', '704787', '704788', '704789', '704790', '704791', '704792',
'704793', '704794', '704795', '704796', '704797', '704798', '704799']

for position in range(5,-1,-1):
 lastprefix=tails=lastsuffix=None
 result=[]
 for cur in list_of_numbers:
  prefix=cur[:position]; tail=cur[position]; suffix=cur[position+1:]
  if prefix!=lastprefix or suffix!=lastsuffix:
   if lastprefix!=None:
if len(tails)1:
result.append(%s[%s]%s%(lastprefix,tails,lastsuffix))
else: result.append(lastprefix+tails+lastsuffix)
   lastprefix,tails,lastsuffix=prefix,,suffix
  tails+=tail
 if lastprefix!=None:
  if len(tails)1:
result.append(%s[%s]%s%(lastprefix,tails,lastsuffix))
  else: result.append(lastprefix+tails+lastsuffix)
 

Re: Suppressing newline writing to file after variable

2011-07-14 Thread Chris Angelico
On Fri, Jul 15, 2011 at 12:53 AM, Ellerbee, Edward eeller...@bbandt.com wrote:
 Holy cow, that's perfect!

 Thanks so much :)

 Would it be alright if I post my code on the list for critiquing? I'm
 learning python to supplement my voice engineering position - time
 consuming tasks that can be automated will take less time.

If it's not too long, sure! If it's more than can conveniently be
read, post it on one of those code-sharing places like
http://pastebin.com/ and post a link; then those who want to read it
can do so, and those who would rather avoid it have that option too.

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


String formatting - mysql insert

2011-07-14 Thread Christian
Hi,

I get some problem  when i like to set the table name dynamic.
I'm appreciate for any help.

Christian

### works 
newcur.execute (   INSERT INTO events (id1,id2)   VALUES  (%s,%s);
 , (rs[1],rs[2]))

### works not
newcur.execute (   INSERT INTO %s_events (id1,id2)   VALUES  (%s,
%s);  , (table_name,rs[1],rs[2]))

### works but is not really perfect: None from rs list result in
None instead of NULL.
newcur.execute (   INSERT INTO %s_events (id1,id2)   VALUES
('%s','%s');   %  (table_name,rs[1],rs[2]))
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An interesting beginner question: why we need colon at all in the python language?

2011-07-14 Thread Wanderer
On Jul 14, 10:34 am, Grant Edwards inva...@invalid.invalid wrote:
 On 2011-07-13, Thorsten Kampe thors...@thorstenkampe.de wrote:

  * Grant Edwards (Wed, 13 Jul 2011 13:03:22 + (UTC))
  On 2011-07-13, Thorsten Kampe thors...@thorstenkampe.de wrote:

   and that that block is to be considered in relation to what was just
   said, before the colon.

   The indentation makes it abundantly clear to the human reader that
   that indented block is to be considered in relation to what was just
   said, before the indentation.

  You would think so, but human readers like redundancy.

  I also like redundancy (and consistency). That's why I'd much more
  prefer a then than a colon which is easily overlooked while reading
  /and/ while writing.

 How is the then going to be consistent with other things that also
 introduce blocks (def, try, with, etc.).

 --
 Grant Edwards               grant.b.edwards        Yow! !  I'm in a very
                                   at               clever and adorable INSANE
                               gmail.com            ASYLUM!!

But if you have the colon, why do you need the brackets or backslashes
in an if statement.

Why not

if condition1 or
   condition2 or
   condition3:
do_something()

The statement ain't over til there's a colon.


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


Re: String formatting - mysql insert

2011-07-14 Thread Chris Angelico
On Fri, Jul 15, 2011 at 1:00 AM, Christian oz...@web.de wrote:
 Hi,

 I get some problem  when i like to set the table name dynamic.
 I'm appreciate for any help.

 ### works but is not really perfect: None from rs list result in
 None instead of NULL.
 newcur.execute (   INSERT INTO %s_events (id1,id2)   VALUES
 ('%s','%s');   %  (table_name,rs[1],rs[2]))

I'll start with the easy one. This one is wrong for several reasons;
firstly, it converts everything to strings (which is why a None comes
out as 'None'), but secondly and more seriously, it cannot handle
apostrophes or backslashes in your strings. SQL engines such as MySQL
need strings to be properly escaped, and the execute() function will
do that for you - but the % interpolation won't.

 ### works not
 newcur.execute (   INSERT INTO %s_events (id1,id2)   VALUES  (%s,
 %s);  , (table_name,rs[1],rs[2]))

What's happening here is that the table name is being sent in
apostrophes. Just as it puts quotes around your data, it also puts
quotes around the table name - which you don't want. You're getting
something like INSERT INTO 'foobar'_events, which MySQL doesn't like.

I recommend a hybrid:
newcur.execute (   INSERT INTO {0}_events (id1,id2)   VALUES
(%s,%s); .format(table_name), (,rs[1],rs[2]))

Note that I'm using the format() method rather than the % operator,
specifically because it uses a different notation - {0} - and will
leave the %s markers alone.

This assumes that your table name is clean. If it comes from your own
code, that's probably safe; but if it comes from user-supplied data,
you WILL need to sanitize it (I recommend whitelisting valid
characters eg letters and numbers, and keeping only those - and then
imposing a length limit too) before giving it to .execute().

As far as I know, MySQL doesn't have facilities for dynamic table
names, so your best bet is to make the SQL statement itself dynamic,
as per this example.

Hope that helps!

Chris Angelico
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: String formatting - mysql insert

2011-07-14 Thread Billy Mays

On 07/14/2011 11:00 AM, Christian wrote:

Hi,

I get some problem  when i like to set the table name dynamic.
I'm appreciate for any help.

Christian

### works 
newcur.execute (   INSERT INTO events (id1,id2)   VALUES  (%s,%s);
 , (rs[1],rs[2]))

### works not
newcur.execute (   INSERT INTO %s_events (id1,id2)   VALUES  (%s,
%s);  , (table_name,rs[1],rs[2]))

### works but is not really perfect: None from rs list result in
None instead of NULL.
newcur.execute (   INSERT INTO %s_events (id1,id2)   VALUES
('%s','%s');   %  (table_name,rs[1],rs[2]))


You shouldn't use The bottom form at all since that is how injection 
attacks occur.


The reason the second version doesn't work is because the the execute 
command escapes all of the arguments before replacing them.  Example:


sql = SELECT * FROM table WHERE col = %s;
cur.execute(sql, ('name',))
# The actual sql statement that gets executed is:
# SELECT * FROM table WHERE col = 'name';
# Notice the single quotes.

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


Re: How can I make a program automatically run once per day?

2011-07-14 Thread monkeys paw

On 7/9/2011 10:01 PM, John Salerno wrote:

Thanks everyone! I probably should have said something like Python,
if possible and efficient, otherwise any other method ! :)

I'll look into the Task Scheduler. Thanks again!


You could use the below code. time.sleep(# seconds in a day)
where i == 30 would run once a day for a month

import time
i=0
while (1):
print 'hello'
time.sleep(2)   # Change this to number of seconds in a day
if (i == 3):# make this 30 for a month
break
i = i + 1


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


Re: How can I make a program automatically run once per day?

2011-07-14 Thread Ian Kelly
On Thu, Jul 14, 2011 at 11:00 AM, monkeys paw mon...@joemoney.net wrote:
 You could use the below code. time.sleep(# seconds in a day)
 where i == 30 would run once a day for a month

 import time
 i=0
 while (1):
        print 'hello'
        time.sleep(2)   # Change this to number of seconds in a day
        if (i == 3):    # make this 30 for a month
                break
        i = i + 1

If the system ever gets rebooted during that month, then you would
need to remember to manually restart the script.  Or if the effective
part of the script raises an exception, it could crash the whole
script without some defensive coding.  That's why it's better just to
use the system scheduler service.
-- 
http://mail.python.org/mailman/listinfo/python-list


json decode issue

2011-07-14 Thread Miki Tebeka
Greetings,

I'm trying to decode JSON output of a Java program (jackson) and having some 
issues.
The cause of the problem is the following snippet:
{
description: ... lives\uMOVE™ OFFERS ,
}
Which causes ValueError: Invalid \u escape.

Any ideas on how to fix this?

Thanks,
--
Miki
-- 
http://mail.python.org/mailman/listinfo/python-list


Please critique my script

2011-07-14 Thread Ellerbee, Edward
I've been working on this for 3 weeks as a project while I'm learning
python. It's ugly, only function in there is from a fellow lister, but
it works perfectly and does what it is intended to do.

I'd love to hear comments on how I could improve this code, what would
be good to turn into a function/class etc.

# The function of this script is to gather user data from the user to
# build appropriate local dial-peers in a cisco voice gateway.
# Data gathered from the user:
# name of file to write dial-peers to
# NPA
# NXX
# outbound port to send calls
# question if home npa local calls are 7 digit
# script navigates to nanpa.com, gathers the local calling area
# and returns the data
# the data is converted to beautiful soup (I had a problem with the xml
format)
# the data is parsed for the proper NPA/NXXs
# list is sorted, duplicates removed
# data from list is formatted and printed to the file specified


#Import dependencies---
import urllib2
from BeautifulSoup import BeautifulSoup
import re

#Define variables
count = 0
count2 = 0
count3 = 0
npalist = []
nxxlist = []
sortlist = []
sortedlist = []
npaReg = re.compile('(?=npa)(...)(?=/npa)')
nxxReg = re.compile('(?=nxx)(...)(?=/nxx)')
proxy = urllib2.ProxyHandler({'http': 'proxy.com:8080'})
# --actual proxy was removed for confidentiality--
opener = urllib2.build_opener(proxy)

#- function to concatenate numbers - thanks to Chris Angelico -
def combine(list_of_numbers, position):
lastprefix=tails=lastsuffix=None
result=[]
for cur in list_of_numbers:
prefix=cur[:position]; tail=cur[position];
suffix=cur[position+1:]
if prefix!=lastprefix or suffix!=lastsuffix:
if lastprefix!=None:
if len(tails)1:
result.append(%s[%s]%s%(lastprefix,tails,lastsuffix))
else: result.append(lastprefix+tails+lastsuffix)
lastprefix,tails,lastsuffix=prefix,,suffix
tails+=tail
if lastprefix!=None:
if len(tails)1:
result.append(%s[%s]%s%(lastprefix,tails,lastsuffix))
else: result.append(lastprefix+tails+lastsuffix)
return result


#---Gather info from user
x = raw_input(please enter a filename: )
y = raw_input(please enter the npa: )
z = raw_input(please enter the nxx: )
p = raw_input(please enter the port: )
q = raw_input(Is home npa local dialing 7 digit?(y/n) )
#print x

#---Modify user data-
o = open(x, 'w')
y = str(y)
z = str(z)
p = str(p)
pagedef = (http://www.localcallingguide.com/xmllocalprefix.php?npa=; +
y + nxx= + z)
print Querying, pagedef

#--Get info from NANPA.com --
urllib2.install_opener(opener)
page = urllib2.urlopen(pagedef)
soup = BeautifulSoup(page)
soup = str(soup)

#--Parse Gathered Data--
for line in npaReg.findall(soup):
npalist.insert(count,line)
count = count + 1

for line2 in nxxReg.findall(soup):
nxxlist.insert(count2,line2)
count2 = count2 + 1

#-Sort, remove duplicates, concatenate the last digits for similiar
NPA/NXX --
for makenewlist in range(0,count):
sortlist.append(npalist.pop(0) + nxxlist.pop(0))

sortlist.sort()

for sortednumber in sortlist:
if sortednumber not in sortedlist:
sortedlist.append(sortednumber)

catlist = combine(sortedlist,5)
catlist2 = combine(catlist,4)

#--Print the dial-peers to file
for line in catlist2:
figureDpn = count3 + 1000
dpn = str(figureDpn)
label = dial-peer voice  + dpn
o.write(label)
o.write('\n')
o.write(description *** local outbound dialpeer ***)
o.write('\n')
destpatt = destination-pattern %s % line.rstrip()
o.write(destpatt)
o.write('\n')
port = port  + p
o.write(port)
o.write('\n')
if line[0:3] == y and q == y:
o.write(forward-digits 7)
o.write('\n')
o.write('\n')
count3 = count3 + 1

o.close()

#---

Thanks!

Edward Ellerbee



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


Re: String formatting - mysql insert

2011-07-14 Thread Christian
On 14 Jul., 17:31, Billy Mays no...@nohow.com wrote:
 On 07/14/2011 11:00 AM, Christian wrote:









  Hi,

  I get some problem  when i like to set the table name dynamic.
  I'm appreciate for any help.

  Christian

  ### works 
  newcur.execute (   INSERT INTO events (id1,id2)   VALUES  (%s,%s);
   , (rs[1],rs[2]))

  ### works not
  newcur.execute (   INSERT INTO %s_events (id1,id2)   VALUES  (%s,
  %s);  , (table_name,rs[1],rs[2]))

  ### works but is not really perfect: None from rs list result in
  None instead of NULL.
  newcur.execute (   INSERT INTO %s_events (id1,id2)   VALUES
  ('%s','%s');   %  (table_name,rs[1],rs[2]))

 You shouldn't use The bottom form at all since that is how injection
 attacks occur.

 The reason the second version doesn't work is because the the execute
 command escapes all of the arguments before replacing them.  Example:

 sql = SELECT * FROM table WHERE col = %s;
 cur.execute(sql, ('name',))
 # The actual sql statement that gets executed is:
 # SELECT * FROM table WHERE col = 'name';
 # Notice the single quotes.

 --
 Bill

thanks you guys!
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Please critique my script

2011-07-14 Thread Gerald Britton
For me, there are some things I don't like much.  One-character
variable names stand out (tend to make the code hard to read).
Violation of PEP 8 guidelines, especially wrt spacing.  e.g.

result.append(%s[%s]%s % (lastprefix, tails, lastsuffix))

not

result.append(%s[%s]%s%(lastprefix,tails,lastsuffix))

Similarly for many of the assignments and expressions.

I see that you initialize count3 at line 39 but don't use it until
line 123.  I'd suggest that you move the initialization closer to its
use.

I think that you should move the call to open closer to where you're
going to write to the file.  In fact, you can do the thing a bit
neater with a context manager like this:

#--Print the dial-peers to file
with open(x, 'w') as o:
for line in catlist2:
figureDpn = count3 + 1000
dpn = str(figureDpn)
label = dial-peer voice  + dpn
o.write(label)
o.write('\n')

...

Note that if you use this approach you don't need a separate call to close().

Also, you can do all the writing in one call to write(), something like this:

o.write(
label + '\n' +
description *** local outbound dialpeer *** + '\n' +
destpatt + '\n' +
port  + p + '\n'
forward-digits 7 if line[0:3] == y and q == y else 
'\n'
)

Which keeps the eye focused on the data being written (at least for me).

-- 
Gerald Britton
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Please critique my script

2011-07-14 Thread MRAB

[snip]
raw_input() returns a string, so there's no need for these 3 lines:

 y = str(y)
 z = str(z)
 p = str(p)

 pagedef = (http://www.localcallingguide.com/xmllocalprefix.php?npa=; 
+ y + nxx= + z)

 print Querying, pagedef

 #--Get info from NANPA.com --
 urllib2.install_opener(opener)
 page = urllib2.urlopen(pagedef)
 soup = BeautifulSoup(page)
 soup = str(soup)

 #--Parse Gathered Data--
 for line in npaReg.findall(soup):
 npalist.insert(count, line)
 count = count + 1

 for line2 in nxxReg.findall(soup):
 nxxlist.insert(count2, line2)
 count2 = count2 + 1

enumerate will help you here:

for count, line in enumerate(npaReg.findall(soup)):
npalist.insert(count, line)

for count2, line2 in enumerate(nxxReg.findall(soup)):
nxxlist.insert(count2, line2)

 #-Sort, remove duplicates, concatenate the last digits for 
similiar NPA/NXX --

 for makenewlist in range(0, count):
 sortlist.append(npalist.pop(0) + nxxlist.pop(0))

 sortlist.sort()

 for sortednumber in sortlist:
 if sortednumber not in sortedlist:
 sortedlist.append(sortednumber)

If you're going to sort them anyway (so you don't need to preserve the 
existing order), the easiest way to remove duplicates is to use a set:


sortedlist = sorted(set(sortlist))

[snip]
--
http://mail.python.org/mailman/listinfo/python-list


Re: json decode issue

2011-07-14 Thread MRAB

On 14/07/2011 18:22, Miki Tebeka wrote:

Greetings,

I'm trying to decode JSON output of a Java program (jackson) and having some 
issues.
The cause of the problem is the following snippet:
 {
 description: ... lives\uMOVE™ OFFERS ,
 }
Which causes ValueError: Invalid \u escape.

Any ideas on how to fix this?


Is that valid JSON? If not, you'll either need to fix the program which
generated it (or report it as a bug), or pre-process the JSON to
correct the error, if you know what it should be.
--
http://mail.python.org/mailman/listinfo/python-list


Possible File iteration bug

2011-07-14 Thread Billy Mays
I noticed that if a file is being continuously written to, the file 
generator does not notice it:




def getLines(f):
lines = []
for line in f:
lines.append(line)
return lines

with open('/var/log/syslog', 'rb') as f:
lines = getLines(f)
# do some processing with lines
# /var/log/syslog gets updated in the mean time

# always returns an empty list, even though f has more data
lines = getLines(f)




I found a workaround by adding f.seek(0,1) directly before the last 
getLines() call, but is this the expected behavior?  Calling f.tell() 
right after the first getLines() call shows that it isn't reset back to 
0.  Is this correct or a bug?


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


Re: Possible File iteration bug

2011-07-14 Thread Ian Kelly
On Thu, Jul 14, 2011 at 1:46 PM, Billy Mays no...@nohow.com wrote:
 def getLines(f):
    lines = []
    for line in f:
        lines.append(line)
    return lines

 with open('/var/log/syslog', 'rb') as f:
    lines = getLines(f)
    # do some processing with lines
    # /var/log/syslog gets updated in the mean time

    # always returns an empty list, even though f has more data
    lines = getLines(f)




 I found a workaround by adding f.seek(0,1) directly before the last
 getLines() call, but is this the expected behavior?  Calling f.tell() right
 after the first getLines() call shows that it isn't reset back to 0.  Is
 this correct or a bug?

This is expected.  Part of the iterator protocol is that once an
iterator raises StopIteration, it should continue to raise
StopIteration on subsequent next() calls.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: json decode issue

2011-07-14 Thread Terry Reedy

On 7/14/2011 3:20 PM, MRAB wrote:

On 14/07/2011 18:22, Miki Tebeka wrote:

Greetings,

I'm trying to decode JSON output of a Java program (jackson) and
having some issues.
The cause of the problem is the following snippet:
{
description: ... lives\uMOVE™ OFFERS ,
}
Which causes ValueError: Invalid \u escape.

Any ideas on how to fix this?


Is that valid JSON? If not, you'll either need to fix the program which
generated it (or report it as a bug), or pre-process the JSON to
correct the error, if you know what it should be.


If you delete or double the backslash in that one particular spot, the 
string will parse, even if it is not correct.


--
Terry Jan Reedy


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


Re: Possible File iteration bug

2011-07-14 Thread Billy Mays

On 07/14/2011 04:00 PM, Ian Kelly wrote:

On Thu, Jul 14, 2011 at 1:46 PM, Billy Maysno...@nohow.com  wrote:

def getLines(f):
lines = []
for line in f:
lines.append(line)
return lines

with open('/var/log/syslog', 'rb') as f:
lines = getLines(f)
# do some processing with lines
# /var/log/syslog gets updated in the mean time

# always returns an empty list, even though f has more data
lines = getLines(f)




I found a workaround by adding f.seek(0,1) directly before the last
getLines() call, but is this the expected behavior?  Calling f.tell() right
after the first getLines() call shows that it isn't reset back to 0.  Is
this correct or a bug?


This is expected.  Part of the iterator protocol is that once an
iterator raises StopIteration, it should continue to raise
StopIteration on subsequent next() calls.


Is there any way to just create a new generator that clears its `closed` 
status?


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


Re: Possible File iteration bug

2011-07-14 Thread Terry Reedy

On 7/14/2011 3:46 PM, Billy Mays wrote:

I noticed that if a file is being continuously written to, the file
generator does not notice it:


Because it does not look, as Ian explained.


def getLines(f):
lines = []
for line in f:
lines.append(line)
return lines


This nearly duplicates .readlines, except for using f an an iterator.
Try the following (untested):

with open('/var/log/syslog', 'rb') as f:
  lines = f.readlines()
  # do some processing with lines
  # /var/log/syslog gets updated in the mean time
  lines = f.readlines()

People regularly do things like this with readline, so it is possible. 
If above does not work, try (untested):


def getlines(f):
  lines = []
  while True:
l = f.readline()
if l: lines.append(l)
else: return lines

--
Terry Jan Reedy

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


Re: Possible File iteration bug

2011-07-14 Thread Hrvoje Niksic
Billy Mays no...@nohow.com writes:

 Is there any way to just create a new generator that clears its
 closed` status?

You can define getLines in terms of the readline file method, which does
return new data when it is available.

def getLines(f):
lines = []
while True:
line = f.readline()
if line == '':
break
lines.append(line)
return lines

or, more succinctly:

def getLines(f):
return list(iter(f.readline, ''))
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Please critique my script

2011-07-14 Thread Peter Otten
MRAB wrote:

 for line2 in nxxReg.findall(soup):
 nxxlist.insert(count2, line2)
 count2 = count2 + 1

 enumerate will help you here:

 for count2, line2 in enumerate(nxxReg.findall(soup)):
 nxxlist.insert(count2, line2)
 
An insert() at the end of a list is usually spelt append() in Python ;)
If you are looking for something less baroque

nxxlist = nxxReg.findall(soup)

will do, too.

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


Re: PyCon Australia 2011: Schedule Announced

2011-07-14 Thread Laura Creighton

Hi Ryan.

Best of luck with the conference.

Thanks also to Linux Australia, who provide the overarching legal and
organisational structure for PyCon Australia.

I want to talk to somebody from Linux Australia about this overarching legal 
and organisational structure.
Do you have an email address of whom I should talk to?  I think the structure 
that we have here
in Europe could stand some refactoring, and I was talking with Stephen Thorne 
at Europython
and what Linux Australia is doing looks very neat to me.

There is nothing urgent about this, and in no way should this distract you from 
your conference,
but sometime I would like to have an email.

Thanks very much,
Laura Creighton


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


Python threading/multiprocessing issue.

2011-07-14 Thread Brandon Harris

I'm working on a tool that runs a number of process is separate thread.
I've, up to this point, been using threading.Thread, but from what I
read multiprocess will allow multiple processors to be used
From the python docs on multiprocessing.
Due to this, the multiprocessing module allows the programmer to fully
   leverage multiple processors on a given machine.

I have run into an issue when modifying the thread object from the run
method. Threading.thread allows me to change an attribute in the run 
method and it hold while multiprocessing.Process loses it.


Here is an example illustrating the inconsistency that I've seen.

--
|
import time
import multiprocessing
import threading

def simple_process_call():
my_process = SimpleProcess()
my_process.start()
while not my_process.done.is_set():
pass

print my_process.my_attribute

class SimpleProcess(multiprocessing.Process):
def __init__(self):
super(SimpleProcess, self).__init__()
self.my_attribute = 'Fail'
self.done = multiprocessing.Event()

def run(self):
self.my_attribute = 'Success'
time.sleep(5)
self.done.set()

def simple_thread_call():
my_thread = SimpleThread()
my_thread.start()
while not my_thread.done.is_set():
pass

print my_thread.my_attribute

class SimpleThread(threading.Thread):
def __init__(self):
super(SimpleThread, self).__init__()
self.my_attribute = 'Fail'
self.done = threading.Event()

def run(self):
self.my_attribute = 'Success'
time.sleep(5)
self.done.set()

if __name__ == '__main__':
# simple_process_call()
simple_thread_call()|


--

The odd thing is that I can modify the multiprocessing.Event and it 
holds, but modifying any attribute on the class goes away.


If I am super ignorant of something, please cure me of it.

Thanks in advance!



Brandon L. Harris

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


Multiplicity and Asininity in Tkinter Event API

2011-07-14 Thread rantingrick


# Multiplicity and Asininity in Tkinter Event API! #


The problems with Tkinter events are two fold:


Problem 1: Number Of Sequences Is Obscene.

The sheer number of exposed sequences and possible user combinations
of sequences is overkill. You should never put the design of an API in
the hands of users of said API. Designing rock solid API's is about
giving users as much power as possible WITHOUT giving them too many
choices. Unfortunately, not only did the authors of Tkinter give
people choices, they gave them the power to create NEW choices...
CRIKEY!


Problem 2. No Uniform Naming Convention.

The sequence names follow an intuitive naming convention. Not only
that, but alias's exists for some of the combinations. Here are some
examples...

 Button-1
  1
 ButtonRelease-1
 B1-Motion
 KeyPress
 KeyRelease
 KeyPress-a | a
 Contol-KeyPress-a
  callback event inspection


 Examples Of Possible Sequence Combinations


Bindings for a single letter:
 KeyPress
 KeyPress-a
  a
 Control-KeyPress-a
  Control-a
 Control-Shift-KeyPress-a
  Control-Shift-a
 Alt-Shift-Control-KeyPress-a
  Alt-Shift-Control-a
 etc...

Bindings for Mice:
 Button
 Button-1
  1
 B1-Motion
 ButtonRelease-1
 etc...

This is only for one keypres and one button down event and this does
not EVEN include combinations of mice and key. Completely ridiculous!

As you can see this is far too many sequences for even a guru to
remember; and why should he? Why should he clog up his code with
handler after handler when only a handful are needed?


 SOLUTION:

I can tell you first hand that out of all these thousands of sequences
we only need six to cover user inputs. YES, you heard me correctly.
SIX!

Here are the six i propose:

 KeyPress
 KeyRelease
 MouseClick
 MouseMotion
 MouseRelease
 MouseWheel

That's it. Go ahead, try to prove me wrong!


 Potential Naysayer's Arguments:


Argument_1:
Wah! But i don't like to have to process possible all
three (or more) mouse buttons in the same event
handler.. Wah, Wah!

Rebuttual_1:
No problemo amigo, just dispatch those specific button
events to specific handlers. Here kiddo, watch this...

def onMouseClick(num, pos, rootpos):
if num == 1:
self.onButtonOneClick(num, pos, rootpos)
if num == 2:
self.onButtonOneClick(num, pos, rootpos)
etc...
etc...


 Conclusion:

It's time to start cleaning up this library. All you @-holes fought me
long ago about how GREAT Tkinter is. I don't think Tkinter is great
however i do believe it has great potential.

Now it the time to put up or shut up. I AM willing to put forth the
effort. I have documented the deficiencies, and i have cleaned up
code. I have offered up more intuitive API interfaces. NOW it's high
time for the dev's to come forward.

  http://www.youtube.com/watch?v=XzcWwmwChVE
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Please critique my script

2011-07-14 Thread MRAB

On 14/07/2011 21:53, Peter Otten wrote:

MRAB wrote:


for line2 in nxxReg.findall(soup):
 nxxlist.insert(count2, line2)
 count2 = count2 + 1


enumerate will help you here:



for count2, line2 in enumerate(nxxReg.findall(soup)):
 nxxlist.insert(count2, line2)


An insert() at the end of a list is usually spelt append() in Python ;)
If you are looking for something less baroque

nxxlist = nxxReg.findall(soup)

will do, too.


That's true... :-)
--
http://mail.python.org/mailman/listinfo/python-list


Proposal to extend PEP 257 (New Documentation String Spec)

2011-07-14 Thread rantingrick

Hello Folks,

Lately i have been musing over the ideas of method tagging.
Specifically i am referring to method identifiers. As most of you know
i had proposed to add syntactical markers to the language to deal
with the ambiguities that arise whist eyeball parsing sub classed
methods that clobber virtual methods. HOWEVER that idea caused some
fierce controversy within the community, and i can partly understand
why.

Although i strongly believe in proper documentation (even to the point
of forcing syntax on folks) i understand that we cannot implement such
a thing without major growing pains. So with that being said, i have
formulated a new battle plan to defeat this problem of ambiguity.

Unlike most languages out there we have doc-strings; and do we realize
how great this gift is? Sometimes i wonder because you folks should
really be using them like they are going out of style!

As we all know PEP 257 lays out some ground rules for documentation
strings HOWEVER i feel this PEP did no go far enough. Too many folks
are refusing to document properly and so i will take this time to
hammer out a spec. I would like to comments for or against.

---
 New Syntax Specification For Documentation Strings
---

 {DOC TAG HERE}: {MODULE_NAME|SHORT_SUMMARY_HERE}.
{NEWLINE}
{LONG_DESCRIPTION_HERE}
{NEWLINE}
Arguments: (if applicable)
{ARGUMNET_1} {TYPE}:
ARGUMENT_1_DESCRIPTION}
{ARGUMNET_2} {TYPE}:
ARGUMENT_2 DESCRIPTION}
{ARGUMNET_N} {TYPE}:
ARGUMENT_N_DESCRIPTION}
{NEWLINE}


As you can see my spec introduces some new ideas to writing doc-
strings. Specifically the DOC TAG and {ARG TYPES} are new. Also i've
found it much more useful to separate args and their respective
descriptions with a newline and indention.

---
 Example: Module Documentation String.
---

Module simpledialog.py:

This module handles Tkinter dialog boxes.
It contains the following public symbols:

Dialog class:
A base class for dialogs.

askinteger function:
Get an integer from the user.

askfloat function:
Get a float from the user.

askstring function:
Get a string from the user.



I don't know how i feel about marking classes and functions since IF
we follow the python style guide we don;t need to; but that's IF we
FOLLOW it people, IF.

---
 Example: Func/Meth Documentation String.
---

def askinteger(parent, title, prompt, **kw):
 Interface: Get an integer from the user.

Return value is an integer.

Arguments:
title string:
the dialog title
prompt string|integer|float:
the label text
**kw:
see SimpleDialog class


---
 Example: Class Inheritance Documentation Strings.
---

class Base():
def __init__(self):
 Internal:
self.m1()

def m1(self, *args):
Overide: 
pass

class Derived(Base):
def __init__(self):
Base.__init__(self)

def _m1(self):
 Internal: blah

def m1(self):
 Clobbered: see Base for detail

def m3(self):
 Interface: Blah

---
 Tags For Documentation Strings
---

 Module:
The module tag is to be used for module doc strings.

 Virtual:
The virtual tag is for methods residing in a base class
that are created specifically to be overridden. Of course as we
all know every Python methods/function is virtual by default
however the point of this is to make the code more readable!

 Override:
This tag should be placed in a derived class's method which has
clobbered a base method. Typically you can just defer the reader
to look up the base class for more info.

 Internal:
This tag should be used on all internal methods (psst: the ones
that
start with a single underscore *ahem* or SHOULD start with a
single
underscore!).

 Interface:
This tag is be used for interface method/function doc strings.
This
is probably the most important tag. If you don't do any tagging AT
LEAST tag the interface methods and functions. However i must
remind you that all these tags are very important.

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


Re: Proposal to extend PEP 257 (New Documentation String Spec)

2011-07-14 Thread Ben Finney
rantingrick rantingr...@gmail.com writes:

 ---
  New Syntax Specification For Documentation Strings
 ---

  {DOC TAG HERE}: {MODULE_NAME|SHORT_SUMMARY_HERE}.
 {NEWLINE}
 {LONG_DESCRIPTION_HERE}
 {NEWLINE}
 Arguments: (if applicable)
 {ARGUMNET_1} {TYPE}:
 ARGUMENT_1_DESCRIPTION}
 {ARGUMNET_2} {TYPE}:
 ARGUMENT_2 DESCRIPTION}
 {ARGUMNET_N} {TYPE}:
 ARGUMENT_N_DESCRIPTION}
 {NEWLINE}
 

I use reStructuredText formatting in my PEP 257 docstrings:

def frobnicate(spong, mode=wibble):
 Frobnicate the spong.

:param spong: The SpongDrabble instance to be frobnicated.
:param mode: Specific frobnication mode to use. Valid modes
are wibble, wobble, warble.
:return: The blagule from the frobnication.

Note that the Weebly-Ruckford algorithm is used for
frobnication portability. See
http://ruckford.example.com/_ for details.


pass
pass
pass

I would be happy to see these conventions be more formalised; after all,
reStructuredText was originated as a means of formatting documentation
in Python docstrings.

-- 
 \“All opinions are not equal. Some are a very great deal more |
  `\robust, sophisticated and well supported in logic and argument |
_o__) than others.” —Douglas Adams |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


list(), tuple() should not place at Built-in functions in documentation

2011-07-14 Thread Inside
As telling in the subject,because list and tuple aren't functions,they are 
types.Is that right?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: list(), tuple() should not place at Built-in functions in documentation

2011-07-14 Thread Steven D'Aprano
Inside wrote:

 As telling in the subject,because list and tuple aren't functions,they
 are types.Is that right?

Yes they are types. But they can still be used as functions. Does it matter?


-- 
Steven

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


Re: list(), tuple() should not place at Built-in functions in documentation

2011-07-14 Thread rantingrick
On Jul 14, 8:21 pm, Inside fancheyuj...@gmail.com wrote:
 As telling in the subject,because list and tuple aren't functions,they 
 are types.Is that right?

You wanna see some warts in the docs. Okay, try to use the search box
to find list, dict, or tuple and see what happens...

http://docs.python.org/

Search: [ list ]

PyFloat_ClearFreeList (cfunction, in Floating Point Objects)
PyInt_ClearFreeList (cfunction, in Plain Integer Objects)
PyListObject (ctype, in List Objects)
PyList_Append (cfunction, in List Objects)
PyList_AsTuple (cfunction, in List Objects)
PyList_Check (cfunction, in List Objects)
PyList_CheckExact (cfunction, in List Objects)
PyList_GET_ITEM (cfunction, in List Objects)
PyList_GET_SIZE (cfunction, in List Objects)
PyList_GetItem (cfunction, in List Objects)
PyList_GetSlice (cfunction, in List Objects)
PyList_Insert (cfunction, in List Objects)
PyList_New (cfunction, in List Objects)
PyList_Reverse (cfunction, in List Objects)
PyList_SET_ITEM (cfunction, in List Objects)
PyList_SetItem (cfunction, in List Objects)
PyList_SetSlice (cfunction, in List Objects)
PyList_Size (cfunction, in List Objects)
PyList_Sort (cfunction, in List Objects)
PyList_Type (cvar, in List Objects)
PyMethod_ClearFreeList (cfunction, in Method Objects)

[ snip: mile long list with no LIST info to be found! ]

Hey don't get me wrong, the python docs are great; as long as you know
where to find what you're looking for.

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


Re: list(), tuple() should not place at Built-in functions in documentation

2011-07-14 Thread Ben Finney
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes:

 Inside wrote:

  As telling in the subject,because list and tuple aren't functions,they
  are types.Is that right?

 Yes they are types. But they can still be used as functions. Does it matter?

As a newcomer to the documentation I looked fruitlessly in the table of
contents for a section that would contain the built-in types. “Built-in
functions” was eliminated for the reason the OP states.

I think it matters. (But I haven't proposed a documentation patch for it.)

-- 
 \   “But Marge, what if we chose the wrong religion? Each week we |
  `\  just make God madder and madder.” —Homer, _The Simpsons_ |
_o__)  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: list(), tuple() should not place at Built-in functions in documentation

2011-07-14 Thread Corey Richardson
Excerpts from rantingrick's message of Thu Jul 14 21:36:15 -0400 2011:
 On Jul 14, 8:21pm, Inside fancheyuj...@gmail.com wrote:
  As telling in the subject,because list and tuple aren't functions,they 
  are types.Is that right?
 
 You wanna see some warts in the docs. Okay, try to use the search box
 to find list, dict, or tuple and see what happens...
 
 http://docs.python.org/
 
 Search: [ list ]
 
 PyMethod_ClearFreeList (cfunction, in Method Objects)
 
 [ snip: mile long list with no LIST info to be found! ]
 
 Hey don't get me wrong, the python docs are great; as long as you know
 where to find what you're looking for.
 

I agree, having the stuff from the C API docs appear in the search isn't
very useful. Perhaps the search should be redesigned with stuff like that
in mind? (Or maybe the search is more advanced than I use it). They aren't
exactly warts, it's useful information, but in the common case they probably
aren't desired (I always use Google to search around the python docs).

Not to mention that the search is slooo. It's plenty fast on my local
download, but I haven't actually looked at the search to see what it does
and how.
-- 
Corey Richardson
  Those who deny freedom to others, deserve it not for themselves
 -- Abraham Lincoln


signature.asc
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: list(), tuple() should not place at Built-in functions in documentation

2011-07-14 Thread Inside
Hey guy,thx for you feedback first.

But I can't follow your opinion.Why?because of the list  tuple are placed at 
built-in function,so before I type 'list' unintentionally on the pyshell and it 
show me type 'list', I never know that the name 'list' is a type,I used to 
consider it's a function to produce 'list' type.

so,after I figure out this matter,I have to change all my code assert 
isinstance(someobj, (type([]), type((0,  to assert isinstance(someobj, 
(list, tuple)),that's not a funny job.

I hope that I can stay in the Python abstract layer to solve problem(although 
go to the C API is OK but I don't want to),I'm going to trust what the doc 
telling me,so I hope the doc is exact enough.And the doc in the distribution 
maybe the most popular one.

@Steven D'Aprano,yes they can be used as function,but they aren't function and 
shouldn't confuse newcomers by this.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: list(), tuple() should not place at Built-in functions in documentation

2011-07-14 Thread Terry Reedy

On 7/14/2011 9:51 PM, Ben Finney wrote:

Steven D'Apranosteve+comp.lang.pyt...@pearwood.info  writes:


Inside wrote:


As telling in the subject,because list and tuple aren't functions,they
are types.Is that right?


At one time (before 2.2), they were functions and not classes.


Yes they are types. But they can still be used as functions. Does it matter?


As a newcomer to the documentation I looked fruitlessly in the table of
contents for a section that would contain the built-in types. “Built-in
functions” was eliminated for the reason the OP states.

I think it matters. (But I haven't proposed a documentation patch for it.)


I once proposed, I believe on the tracker, that 'built-in functions' be 
expanded to 'built-in function and classes'. That was rejected on the 
basis that people would then expect the full class documentation that is 
in the 'built-in types' section (which could now be called the 
built-isssn classes section.


A more exact title would be 'built-in callables', but that would be even 
less helpful to newcomers. Callables are functions in the generic sense.


In any case, the new index makes it easy to see what is in that chapter.

--
Terry Jan Reedy


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


Re: list(), tuple() should not place at Built-in functions in documentation

2011-07-14 Thread Ben Finney
Inside fancheyuj...@gmail.com writes:

 But I can't follow your opinion.Why?because of the list  tuple are
 placed at built-in function,so before I type 'list' unintentionally on
 the pyshell and it show me type 'list', I never know that the name
 'list' is a type,I used to consider it's a function to produce 'list'
 type.

That's the kind of fundamental knowledge that one gains by working
through the Python tutorial URL:http://docs.python.org/tutorial/. The
library reference is not the place for teaching that information.

 so,after I figure out this matter,I have to change all my code assert
 isinstance(someobj, (type([]), type((0,  to assert
 isinstance(someobj, (list, tuple)),that's not a funny job.

If you think you need to do such assertions, that's a code smell; it's
rare to need that kind of assertion and should only be done with good
reason since it breaks polymorphism. Why are you doing it?

 I hope that I can stay in the Python abstract layer to solve
 problem(although go to the C API is OK but I don't want to),I'm going
 to trust what the doc telling me,so I hope the doc is exact enough.And
 the doc in the distribution maybe the most popular one.

Including the tutorial, so now you have your homework to do :-)

 @Steven D'Aprano,yes they can be used as function,but they aren't
 function and shouldn't confuse newcomers by this.

Agreed; however, it seems reasonable people can disagree on how much
that matters. I think it should be fixed, but not enough to push for it.

-- 
 \ “Leave nothing to chance. Overlook nothing. Combine |
  `\  contradictory observations. Allow yourself enough time.” |
_o__) —Hippocrates |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: json decode issue

2011-07-14 Thread Nobody
On Thu, 14 Jul 2011 10:22:44 -0700, Miki Tebeka wrote:

 I'm trying to decode JSON output of a Java program (jackson) and having
 some issues. The cause of the problem is the following snippet:
 {
 description: ... lives\uMOVE™ OFFERS ,
 }
 Which causes ValueError: Invalid \u escape.
 
 Any ideas on how to fix this?

It's the input data which is broken. The parser is behaving correctly by
raising an exception.

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


None versus MISSING sentinel -- request for design feedback

2011-07-14 Thread Steven D'Aprano
Hello folks,

I'm designing an API for some lightweight calculator-like statistics
functions, such as mean, standard deviation, etc., and I want to support
missing values. Missing values should be just ignored. E.g.:

mean([1, 2, MISSING, 3]) = 6/3 = 2 rather than 6/4 or raising an error.

My question is, should I accept None as the missing value, or a dedicated
singleton?

In favour of None: it's already there, no extra code required. People may
expect it to work.

Against None: it's too easy to mistakenly add None to a data set by mistake,
because functions return None by default.

In favour of a dedicated MISSING singleton: it's obvious from context. It's
not a lot of work to implement compared to using None. Hard to accidentally
include it by mistake. If None does creep into the data by accident, you
get a nice explicit exception.

Against MISSING: users may expect to be able to choose their own sentinel by
assigning to MISSING. I don't want to support that.


I've considered what other packages do:-

R uses a special value, NA, to stand in for missing values. This is more or
less the model I wish to follow.

I believe that MATLAB treats float NANs as missing values. I consider this
an abuse of NANs and I won't be supporting that :-P

Spreadsheets such as Excel, OpenOffice and Gnumeric generally ignore blank
cells, and give you a choice between ignoring text and treating it as zero.
E.g. with cells set to [1, 2, spam, 3] the AVERAGE function returns 2 and
the AVERAGEA function returns 1.5.

numpy uses masked arrays, which is probably over-kill for my purposes; I am
gratified to see it doesn't abuse NANs:

 import numpy as np
 a = np.array([1, 2, float('nan'), 3])
 np.mean(a)
nan

numpy also treats None as an error:

 a = np.array([1, 2, None, 3])
 np.mean(a)
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.5/site-packages/numpy/core/fromnumeric.py, line
860, in mean
return mean(axis, dtype, out)
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'


I would appreciate any comments, advice or suggestions. 


-- 
Steven

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


[issue12287] ossaudiodev: stack corruption with FD = FD_SETSIZE

2011-07-14 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

Brian, any comment about the Windows part (see Victor's message, 
http://bugs.python.org/issue12287#msg138137) ?

--
nosy: +brian.curtin

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



[issue12551] Provide data for TLS channel binding

2011-07-14 Thread Jacek Konieczny

Jacek Konieczny jaj...@jajcus.net added the comment:

Thanks for the quick review. Most of the problems are my oversights.

I am not sure about that:
 And I think get_channel_binding() should raise NotImplementedError in that 
 case.

As the method is supposed to be extensible and 'tls-unique' may be just one of 
possible channel-binding types, then I think the same exception should be 
raised in case 'tls-unique' is requested and not implemented and when other, 
currently not implemented, channel binding type is requested. The 
get_channel_binding() method itself is always implemented, that is why I wonder 
if 'ValueError' is no better. Or 'NotImplementedError' for both 'tls-unique not 
implemented' and 'unknown channel binding'.

--

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



[issue12548] Add suport native Functor

2011-07-14 Thread yuriy_levchenko

yuriy_levchenko levchenko.yuriy.vladimirov...@gmail.com added the comment:

http://www.python.org/dev/peps/pep-0309/#note



Abandoned Syntax Proposal
 
I originally suggested the syntax fn@(*args, **kw), meaning the same as 
partial(fn, *args, **kw).
 
The @ sign is used in some assembly languages to imply register indirection, 
and the use here is also a kind of indirection. f@(x) is not f(x), but a thing 
that becomes f(x) when you call it.
 
It was not well-received, so I have withdrawn this part of the proposal. In any 
case, @ has been taken for the new decorator syntax




Maybe change '@' - '%'

--
status: closed - open

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



[issue5505] sys.stdin.read() doesn't return after first EOF on Windows

2011-07-14 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 I get this on Linux with ^D

With which Python version? Did you try Python 3.3 (development version)?

--

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



[issue12548] Add suport native Functor

2011-07-14 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

Using the func%(args) syntax is not possible because
fab = foo%(1,2)
is equivalent to
fab = foo.__mod__((1,2))

It might actually be possible to overload the % operator to make something that 
looks like your proposed syntax (without changing the actual Python syntax), 
but it still look hackish to me.
(We are also moving away from the % overload used by strings for the formatting 
in favor of the .format() method.)

--

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



[issue6942] email.generator.Generator memory consumption

2011-07-14 Thread Srikanth S

Changes by Srikanth S sriks...@gmail.com:


--
nosy: +srikanths

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



[issue7559] TestLoader.loadTestsFromName swallows import errors

2011-07-14 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

My thinking on this has evolved a bit. Changing an import error into an 
attribute error is just a bad api. We should just fix the bad api.

--

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



[issue1670765] email.Generator: no header wrapping for multipart/signed

2011-07-14 Thread Srikanth S

Changes by Srikanth S sriks...@gmail.com:


--
nosy: +srikanths

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



[issue968430] error flattening complex smime signed message

2011-07-14 Thread Srikanth S

Changes by Srikanth S sriks...@gmail.com:


--
nosy: +srikanths

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



[issue12548] Add suport native Functor

2011-07-14 Thread R. David Murray

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


--
status: open - closed

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



[issue12551] Provide data for TLS channel binding

2011-07-14 Thread Jacek Konieczny

Jacek Konieczny jaj...@jajcus.net added the comment:

This is patch updated according to your suggestions, including raising 
NotImplementedError when 'tls-unique' is not available and with the 
ssl.HAS_TLS_UNIQUE constant added.

It also includes an important fix to the data retrieval logic (one condition 
had to be reverted). 

Now the code is proven to work, by testing with another implementation 
(SCRAM-SHA-1-PLUS authentication in Isode M-Link 15.1a0).

A alternative patch version will follow.

--
Added file: http://bugs.python.org/file22651/tls_channel_binding.patch

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



[issue12556] Disable size checks in mmap.mmap()

2011-07-14 Thread Sergei Lebedev

New submission from Sergei Lebedev superbo...@gmail.com:

Current `mmap` implementation raises a ValueError if a sum of offset and length 
exceeds file size, as reported by `fstat`. While perfectly valid for most 
use-cases, it doesn't work for special files, for example:

 with open(/proc/sys/debug/exception-trace, r+b) as f:
... mmap.mmap(f.fileno(), 0)
... 
Traceback (most recent call last):
  File stdin, line 2, in module
ValueError: mmap offset is greater than file size

Same goes for almost any other /proc file, because most of them have S_ISREG() 
== True and st_size = 0.

How about adding a keyword argument to `mmap.mmap()`, which disables 
fstat-based size checks?

--
components: Library (Lib)
messages: 140330
nosy: superbobry
priority: normal
severity: normal
status: open
title: Disable size checks in mmap.mmap()
type: feature request
versions: Python 2.6

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



[issue12551] Provide data for TLS channel binding

2011-07-14 Thread Jacek Konieczny

Jacek Konieczny jaj...@jajcus.net added the comment:

This patch is functionally equivalent, but advertises 'tls-unique' support in a 
bit different way.

HAS_TLS_UNIQUE is not exposed in the python 'ssl' module, instead a list 
'CHANNEL_BINDING_TYPES' is provided (empty when 'tls-unique' is not supported). 
get_channel_binding raises ValueError if the argument is not on this list. This 
way the API can be extended to other channel binding types without adding new 
constants or functions. Adding a new channel binding type would not need any 
modifications in the API client code (if it is designed to use arbitrary cb 
types).

--
Added file: http://bugs.python.org/file22652/tls_channel_binding_alt.patch

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



[issue10403] Use member consistently

2011-07-14 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

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



[issue12250] regrtest: make --timeout explicit

2011-07-14 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset d3cebbd500aa by Victor Stinner in branch '2.7':
Issue #12250: test_socketserver uses a timeout of 60 seconds instead of 20
http://hg.python.org/cpython/rev/d3cebbd500aa

New changeset 05dfed82457a by Victor Stinner in branch '3.2':
Issue #12250: test_socketserver uses a timeout of 60 seconds instead of 20
http://hg.python.org/cpython/rev/05dfed82457a

New changeset a609b2a44f92 by Victor Stinner in branch 'default':
(merge 3.2) Issue #12250: test_socketserver uses a timeout of 60 seconds
http://hg.python.org/cpython/rev/a609b2a44f92

--

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



[issue12550] regrtest: register SIGALRM signal using faulthandler

2011-07-14 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Oops, I specified the wrong issue number if the commits:

New changeset d3cebbd500aa by Victor Stinner in branch '2.7':
Issue #12250: test_socketserver uses a timeout of 60 seconds instead of 20
http://hg.python.org/cpython/rev/d3cebbd500aa

New changeset 05dfed82457a by Victor Stinner in branch '3.2':
Issue #12250: test_socketserver uses a timeout of 60 seconds instead of 20
http://hg.python.org/cpython/rev/05dfed82457a

New changeset a609b2a44f92 by Victor Stinner in branch 'default':
(merge 3.2) Issue #12250: test_socketserver uses a timeout of 60 seconds
http://hg.python.org/cpython/rev/a609b2a44f92

--

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



[issue12250] regrtest: make --timeout explicit

2011-07-14 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
Removed message: http://bugs.python.org/msg140332

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



[issue12250] regrtest: make --timeout explicit

2011-07-14 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

(I commited fixes for issue #12550 but specified issue #12250 in the changlog, 
I removed the related comment from python-dev from this issue)

--

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



[issue12550] regrtest: register SIGALRM signal using faulthandler

2011-07-14 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Can this be closed?

--
nosy: +georg.brandl

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



[issue10403] Use member consistently

2011-07-14 Thread Senthil Kumaran

Senthil Kumaran sent...@uthcode.com added the comment:

Hello Eric, I missed noticing Alexander's comments in the reitveld, I looked 
only at tracker then. I see that some of them can be addressed. Like using 
members (components) of the field, instead of attributes when it is not an 
attribute. Shall correct it. Thanks.

--

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



[issue12557] Crash idle on mac

2011-07-14 Thread Arsouze

New submission from Arsouze georges.arso...@gmail.com:

Hi
Sorry for my poor english
I'am working on mac os snow leopard with Pyton 3.1
I want to use widgets Tix ot ttk
I have a error message : require Tile

Can you tell me step by step what i must do 
regards

--
messages: 140337
nosy: georgesarsouze
priority: normal
severity: normal
status: open
title: Crash idle on mac
type: crash

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



[issue12558] Locale-dependent crash for float width argument to Tkinter widget constructor

2011-07-14 Thread Hans Bering

New submission from Hans Bering hans.ber...@arcor.de:

The attached script will crash on a current Ubuntu with Python 3.2 + tcl/tk 
when using a locale which uses a comma as a decimal separator (e.g., German). 
It will not crash when using a locale which uses a dot as the decimal separator 
(e.g., English). In case of the crash, the output and stacktrace are as follows:

locale = ('de_DE', 'UTF8')
Traceback (most recent call last):
  File tkinterCrash.py, line 20, in module
tkcanvas = Canvas(master=master, width=w, height=2, borderwidth=4)
  File /usr/lib/python3.2/tkinter/__init__.py, line 2101, in __init__
Widget.__init__(self, master, 'canvas', cnf, kw)
  File /usr/lib/python3.2/tkinter/__init__.py, line 1961, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: bad screen distance 10.0

Originally, we stumbled over this problem when using matplotlib, which 
passes/passed down float types as width arguments on occasions. It has been 
fixed there since (see https://github.com/matplotlib/matplotlib/pull/387).

The locale dependency can make this problem difficult to debug when it occurs. 
In our setup, we had a program work on one machine, but it crashed on the next 
machine, which we believed to have an identical setup; it took us a day to 
figure out what the difference was. We would expect the constructor to either 
always work with float arguments, or to always reject them, regardless of 
locale.

We have been able to reproduce this issue both with Python 2.7.2 and Python 
3.2, both under a current Ubuntu and Windows 7.

--
components: Tkinter
files: badScreenSizeTk.py
messages: 140338
nosy: hans.bering
priority: normal
severity: normal
status: open
title: Locale-dependent crash for float width argument to Tkinter widget 
constructor
type: crash
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file22653/badScreenSizeTk.py

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



[issue12557] Crash idle on mac

2011-07-14 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

The tracker is a place to report bugs not get help.  (We don't have the 
manpower to provide help services here.)  Please try the python-list mailing 
list (gatewayed to comp.lang.python) or the python-tutor mailing list.

--
nosy: +r.david.murray
resolution:  - invalid
stage:  - committed/rejected
status: open - closed
type: crash - 

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



[issue12556] Disable size checks in mmap.mmap()

2011-07-14 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +neologix, rosslagerwall
versions: +Python 3.3 -Python 2.6

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



[issue12558] Locale-dependent crash for float width argument to Tkinter widget constructor

2011-07-14 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

FYI 'crash' is for segfault.  A traceback is just a bug :)

I'm not sure that this it is worth having this as a separate bug from #10647, 
but I'll let someone with tk knowledge decide that.

--
nosy: +kbk, r.david.murray, terry.reedy
superseder:  - scrollbar crash in non-US locale format settings
type: crash - behavior

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



[issue12558] Locale-dependent crash for float width argument to Tkinter widget constructor

2011-07-14 Thread R. David Murray

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


--
nosy: +gpolo

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



[issue12558] Locale-dependent crash for float width argument to Tkinter widget constructor

2011-07-14 Thread R. David Murray

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


--
superseder: scrollbar crash in non-US locale format settings - 

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



[issue12559] gzip.open() needs an optional encoding argument

2011-07-14 Thread Raymond Hettinger

New submission from Raymond Hettinger raymond.hettin...@gmail.com:

gzip.open() should parallel file.open() so that that zipped files can be read 
in the same way as regular files:

for line in gzip.open('notes.txt', 'r', encoding='latin-1'):
print(line.rstrip())

--
components: Library (Lib)
messages: 140341
nosy: rhettinger
priority: normal
severity: normal
status: open
title: gzip.open() needs an optional encoding argument
type: feature request
versions: Python 3.2, Python 3.3

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



[issue12558] Locale-dependent crash for float width argument to Tkinter widget constructor

2011-07-14 Thread Guilherme Polo

Guilherme Polo ggp...@gmail.com added the comment:

Why is this a bug ? You passed something that is not supposed to work with tk 
and tk said so.

--

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



[issue12560] libpython.so not built on OpenBSD

2011-07-14 Thread Stefan Sperling

New submission from Stefan Sperling s...@apache.org:

In Python-2.7.2 (I have not checked other versions, sorry),
the configure script doesn't not define LDLIBRARY on OpenBSD.
Because of this libpython.so does not get built.

--
components: Build
files: python-2.7.2-configure.diff
keywords: patch
messages: 140343
nosy: stsp
priority: normal
severity: normal
status: open
title: libpython.so not built on OpenBSD
type: compile error
versions: Python 2.7
Added file: http://bugs.python.org/file22654/python-2.7.2-configure.diff

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



[issue5999] compile error on HP-UX 11.22 ia64 - 'mbstate_t' is used as a type, but has not been defined as a type

2011-07-14 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

Martin - sys/_mbstate_t.h provides a definition for mbstate_t only (at least 
on HP/UX 11i V2.0).  I can verify that the problem still exists for Python 
3.2.1.  I am working on a workaround for this issue, and I will attach a patch 
once I get it to build.

--
nosy: +jschneid

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



[issue12502] 100% cpu usage when using asyncore with UNIX socket

2011-07-14 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset 16bc59d37866 by Charles-François Natali in branch '2.7':
Issue #12502: asyncore: fix polling loop with AF_UNIX sockets.
http://hg.python.org/cpython/rev/16bc59d37866

--
nosy: +python-dev

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



[issue12502] 100% cpu usage when using asyncore with UNIX socket

2011-07-14 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset 42ec507815d2 by Charles-François Natali in branch '3.1':
Issue #12502: asyncore: fix polling loop with AF_UNIX sockets.
http://hg.python.org/cpython/rev/42ec507815d2

--

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



[issue12502] 100% cpu usage when using asyncore with UNIX socket

2011-07-14 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset ed90c1c8ee62 by Charles-François Natali in branch '3.2':
Merge - Issue #12502: asyncore: fix polling loop with AF_UNIX sockets.
http://hg.python.org/cpython/rev/ed90c1c8ee62

--

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



[issue12561] Compiler workaround for wide string constants in Modules/getpath.c (patch)

2011-07-14 Thread Jim Schneider

New submission from Jim Schneider jim.schnei...@dataflux.com:

In Modules/getpath.c, the following line (#138) causes problems with some 
compilers (HP/UX 11, in particular - there could be others):

static wchar_t *lib_python = Llib/python VERSION;

Similarly, line #644:

module_search_path = L PYTHONPATH;

The default HP/UX compiler fails to compile this file with the error Cannot 
concatenate character string literal and wide string literal.  The attached 
patch converts these two string literals to wide string literals that the HP/UX 
compiler can understand.

Very limited testing indicates that the patch is benign (it does not affect the 
build on Linux running on x86_64).

--
components: Build
files: getpath.patch
keywords: patch
messages: 140348
nosy: jschneid
priority: normal
severity: normal
status: open
title: Compiler workaround for wide string constants in Modules/getpath.c 
(patch)
type: compile error
versions: Python 3.2
Added file: http://bugs.python.org/file22655/getpath.patch

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



[issue12562] calling mmap twice fails on Windows

2011-07-14 Thread Piotr Zolnierczuk

New submission from Piotr Zolnierczuk piotr.zolnierc...@gmail.com:

Hi,
I am trying to migrate from Python 2.5 to Python 2.7 I found though the mmap 
behaves differently on Windows XP between the two versions. It boils down to 
the following code:
import mmap
map1 = mmap.mmap(fileno=0, tagname='MyData', length=4096)
map2 = mmap.mmap(fileno=0, tagname='MyData', length=8192)

It runs fine (so I can resize shared memory) on XP with 2.5.4, but when 
running on 2.7.2 I get the following error

Traceback (most recent call last):
  File D:\Workspace\memmap_test.py, line 3, in module
map2 = mmap.mmap(fileno=0, tagname='MyData', length=8192)
WindowsError: [Error 5] Access is denied

--
messages: 140349
nosy: zolnie
priority: normal
severity: normal
status: open
title: calling mmap twice fails on Windows
versions: Python 2.7

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



[issue12562] calling mmap twice fails on Windows

2011-07-14 Thread Piotr Zolnierczuk

Changes by Piotr Zolnierczuk piotr.zolnierc...@gmail.com:


--
components: +Windows
type:  - behavior

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



[issue12502] 100% cpu usage when using asyncore with UNIX socket

2011-07-14 Thread Roundup Robot

Roundup Robot devnull@devnull added the comment:

New changeset ca077f2672e3 by Charles-François Natali in branch 'default':
Merge - Issue #12502: asyncore: fix polling loop with AF_UNIX sockets.
http://hg.python.org/cpython/rev/ca077f2672e3

--

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



[issue12430] Pip fails to fetch from mirror if PyPi checksum times out

2011-07-14 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

In any case, mirrors *do* mirror the checksums.

--
nosy: +loewis

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



[issue5999] compile error on HP-UX 11.22 ia64 - 'mbstate_t' is used as a type, but has not been defined as a type

2011-07-14 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

I got it to build on HP-UX 11.  However, there are a lot of compiler warnings 
about type mismatches, the _ctypes, _multiprocessing and termios modules failed 
to build, and make test died after not finding a usable binascii module.

To get it to build, I did the following:
1)  Applied the patch I attached to issue 12561
2)  Created a directory sys, and copied /usr/include/sys/stdsyms.h into it.
3)  Did chmod 644 on sys/stdsyms.h and applied the patch stdsyms.patch that 
I've attached to this issue to it.
4)  Ran configure with the argument CPPFLAGS=-I.

At this point, make ran to completion, and produced a python binary.  However, 
make test dies within seconds of starting up.

--
keywords: +patch
Added file: http://bugs.python.org/file22656/stdsyms.patch

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



[issue5999] compile error on HP-UX 11.22 ia64 - 'mbstate_t' is used as a type, but has not been defined as a type

2011-07-14 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

Jim, the question remains why it fails to compile then. If the type is defined, 
why does it give an error message but has not been defined as a type???

--

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



[issue5999] compile error on HP-UX 11.22 ia64 - 'mbstate_t' is used as a type, but has not been defined as a type

2011-07-14 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

Martin - sys/_mbstate.h is only included if _INCLUDE__STDC_A1_SOURCE is 
defined.  The only way this gets defined in the vendor-provided include files 
is if _XOPEN_SOURCE is defined and is equal to 500, or __STDC_VERSION__ is 
defined and is greater than or equal to 199901.

I've attached a patch to broaden the _XOPEN_SOURCE case (as the test should 
clearly have been =, not ==).  Defining __STDC_VERSION__ to 199901 or greater 
will also do the job, but it feels more like a hack than just fixing what's 
broken in the vendor include files.

--

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



[issue12561] Compiler workaround for wide string constants in Modules/getpath.c (patch)

2011-07-14 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

Why is the __W macro needed?

Please don't call it WCHAR:
- it conflicts with a same-named macro on Windows
- you are applying it to strings, not characters

FWIW, the compiler doesn't conform to standard C if it rejects this code. 
6.4.5p4 says

   [#4]   In  translation  phase  6,  the  multibyte  character
   sequences specified by any sequence  of  adjacent  character
   and  wide  string  literal  tokens  are  concatenated into a
   single multibyte character sequence.  If any of  the  tokens
   are  wide  string  literal  tokens,  the resulting multibyte
   character sequence is treated  as  a  wide  string  literal;
   otherwise, it is treated as a character string literal.

--
nosy: +loewis

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



[issue5999] compile error on HP-UX 11.22 ia64 - 'mbstate_t' is used as a type, but has not been defined as a type

2011-07-14 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

That's a patch to HP-UX, right? Not one to Python.

--

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



[issue12563] Check out my about.me profile!

2011-07-14 Thread gungor

New submission from gungor gungorb...@gmail.com:

Hi Python,

I set up my about.me splash page and want to share it with you: 
http://about.me/gungorbasa?promo=share_1856_378462.

If you don't have an about.me splash page, you can get one for free at 
http://about.me?promo=share_1856_378462. Names are going fast so you might 
want to get yours now.

GüngörIf you would like to unsubscribe and stop receiving these emails click 
here: 
http://email.about.me/wf/unsubscribe?rp=Er%2BBdZSP6nTkZci6SREkGqX5gSZJ4%2F0QZJ4Ffae3DStZkB4kgwyA2ibIRCSN5vDKSXYX2zIEziWyMTT%2Faa5x7A%3D%3Du=pALbODzFR4KGDIyxaHqpmw%2Fut

--
files: unnamed
messages: 140357
nosy: gungorbasa
priority: normal
severity: normal
status: open
title: Check out my about.me profile!
Added file: http://bugs.python.org/file22657/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12563
___Hi Python,brbrI set up my about.me splash page and want to share it with 
you: a 
href=http://about.me/gungorbasa?promo=share_1856_378462;http://about.me/gungorbasa/a.brbrIf
 you don't have an about.me splash page, you can get one for free at a 
href=http://about.me?promo=share_1856_378462;http://about.me/a. Names are 
going fast so you might want to get yours now.brbrGüngörp
If you would like to unsubscribe and stop receiving these emails a 
href=http://email.about.me/wf/unsubscribe?rp=Er%2BBdZSP6nTkZci6SREkGqX5gSZJ4%2F0QZJ4Ffae3DStZkB4kgwyA2ibIRCSN5vDKSXYX2zIEziWyMTT%2Faa5x7A%3D%3Damp;u=pALbODzFR4KGDIyxaHqpmw%2Fuh;click
 here/a./p

img 
src=http://email.about.me/wf/open?rp=Er%2BBdZSP6nTkZci6SREkGqX5gSZJ4%2F0QZJ4Ffae3DStZkB4kgwyA2ibIRCSN5vDKSXYX2zIEziWyMTT%2Faa5x7A%3D%3Damp;u=pALbODzFR4KGDIyxaHqpmw%2Foo0.gif;
 alt=
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12564] Check out my about.me profile!

2011-07-14 Thread gungor

New submission from gungor gungorb...@gmail.com:

Hi Python,

I set up my about.me splash page and want to share it with you: 
http://about.me/gungorbasa?promo=share_1857_378462.

If you don't have an about.me splash page, you can get one for free at 
http://about.me?promo=share_1857_378462. Names are going fast so you might 
want to get yours now.

GüngörIf you would like to unsubscribe and stop receiving these emails click 
here: 
http://email.about.me/wf/unsubscribe?rp=Er%2BBdZSP6nTkZci6SREkGqX5gSZJ4%2F0QZJ4Ffae3DStZkB4kgwyA2ibIRCSN5vDKSXYX2zIEziWyMTT%2Faa5x7A%3D%3Du=TNIvc_YfTw6bmZBeA3uDMA%2Fut

--
files: unnamed
messages: 140358
nosy: gungorbasa
priority: normal
severity: normal
status: open
title: Check out my about.me profile!
Added file: http://bugs.python.org/file22658/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12564
___Hi Python,brbrI set up my about.me splash page and want to share it with 
you: a 
href=http://about.me/gungorbasa?promo=share_1857_378462;http://about.me/gungorbasa/a.brbrIf
 you don't have an about.me splash page, you can get one for free at a 
href=http://about.me?promo=share_1857_378462;http://about.me/a. Names are 
going fast so you might want to get yours now.brbrGüngörp
If you would like to unsubscribe and stop receiving these emails a 
href=http://email.about.me/wf/unsubscribe?rp=Er%2BBdZSP6nTkZci6SREkGqX5gSZJ4%2F0QZJ4Ffae3DStZkB4kgwyA2ibIRCSN5vDKSXYX2zIEziWyMTT%2Faa5x7A%3D%3Damp;u=TNIvc_YfTw6bmZBeA3uDMA%2Fuh;click
 here/a./p

img 
src=http://email.about.me/wf/open?rp=Er%2BBdZSP6nTkZci6SREkGqX5gSZJ4%2F0QZJ4Ffae3DStZkB4kgwyA2ibIRCSN5vDKSXYX2zIEziWyMTT%2Faa5x7A%3D%3Damp;u=TNIvc_YfTw6bmZBeA3uDMA%2Foo0.gif;
 alt=
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12561] Compiler workaround for wide string constants in Modules/getpath.c (patch)

2011-07-14 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

The __W macro is needed because the token-pasting operator binds to the macro's 
argument immediately;  Having WCHAR(y) expand to __W(y) means that __W is 
passed WCHAR's argument after it's been macro-expanded.  Without the 
intermediate step, WCHAR(VERSION) becomes LVERSION.

As for the name - I have no objection to reasonable name changes.  I picked 
WCHAR because it converts its argument to a wchar_t *.

Finally - I am aware that the HP/UX C compiler is broken.  Unfortunately, I am 
required to work with it, and can neither replace it nor ignore it.

--

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



[issue12565] Check out my about.me profile!

2011-07-14 Thread gungor

New submission from gungor gungorb...@gmail.com:

Hi Python,

I set up my about.me splash page and want to share it with you: 
http://about.me/gungorbasa?promo=share_1858_378462.

If you don't have an about.me splash page, you can get one for free at 
http://about.me?promo=share_1858_378462. Names are going fast so you might 
want to get yours now.

GüngörIf you would like to unsubscribe and stop receiving these emails click 
here: 
http://email.about.me/wf/unsubscribe?rp=Er%2BBdZSP6nTkZci6SREkGqX5gSZJ4%2F0QZJ4Ffae3DStZkB4kgwyA2ibIRCSN5vDKSXYX2zIEziWyMTT%2Faa5x7A%3D%3Du=sKR-vgz5SBKaB5LfWMBuDg%2Fut

--
files: unnamed
messages: 140360
nosy: gungorbasa
priority: normal
severity: normal
status: open
title: Check out my about.me profile!
Added file: http://bugs.python.org/file22659/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12565
___Hi Python,brbrI set up my about.me splash page and want to share it with 
you: a 
href=http://about.me/gungorbasa?promo=share_1858_378462;http://about.me/gungorbasa/a.brbrIf
 you don't have an about.me splash page, you can get one for free at a 
href=http://about.me?promo=share_1858_378462;http://about.me/a. Names are 
going fast so you might want to get yours now.brbrGüngörp
If you would like to unsubscribe and stop receiving these emails a 
href=http://email.about.me/wf/unsubscribe?rp=Er%2BBdZSP6nTkZci6SREkGqX5gSZJ4%2F0QZJ4Ffae3DStZkB4kgwyA2ibIRCSN5vDKSXYX2zIEziWyMTT%2Faa5x7A%3D%3Damp;u=sKR-vgz5SBKaB5LfWMBuDg%2Fuh;click
 here/a./p

img 
src=http://email.about.me/wf/open?rp=Er%2BBdZSP6nTkZci6SREkGqX5gSZJ4%2F0QZJ4Ffae3DStZkB4kgwyA2ibIRCSN5vDKSXYX2zIEziWyMTT%2Faa5x7A%3D%3Damp;u=sKR-vgz5SBKaB5LfWMBuDg%2Foo0.gif;
 alt=
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5999] compile error on HP-UX 11.22 ia64 - 'mbstate_t' is used as a type, but has not been defined as a type

2011-07-14 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

Yes, it is a patch to an HP-provided C compiler system header file.  I cannot 
provide the actual file it patches, due to copyright limitations.

--

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



[issue12566] Check out my about.me profile!

2011-07-14 Thread gungor

New submission from gungor gungorb...@gmail.com:

Hi Python,

I set up my about.me splash page and want to share it with you: 
http://about.me/gungorbasa?promo=share_1859_378462.

If you don't have an about.me splash page, you can get one for free at 
http://about.me?promo=share_1859_378462. Names are going fast so you might 
want to get yours now.

GüngörIf you would like to unsubscribe and stop receiving these emails click 
here: 
http://email.about.me/wf/unsubscribe?rp=Er%2BBdZSP6nTkZci6SREkGqX5gSZJ4%2F0QZJ4Ffae3DStZkB4kgwyA2ibIRCSN5vDKSXYX2zIEziWyMTT%2Faa5x7A%3D%3Du=O-EGT9YnTHaZ2hKIsi8xlw%2Fut

--
files: unnamed
messages: 140362
nosy: gungorbasa
priority: normal
severity: normal
status: open
title: Check out my about.me profile!
Added file: http://bugs.python.org/file22660/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12566
___Hi Python,brbrI set up my about.me splash page and want to share it with 
you: a 
href=http://about.me/gungorbasa?promo=share_1859_378462;http://about.me/gungorbasa/a.brbrIf
 you don't have an about.me splash page, you can get one for free at a 
href=http://about.me?promo=share_1859_378462;http://about.me/a. Names are 
going fast so you might want to get yours now.brbrGüngörp
If you would like to unsubscribe and stop receiving these emails a 
href=http://email.about.me/wf/unsubscribe?rp=Er%2BBdZSP6nTkZci6SREkGqX5gSZJ4%2F0QZJ4Ffae3DStZkB4kgwyA2ibIRCSN5vDKSXYX2zIEziWyMTT%2Faa5x7A%3D%3Damp;u=O-EGT9YnTHaZ2hKIsi8xlw%2Fuh;click
 here/a./p

img 
src=http://email.about.me/wf/open?rp=Er%2BBdZSP6nTkZci6SREkGqX5gSZJ4%2F0QZJ4Ffae3DStZkB4kgwyA2ibIRCSN5vDKSXYX2zIEziWyMTT%2Faa5x7A%3D%3Damp;u=O-EGT9YnTHaZ2hKIsi8xlw%2Foo0.gif;
 alt=
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12563] Check out my about.me profile!

2011-07-14 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

spam

--
nosy: +r.david.murray
status: open - closed

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



[issue12566] Check out my about.me profile!

2011-07-14 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

spam

--
nosy: +r.david.murray
status: open - closed

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



  1   2   >