ANN: dateutil 2.3 is released

2014-12-02 Thread Yaron de Leeuw
dateutil 2.3 is released

What is dateutil?
-
The dateutil package provides powerful extensions tothe standard datetime
module available in Python. It ships with its own timezone database, and 
contains
utilities to deal with date parsing, timezones, time deltas, recurrence-rules, 
and more.

What is new in version 2.3?
---
- New maintainer, together with new hosting: GitHub, Travis, Read-The-Docs
- Many long-standing bug fixes, including a wrong exception type on bad
  input, unclosed file handles and more.
- Updated the included timezone file to 2014j.
- zip-safe and universal-WHEEL-able, thanks to changes in the handling of 
  the timezone file.

Where can I find it?

The package is itself is on PyPI (universal wheel and source):
https://pypi.python.org/pypi/python-dateutil/
The code is on github:
https://github.com/dateutil/dateutil
The documentation is at read-the-docs:
https://dateutil.readthedocs.org/


Yaron de Leeuw
m...@jarondl.net
 


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

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


ANN: eGenix mxODBC Connect 2.1.2 - Python Database Interface

2014-12-02 Thread eGenix Team: M.-A. Lemburg

ANNOUNCING
  eGenix.com mxODBC Connect

  Python Database Interface

Version 2.1.2


 mxODBC Connect is our commercially supported client-server product for
   connecting Python applications to relational databases
 in a truly platform independent way.


This announcement is also available on our web-site for online reading:
http://www.egenix.com/company/news/eGenix-mxODBC-Connect-2.1.2-GA.html


INTRODUCTION

The mxODBC Connect Database Interface for Python allows users to
easily connect Python applications to all major databases on the
market today in a highly portable, convenient and secure way.

Python Database Connectivity the Easy Way
-

Unlike our mxODBC Python extension, mxODBC Connect is designed as
client-server application, so you no longer need to find production
quality ODBC drivers for all the platforms you target with your Python
application.

Instead you use an easy to install royalty-free Python client library
which connects directly to the mxODBC Connect database server over the
network.

This makes mxODBC Connect a great basis for writing cross-platform
multi-tier database applications and utilities in Python, especially
if you run applications that need to communicate with databases such
as MS SQL Server and MS Access, Oracle Database, IBM DB2 and Informix,
Sybase ASE and Sybase Anywhere, MySQL, PostgreSQL, SAP MaxDB and many
more, that run on Windows or Linux machines.

Ideal for Database Driven Client Applications
-

By removing the need to install and configure ODBC drivers on the
client side and dealing with complicated network setups for each set
of drivers, mxODBC Connect greatly simplifies deployment of database
driven client applications, while at the same time making the network
communication between client and database server more efficient and
more secure.

For more information, please have a look at the mxODBC Connect product
page, in particular, the full list of available features.

For more information, please see the product page:

http://www.egenix.com/products/python/mxODBCConnect/


NEWS

mxODBC Connect 2.1.2 is a patch level release of our successful mxODBC
Connect product.

In the last patch level release 2.1.1, we had put a lot of emphasis on
enhancing the TLS/SSL setup of the mxODBC Connect product:

https://cms.egenix.com/company/news/eGenix-mxODBC-Connect-2.1.1-GA.html

In this release, we are fixing a pip installation problem, that
occurred with the mxODBC Connect Client on a few platforms, as well as
a some other minor issues we found:

Security Enhancements
-

 * OpenSSL cipher string list updated to explicitly disallow use of
   low security or export ciphers.

mxODBC Connect Enhancements
---

 * Fixed a problem that could cause the mxODBC Connect Client to not
   install correctly with pip.

 * Successfully tested against Python 2.7.9, which will come with a
   new ssl module.

 * Fixed the package version number to show the correct release
   version.

 * Fixed OpenSSL warnings in the Unix installer and scripts.

For the full set of changes, including those of the 2.1 series of
mxODBC Connect, please check the mxODBC Connect change log:

http://www.egenix.com/products/python/mxODBCConnect/changelog.html


UPGRADING

You are encouraged to upgrade to this latest mxODBC Connect release.
When upgrading, please always upgrade both the server and the client
installations to the same version - even for patch level releases.

We will give out 20% discount coupons for upgrade purchases going from
mxODBC Connect Server 1.x to 2.1 and 50% coupons for upgrades from
mxODBC 2.x to 2.1. Please contact the eGenix.com Sales Team
(sa...@egenix.com) with your existing license serials for details.

Users of our stand-alone mxODBC product will have to purchase new
licenses from our online shop in order to use mxODBC Connect.

You can request free 30-day evaluation licenses by visiting our
web-site or writing to sa...@egenix.com, stating your name (or the
name of the company) and the number of eval licenses that you need.

http://www.egenix.com/products/python/mxODBCConnect/#Evaluation


DOWNLOADS

The download archives as well as instructions for installation and
configuration of the product can be found on the product page:

http://www.egenix.com/products/python/mxODBCConnect/

If you want to try the package, jump straight to the download
instructions:


Re: PyEval_GetLocals and unreferenced variables

2014-12-02 Thread Kasper Peeters
  def fun():
 cfun_that_creates_q_in_local_scope()
 def fun2():
 cfun_that_wants_to_see_if_q_is_available()
  
  So the Python side actually doesn't see 'q' directly at all.

 I think you will need to elaborate.

Ok, here goes (and thanks for listening). 

The behaviour of the C side is determined by certain
settings/preferences. I want these settings to respect the Python
scope. I could in principle decide to make these settings a proper
Python object, and ask the user to create one and pass it along at
every C-function call. Something like

   def fun():
  settings = Cpp_Options()
  settings.set_some_flag()
  cfun(settings, ...)
  def fun2():
  settings = Cpp_Options(settings)
  settings.set_some_other_flag()
  cfun(settings, ...)

Then Python would automatically take care of the scope of 'settings'.

However, this is difficult for the user to keep track of. So my
idea was to allow for

  def fun():
  set_some_flag()
  cfun(...)
  def fun2():
  set_some_other_flag()
  cfun(...)

I let the C side create a Cpp_Options object on the locals stack
behind the scenes, and the 'cfun()' function takes it from there
directly, without requiring the user to pass it. Much easier for the
user.

This works, but the problem is that the C side does not see the
settings that were created in fun() when it gets called from fun2(). In
fun2(), the locals do not contain objects constructed earlier in fun(),
unless the Python side explicitly refers to them. So adding a line

settings.do_something()

inside fun2() would work and forces Python to pull the settings object
created in fun() into scope, but that sort of defeats the purpose.

Hence my question: how can I ask, purely on the C side, for Python to
pull objects into the local frame?

Final note: I am actually trying to make this look as close as possible
to an older custom-built language, which didn't require passing the
settings object either, so it's kinda important to make the user feel
'at home'. 

Hope this makes it more clear, thanks for your patience.

Cheers,
Kasper
-- 
https://mail.python.org/mailman/listinfo/python-list


ANN: eGenix mxODBC Connect 2.1.2 - Python Database Interface

2014-12-02 Thread eGenix Team: M.-A. Lemburg

ANNOUNCING
  eGenix.com mxODBC Connect

  Python Database Interface

Version 2.1.2


 mxODBC Connect is our commercially supported client-server product for
   connecting Python applications to relational databases
 in a truly platform independent way.


This announcement is also available on our web-site for online reading:
http://www.egenix.com/company/news/eGenix-mxODBC-Connect-2.1.2-GA.html


INTRODUCTION

The mxODBC Connect Database Interface for Python allows users to
easily connect Python applications to all major databases on the
market today in a highly portable, convenient and secure way.

Python Database Connectivity the Easy Way
-

Unlike our mxODBC Python extension, mxODBC Connect is designed as
client-server application, so you no longer need to find production
quality ODBC drivers for all the platforms you target with your Python
application.

Instead you use an easy to install royalty-free Python client library
which connects directly to the mxODBC Connect database server over the
network.

This makes mxODBC Connect a great basis for writing cross-platform
multi-tier database applications and utilities in Python, especially
if you run applications that need to communicate with databases such
as MS SQL Server and MS Access, Oracle Database, IBM DB2 and Informix,
Sybase ASE and Sybase Anywhere, MySQL, PostgreSQL, SAP MaxDB and many
more, that run on Windows or Linux machines.

Ideal for Database Driven Client Applications
-

By removing the need to install and configure ODBC drivers on the
client side and dealing with complicated network setups for each set
of drivers, mxODBC Connect greatly simplifies deployment of database
driven client applications, while at the same time making the network
communication between client and database server more efficient and
more secure.

For more information, please have a look at the mxODBC Connect product
page, in particular, the full list of available features.

For more information, please see the product page:

http://www.egenix.com/products/python/mxODBCConnect/


NEWS

mxODBC Connect 2.1.2 is a patch level release of our successful mxODBC
Connect product.

In the last patch level release 2.1.1, we had put a lot of emphasis on
enhancing the TLS/SSL setup of the mxODBC Connect product:

https://cms.egenix.com/company/news/eGenix-mxODBC-Connect-2.1.1-GA.html

In this release, we are fixing a pip installation problem, that
occurred with the mxODBC Connect Client on a few platforms, as well as
a some other minor issues we found:

Security Enhancements
-

 * OpenSSL cipher string list updated to explicitly disallow use of
   low security or export ciphers.

mxODBC Connect Enhancements
---

 * Fixed a problem that could cause the mxODBC Connect Client to not
   install correctly with pip.

 * Successfully tested against Python 2.7.9, which will come with a
   new ssl module.

 * Fixed the package version number to show the correct release
   version.

 * Fixed OpenSSL warnings in the Unix installer and scripts.

For the full set of changes, including those of the 2.1 series of
mxODBC Connect, please check the mxODBC Connect change log:

http://www.egenix.com/products/python/mxODBCConnect/changelog.html


UPGRADING

You are encouraged to upgrade to this latest mxODBC Connect release.
When upgrading, please always upgrade both the server and the client
installations to the same version - even for patch level releases.

We will give out 20% discount coupons for upgrade purchases going from
mxODBC Connect Server 1.x to 2.1 and 50% coupons for upgrades from
mxODBC 2.x to 2.1. Please contact the eGenix.com Sales Team
(sa...@egenix.com) with your existing license serials for details.

Users of our stand-alone mxODBC product will have to purchase new
licenses from our online shop in order to use mxODBC Connect.

You can request free 30-day evaluation licenses by visiting our
web-site or writing to sa...@egenix.com, stating your name (or the
name of the company) and the number of eval licenses that you need.

http://www.egenix.com/products/python/mxODBCConnect/#Evaluation


DOWNLOADS

The download archives as well as instructions for installation and
configuration of the product can be found on the product page:

http://www.egenix.com/products/python/mxODBCConnect/

If you want to try the package, jump straight to the download
instructions:


Re: How about some syntactic sugar for __name__ == '__main__' ?

2014-12-02 Thread Ethan Furman
On 12/01/2014 05:15 PM, Chris Angelico wrote:
 On Tue, Dec 2, 2014 at 11:45 AM, Ethan Furman wrote:

 Put the above somewhere in your path (e.g. /usr/local/bin), make it 
 executable, and then instead of shebanging your
 scripts with `/usr/local/bin/python` you can use `/usr/local/bin/py_main`, 
 which will load and execute the script,
 calling script.main as its last act.
 
 Be aware that this trick (shebanging to a script rather than a binary)
 isn't specified by the POSIX standard. It works on Linux, but I don't
 know about other systems. 

Ah, thanks for that!

--
~Ethan~



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


2nd call for notes about Eric IDE

2014-12-02 Thread Pietro Moras
In view of next edition of the Eric IDE Technical Report (forecast:  3rd 
quarter '15) and notably with reference to the innovative Eric ver. no. 6, 
we'll welcome your testimony of experiences and use of specific Eric IDE's 
features; 
such as: 
 
 – Special features of your choice, as:  SQL Browser, Qt Forms Designer, Debug 
Remote Configurable, Eric APIs, PEP 8 Compliance Syntax and Tabnanny Checks, … 

 – Any other feature of your choice you deem as not adequately documented by 
the “Eric Tech. Reports” as currently available at URL:  
http://eric-ide.python-projects.org/eric-documentation.html 
 
Please send notes to:  Studio-PM at hotmail dot com. Thanks. 
See you. 
 - P.M.

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


Re: PyEval_GetLocals and unreferenced variables

2014-12-02 Thread Ned Batchelder

On 12/2/14 4:35 AM, Kasper Peeters wrote:

 def fun():
cfun_that_creates_q_in_local_scope()
def fun2():
cfun_that_wants_to_see_if_q_is_available()

So the Python side actually doesn't see 'q' directly at all.


I think you will need to elaborate.


Ok, here goes (and thanks for listening).

The behaviour of the C side is determined by certain
settings/preferences. I want these settings to respect the Python
scope. I could in principle decide to make these settings a proper
Python object, and ask the user to create one and pass it along at
every C-function call. Something like

def fun():
   settings = Cpp_Options()
   settings.set_some_flag()
   cfun(settings, ...)
   def fun2():
   settings = Cpp_Options(settings)
   settings.set_some_other_flag()
   cfun(settings, ...)

Then Python would automatically take care of the scope of 'settings'.

However, this is difficult for the user to keep track of. So my
idea was to allow for

   def fun():
   set_some_flag()
   cfun(...)
   def fun2():
   set_some_other_flag()
   cfun(...)

I let the C side create a Cpp_Options object on the locals stack
behind the scenes, and the 'cfun()' function takes it from there
directly, without requiring the user to pass it. Much easier for the
user.

This works, but the problem is that the C side does not see the
settings that were created in fun() when it gets called from fun2(). In
fun2(), the locals do not contain objects constructed earlier in fun(),
unless the Python side explicitly refers to them. So adding a line

 settings.do_something()

inside fun2() would work and forces Python to pull the settings object
created in fun() into scope, but that sort of defeats the purpose.



I would use thread locals for this: 
https://docs.python.org/2/library/threading.html#threading.local


They act like global variables, in that they are available implicitly 
without being passed around, but like locals in that two separate 
threads will have different values.


--
Ned Batchelder, http://nedbatchelder.com

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


Re: Cherrypy - prevent browser prefetch?

2014-12-02 Thread random832
On Mon, Dec 1, 2014, at 15:28, Israel Brewster wrote:
 For example, I have a URL on my Cherrypy app that updates some local
 caches. It is accessed at http://server/admin/updatecaches So if I
 start typing http://server/a, for example, safari may auto-fill the
 dmin/updatecaches, and trigger a cache refresh on the server - even
 though I was just trying to get to the main admin page at /admin. Or, it
 might auto-fill uth/logout instead (http://server/auth/logout), and
 log me out of my session. While the former may be acceptable (after all,
 a cache update, even if not strictly needed, is at least non-harmfull),
 the latter could cause serious issues with usability. So how can cherrypy
 tell the difference between the prefetch and an actual request, and not
 respond to the prefetch?

Why is your logout form - or, your update caches form, etc - a GET
instead of a POST? The key problem is that a GET request is assumed by
browser designers to not have any harmful side effects.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cherrypy - prevent browser prefetch?

2014-12-02 Thread Israel Brewster

 On Dec 2, 2014, at 4:33 AM, random...@fastmail.us wrote:
 
 On Mon, Dec 1, 2014, at 15:28, Israel Brewster wrote:
 For example, I have a URL on my Cherrypy app that updates some local
 caches. It is accessed at http://server/admin/updatecaches So if I
 start typing http://server/a, for example, safari may auto-fill the
 dmin/updatecaches, and trigger a cache refresh on the server - even
 though I was just trying to get to the main admin page at /admin. Or, it
 might auto-fill uth/logout instead (http://server/auth/logout), and
 log me out of my session. While the former may be acceptable (after all,
 a cache update, even if not strictly needed, is at least non-harmfull),
 the latter could cause serious issues with usability. So how can cherrypy
 tell the difference between the prefetch and an actual request, and not
 respond to the prefetch?
 
 Why is your logout form - or, your update caches form, etc - a GET
 instead of a POST?

Primary because they aren’t forms, they are links. And links are, by 
definition, GET’s. That said, as I mentioned in earlier replies, if using a 
form for a simple link is the Right Way to do things like this, then I can 
change it.

Thanks!

—
Israel Brewster

 The key problem is that a GET request is assumed by
 browser designers to not have any harmful side effects.
 -- 
 https://mail.python.org/mailman/listinfo/python-list

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


Proposed new conditional operator: or else

2014-12-02 Thread Roy Smith
In the process of refactoring some code, I serendipitously created what I think 
is an essential new bit of Python syntax.  The “or else” statement.  I ended up 
with:

sites_string = args.sites or else self.config['sites']

which, of course, is a syntax error today, but it got me thinking what we could 
do with an “or else” construct.  Perhaps an alternative to assertions?  
Wouldn’t it be neat to write:

   foo == 42 or else

and have that be an synonym for:

assert foo == 42

:-)

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


Re: Proposed new conditional operator: or else

2014-12-02 Thread Zachary Ware
On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith r...@panix.com wrote:
 Wouldn’t it be neat to write:

foo == 42 or else

 and have that be an synonym for:

 assert foo == 42

 :-)

Never going to happen, but I like it!  Perhaps raise IntimidationError
instead of AssertionError when it fails?

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


Re: Proposed new conditional operator: or else

2014-12-02 Thread Ethan Furman
On 12/02/2014 09:41 AM, Zachary Ware wrote:
 On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith wrote:

 Wouldn’t it be neat to write:

foo == 42 or else

 and have that be an synonym for:

 assert foo == 42
 
 Never going to happen, but I like it!  Perhaps raise IntimidationError
 instead of AssertionError when it fails?

As long as when raising Intimidation, it also roughs up a couple surrounding 
lines as a warning to the rest of the code...

--
~Ethan~



signature.asc
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Proposed new conditional operator: or else

2014-12-02 Thread Chris Angelico
On Wed, Dec 3, 2014 at 4:41 AM, Zachary Ware
zachary.ware+pyl...@gmail.com wrote:
 On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith r...@panix.com wrote:
 Wouldn’t it be neat to write:

foo == 42 or else

 and have that be an synonym for:

 assert foo == 42

 :-)

 Never going to happen, but I like it!  Perhaps raise IntimidationError
 instead of AssertionError when it fails?

Definitely. That's what I first thought, when I saw the subject line.

Additionally, whenever this construct is used, the yield statement
(expression, whatever) will be redefined to yield to intimidation and
make the statement true, whatever it takes. In the above example,
yield would decide which out of foo and 42 is more amenable to
change, and altering it to be equal to the other. (It may also find
that == is the most amenable, and alter its definition such that foo
and 42 become equal.)

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


Re: Proposed new conditional operator: or else

2014-12-02 Thread Tim Chase
On 2014-12-02 11:41, Zachary Ware wrote:
 On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith r...@panix.com wrote:
  Wouldn’t it be neat to write:
 
 foo == 42 or else
 
  and have that be an synonym for:
 
  assert foo == 42
 
  :-)
 
 Never going to happen, but I like it!  Perhaps raise
 IntimidationError instead of AssertionError when it fails?

In light of the parallel thread discussing the assert statement
and the perils of trusting it to be present even though it can be
optimized away, this or else could be (in the altered words of Don
Corleone), I'm gonna make an assertion he can't refuse.

(not that I particularly want/expect this in the language definition,
but it's fun to entertain the idea)

-tkc



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


Re: Proposed new conditional operator: or else

2014-12-02 Thread Marko Rauhamaa
Tim Chase python.l...@tim.thechases.com:

 foo == 42 or else

 In light of the parallel thread discussing the assert statement and
 the perils of trusting it to be present even though it can be
 optimized away, this or else could be (in the altered words of Don
 Corleone), I'm gonna make an assertion he can't refuse.

I would consider vain threats an antipattern.


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


Re: i have to create this patch in python but wasnt having any luck i was wondering if anyone had a solution?

2014-12-02 Thread Joel Goldstick
On Mon, Dec 1, 2014 at 2:28 PM, python help required
19aada...@gmail.com wrote:
 def penultimatePatch():

 win = GraphWin(Patch1,(100), 100)
 amountOfCircles = 5

 #Filled Red Circles
 fillCircle = Circle(Point(20,20)+100/amountOfCircles)
 fillCircle.draw(win)
 fillCircle.setFill(red)

 #Verticle white rectangles
 rectangleVerticle1 = Rectangle(Point(0,0), Point(10,100))
 rectangleVerticle1.setFill(white)
 rectangleVerticle1.setOutline(white)
 rectangleVerticle1.draw(win)

The above, and all below should be put in a function like so:

def rectangle_function(rectangle_name, Point(0,0), Point(10,100)):
 #Verticle white rectangles
rectangle_name = Rectangle(Point(0,0), Point(10,100))
rectangle_name.setFill(white)
rectangle_name.setOutline(white)
rectangle_name.draw(win)

 rectangleVerticle2 = Rectangle(Point(41,0), Point(51,100))
 rectangleVerticle2.setFill(white)
 rectangleVerticle2.setOutline(white)
 rectangleVerticle2.draw(win)

 rectangleVerticle3 = Rectangle(Point(81,0), Point(91,100))
 rectangleVerticle3.setFill(white)
 rectangleVerticle3.setOutline(white)
 rectangleVerticle3.draw(win)

 #Horizontal white rectangles
 rectangleHorizontal = Rectangle(Point(21,11), Point(41,21))
 rectangleHorizontal.setFill(white)
 rectangleHorizontal.setOutline(white)
 rectangleHorizontal.draw(win)

 rectangleHorizontal = Rectangle(Point(61,11), Point(81,21))
 rectangleHorizontal.setFill(white)
 rectangleHorizontal.setOutline(white)
 rectangleHorizontal.draw(win)

 rectangleHorizontal = Rectangle(Point(21,31), Point(51,41))
 rectangleHorizontal.setFill(white)
 rectangleHorizontal.setOutline(white)
 rectangleHorizontal.draw(win)

 rectangleHorizontal = Rectangle(Point(81,31), Point(61,41))
 rectangleHorizontal.setFill(white)
 rectangleHorizontal.setOutline(white)
 rectangleHorizontal.draw(win)

 rectangleHorizontal = Rectangle(Point(21,51), Point(51,61))
 rectangleHorizontal.setFill(white)
 rectangleHorizontal.setOutline(white)
 rectangleHorizontal.draw(win)

 rectangleHorizontal = Rectangle(Point(61,51), Point(91,61))
 rectangleHorizontal.setFill(white)
 rectangleHorizontal.setOutline(white)
 rectangleHorizontal.draw(win)

 rectangleHorizontal = Rectangle(Point(21,71), Point(51,81))
 rectangleHorizontal.setFill(white)
 rectangleHorizontal.setOutline(white)
 rectangleHorizontal.draw(win)

 rectangleHorizontal = Rectangle(Point(61,71), Point(81,81))
 rectangleHorizontal.setFill(white)
 rectangleHorizontal.setOutline(white)
 rectangleHorizontal.draw(win)

 rectangleHorizontal = Rectangle(Point(21,91), Point(51,100))
 rectangleHorizontal.setFill(white)
 rectangleHorizontal.setOutline(white)
 rectangleHorizontal.draw(win)

 rectangleHorizontal = Rectangle(Point(61,91), Point(91,100))
 rectangleHorizontal.setFill(white)
 rectangleHorizontal.setOutline(white)
 rectangleHorizontal.draw(win)

 #Outlined Red circles
 fillCircle = Circle(Point(20,20)+100/amountOfCircles)
 fillCircle.draw(win)
 fillCircle.setOutline(red)

 it is supposed to create this design http://i.stack.imgur.com/2dfGi.jpg
 --
 https://mail.python.org/mailman/listinfo/python-list

What results did you get?  If you get a traceback, copy it completely
and paste it in your response.





-- 
Joel Goldstick
http://joelgoldstick.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cherrypy - prevent browser prefetch?

2014-12-02 Thread Nobody
On Mon, 01 Dec 2014 11:28:42 -0900, Israel Brewster wrote:

 I'm running to a problem, specifically from
 Safari on the Mac, where I start to type a URL, and Safari auto-fills the
 rest of a random URL matching what I started to type, and simultaneously
 sends a request for that URL to my server, occasionally causing unwanted
 effects.

A GET request should not cause *any* effects. That's what PUT/POST are
for.

GET is for retrieval, not modification.

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


Re: How about some syntactic sugar for __name__ == '__main__' ?

2014-12-02 Thread Cameron Simpson

On 02Dec2014 02:17, Ethan Furman et...@stoneleaf.us wrote:

On 12/01/2014 05:15 PM, Chris Angelico wrote:

On Tue, Dec 2, 2014 at 11:45 AM, Ethan Furman wrote:
Put the above somewhere in your path (e.g. /usr/local/bin), make it 

executable, and then instead of shebanging your

scripts with `/usr/local/bin/python` you can use `/usr/local/bin/py_main`, 
which will load and execute the script,
calling script.main as its last act.


Be aware that this trick (shebanging to a script rather than a binary)
isn't specified by the POSIX standard. It works on Linux, but I don't
know about other systems.


Ah, thanks for that!


I'm pretty sure I've used systems where you could not shebang to a script.  
Solaris IIRC. Several years ago, might not be an issue on modern releases.


Cheers,
Cameron Simpson c...@zip.com.au

For reading rec.moto, I use one of those carbon-fiber Logitech mice w/a
little 'No Fear' sticker on it. - Mike Hardcore DoD#5010 mo...@netcom.com
 Apologies to Primus
--
https://mail.python.org/mailman/listinfo/python-list


Re: Proposed new conditional operator: or else

2014-12-02 Thread Andrea D'Amore

On 2014-12-02 17:41:06 +, Zachary Ware said:


foo == 42 or else



Never going to happen, but I like it!  Perhaps raise IntimidationError
instead of AssertionError when it fails?


That should probably be a DONTPANICError in large, friendly terminal 
font letters.


--
Andrea

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


Re: Cherrypy - prevent browser prefetch?

2014-12-02 Thread John Gordon
In pan.2014.12.02.21.05.18.838000@nowhere.invalid Nobody 
nobody@nowhere.invalid writes:

 On Mon, 01 Dec 2014 11:28:42 -0900, Israel Brewster wrote:

  I'm running to a problem, specifically from
  Safari on the Mac, where I start to type a URL, and Safari auto-fills the
  rest of a random URL matching what I started to type, and simultaneously
  sends a request for that URL to my server, occasionally causing unwanted
  effects.

 A GET request should not cause *any* effects. That's what PUT/POST are
 for.

 GET is for retrieval, not modification.

GET shouldn't cause any business data modifications, but I thought it
was allowed for things like logging out of your session.

-- 
John Gordon Imagine what it must be like for a real medical doctor to
gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'.

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


Parsing XML Using XPATH for Python

2014-12-02 Thread Uzoma Ojemeni
I am new to Python - a few days old - and I would appreciate some help.

I want write a python code to parse the below XML as below:-

ServingCell--NeighbourCell
L41_NBR3347_1--L41_NBR3347_2
L41_NBR3347_1--L41_NBR3347_3
L41_NBR3347_1--L41_NBR3349_1
L41_NBR3347_1--L41_NBREA2242_1

LteCell id=L41_NBR3347_1
 attributes
  absPatternInfoTddunset//absPatternInfoTdd
  additionalSpectrumEmission1/additionalSpectrumEmission
  additionalSpectrumEmissionListunset//additionalSpectrumEmissionList
  LteSpeedDependentConf id=0   
attributes
 tReselectionEutraSfHighlDot0/tReselectionEut
 tReselectionEutraSfMediumlDot0/tReselectionE
/attributes   
   /LteSpeedDependentConf 
   LteNeighboringCellRelation id=L41_NBR3347_2  
attributes
 absPatternInfounset//absPatternInfo  
   /LteNeighboringCellRelation
   LteNeighboringCellRelation id=L41_NBR3347_3  
attributes
 absPatternInfounset//absPatternInfo  
   /LteNeighboringCellRelation
   LteNeighboringCellRelation id=L41_NBR3349_1  
attributes
 absPatternInfounset//absPatternInfo
   /LteNeighboringCellRelation
   LteNeighboringCellRelation id=L41_NBREA2242_1
attributes
 absPatternInfounset//absPatternInfo  
 absPatternInfoTddunset//absPatternInfoTdd
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cherrypy - prevent browser prefetch?

2014-12-02 Thread random832
On Tue, Dec 2, 2014, at 10:59, Israel Brewster wrote:
 Primary because they aren’t forms, they are links. And links are, by
 definition, GET’s. That said, as I mentioned in earlier replies, if using
 a form for a simple link is the Right Way to do things like this, then I
 can change it.

As I understand it, the usual way to do this these days is to have a
link which, A) when navigated to, provides a simple standalone form
confirming the action with a button and B) when clicked on with a
browser with javascript enabled, automatically submits a hidden form, or
an AJAX/JSON request or something, to accomplish the same task skipping
the standalone page entirely. This will also have the effect of keeping
these entries out of your browser history.

Any action which has harmful or annoying side effects should definitely
not be a GET.
-- 
https://mail.python.org/mailman/listinfo/python-list


UK Python Training Day

2014-12-02 Thread Steve Holden
Are you interested in Python training for yourself or others? Can you get to 
London on 9 December, 2014? If so I would very much like to meet you, and have 
reserved a venue in Westminster with refreshments and lunch.

Starting in 2015 I plan to do more training in Europe (initially in the UK) and 
so would like to discuss the kind of Python training that will be most 
effective in those markets. The event starts at 10:00 am and runs until 4:40 
pm. If you would like to attend for lunch then reservations are required, and 
are otherwise helpful. Please sign up at

  https://www.eventbrite.com/e/uk-python-training-day-tickets-14720737121

regards
 Steve
-- 
Steve Holden st...@holdenweb.com +1 571 484 6266 @holdenweb



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


Re: python 2.7 and unicode (one more time)

2014-12-02 Thread Simon Evans

Hi Peter Otten
re:

There is no assignment 

soup_atag = whatever 

but there is one to atag. The whole session should when you omit the 
offending line 

 atag = soup_atag.a 

or insert 

soup_atag = soup 

before it. 

Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win
32
Type help, copyright, credits or license for more information.
 import urllib2
 from bs4 import BeautifulSoup
 html_atag = htmlbodypTest html a tag example/p
... a href=http://www.packtpub.com'Home/a
... a href=http;//www.packtpub.com/books'.Books/a
... /body
... /html
 soup = BeautifulSoup(html_atag,'lxml')
 atag = soup.aprint(atag)
 atag = soup.a
 print(atag)
a href=http://www.packtpub.com'gt;Homelt;/agt;
lt;a href= http=
/a
 type(atag)
class 'bs4.element.Tag'
 tagname = atag.name
 print tagname
a
 atag.name = 'p'
 print (soup)
htmlbodypTest html a tag example/p
p href=http://www.packtpub.com'gt;Homelt;/agt;
lt;a href= http=
/p/body
/html
 atag.name = 'p'
 print(soup)
htmlbodypTest html a tag example/p
p href=http://www.packtpub.com'gt;Homelt;/agt;
lt;a href= http=
/p/body
/html
 atag.name = 'a'
 print(soup)
htmlbodypTest html a tag example/p
a href=http://www.packtpub.com'gt;Homelt;/agt;
lt;a href= http=
/a/body
/html
 soup_atag = soup
 atag = soup_atag.a
 print (atag['href'])
http://www.packtpub.com'Home/a
a href=


Thank you.
Yours
Simon.

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


Re: Parsing XML Using XPATH for Python

2014-12-02 Thread John Gordon
In a1a70942-6740-4de5-b41e-57a71fb36...@googlegroups.com Uzoma Ojemeni 
uojem...@gmail.com writes:

 I am new to Python - a few days old - and I would appreciate some help.

 I want write a python code to parse the below XML as below:-

 ServingCell--NeighbourCell
 L41_NBR3347_1--L41_NBR3347_2
 L41_NBR3347_1--L41_NBR3347_3
 L41_NBR3347_1--L41_NBR3349_1
 L41_NBR3347_1--L41_NBREA2242_1

 LteCell id=L41_NBR3347_1
  attributes
   absPatternInfoTddunset//absPatternInfoTdd
   additionalSpectrumEmission1/additionalSpectrumEmission
   additionalSpectrumEmissionListunset//additionalSpectrumEmissionList
   LteSpeedDependentConf id=0   
 attributes
  tReselectionEutraSfHighlDot0/tReselectionEut
  tReselectionEutraSfMediumlDot0/tReselectionE
 /attributes   
/LteSpeedDependentConf 
LteNeighboringCellRelation id=L41_NBR3347_2  
 attributes
  absPatternInfounset//absPatternInfo  
/LteNeighboringCellRelation
LteNeighboringCellRelation id=L41_NBR3347_3  
 attributes
  absPatternInfounset//absPatternInfo  
/LteNeighboringCellRelation
LteNeighboringCellRelation id=L41_NBR3349_1  
 attributes
  absPatternInfounset//absPatternInfo
/LteNeighboringCellRelation
LteNeighboringCellRelation id=L41_NBREA2242_1
 attributes
  absPatternInfounset//absPatternInfo  
  absPatternInfoTddunset//absPatternInfoTdd

In plain English, it looks like you want to do this:

1. Print a header.
2. For each LteCell element:
3. Find the child attributes element.
4. For each child LteNeighboringCellRelation element:
5. Print the id attributes of the LteCell element and the
   LteNeighboringCellRelation element.

Translated to python, that would look something like this:

# import the xml library code
import xml.etree.ElementTree as ET

# load your XML file
tree = ET.parse('cells.xml')

# get the root element
root = tree.getroot()

# print a header
print(ServingCell--NeighbourCell)

# find each LteCell child element
for serving_cell in root.findall('LteCell'):

   # find the attributes child element
   attributes = serving_cell.find('attributes')

   # find each LteNeighboringCellRelation child element
   for neighbor in attributes.findall('LteNeighboringCellRelation'):

   # print the id's of the serving and neighbor cells
   print(%s--%s % (serving_cell.attrib['id'], neighbor.attrib['id']))

-- 
John Gordon Imagine what it must be like for a real medical doctor to
gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'.


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


Python 2.x vs 3.x survey - new owner?

2014-12-02 Thread Dan Stromberg
Last year in late December, I did a brief, 9 question survey of 2.x vs
3.x usage.

I like the think the results were interesting, but I don't have the
spare cash to do it again this year.  I probably shouldn't have done
it last year.  ^_^

Is anyone interested in taking over the survey?  It's on SurveyMonkey.

It was mentioned last year, that it might be interesting to see how
things change, year to year.  It was also reported that some people
felt that late December wasn't necessarily the best time of year to do
the survey, as a lot of people were on vacation.

The Python wiki has last year's results:
https://wiki.python.org/moin/2.x-vs-3.x-survey
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Proposed new conditional operator: or else

2014-12-02 Thread Sturla Molden
Zachary Ware zachary.ware+pyl...@gmail.com wrote:
 On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith r...@panix.com wrote:
 Wouldn’t it be neat to write:
 
foo == 42 or else
 
 and have that be an synonym for:
 
 assert foo == 42
 
 :-)
 
 Never going to happen, but I like it!  Perhaps raise IntimidationError
 instead of AssertionError when it fails?

I guess the or else statement should do this:

   condition or else threat

where the statement threat is executed if the statement condition
evaluates to false.

In absence of an explicit threat

  condition or else

it should raise IntimidationError if condition evaluates to false false.

If condition evaluates to true it should just return conditon.



Sturla

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


Re: Proposed new conditional operator: or else

2014-12-02 Thread Roy Smith
In article mailman.16498.1417544472.18130.python-l...@python.org,
 Chris Angelico ros...@gmail.com wrote:

 On Wed, Dec 3, 2014 at 4:41 AM, Zachary Ware
 zachary.ware+pyl...@gmail.com wrote:
  On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith r...@panix.com wrote:
  Wouldn’t it be neat to write:
 
 foo == 42 or else
 
  and have that be an synonym for:
 
  assert foo == 42
 
  :-)
 
  Never going to happen, but I like it!  Perhaps raise IntimidationError
  instead of AssertionError when it fails?
 
 Definitely. That's what I first thought, when I saw the subject line.
 
 Additionally, whenever this construct is used, the yield statement
 (expression, whatever) will be redefined to yield to intimidation and
 make the statement true, whatever it takes. In the above example,
 yield would decide which out of foo and 42 is more amenable to
 change, and altering it to be equal to the other. (It may also find
 that == is the most amenable, and alter its definition such that foo
 and 42 become equal.)
 
 ChrisA

This could be handy in the field of forensic accounting.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Proposed new conditional operator: or else

2014-12-02 Thread Michael Torrie
On 12/02/2014 10:18 AM, Roy Smith wrote:
 In the process of refactoring some code, I serendipitously created what I 
 think is an essential new bit of Python syntax.  The “or else” statement.  I 
 ended up with:
 
 sites_string = args.sites or else self.config['sites']

But isn't that syntactically equivalent of this?

sites_string = args.sites or self.config['sites']

Seems to be what you're looking for with or else unless I
misunderstand what you're proposing.

Doing a bit of testing in the interpreter and I find that a combination
of Python's truthiness semantics and short-circuit evaluation seems to
give a consistent result. Consider:

'a word' or False = 'a word'
'a word' or True = 'a word'
False or 'a word' = 'a word'
True or 'a word' = True

Is this similar to what you'd expect with or else?


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


Python handles globals badly.

2014-12-02 Thread Skybuck Flying

Excuse is: bad programming style.

I don't need snot telling me how to program after 20 years of programming 
experience.


This is so far the only thing pissing me off in python.

Now I have to declare global in front of these variables every where I 
want to use em:


ShipAbilityDistributeShieldPower
ShipAbilityTargetWeaponsSubsystems
ShipAbilityTargetEnginesSubsystems
ShipAbilityTargetShieldsSubsystems
ShipAbilityTargetAuxiliarySubsystems

CapTactAbilityAttackPatternAlpha
CapTactAbilityFireOnMyMark
CapTactAbilityTacticalInitiative
CapTactAbilityGoDownFighting
CapTactAbilityTacticalFleet


CapEngAbilityRotateShieldFrequency
CapEngAbilityEPSPowerTransfer
CapEngAbilityNadionInversion
CapEngAbilityMiracleWorker
CapEngAbilityEngineeringFleet


CapSciAbilitySensorScan
CapSciAbilitySubnucleonicBeam
CapSciAbilityScatteringField
CapSciAbilityPhotonicFleet
CapSciAbilityScienceFleet


CapSharedAbilityEvasiveManeuvers
CapSharedAbilityBraceForImpact
CapSharedAbilityRammingSpeed
CapSharedAbilityAbandonShip
CapSharedAbilityFleetSupport

BoffTactAbilityBeamArrayFireAtWill
BoffTactAbilityBeamArrayOverload
BoffTactAbilityTacticalTeam
BoffTactAbilityTorpedoHighYield
BoffTactAbilityTorpedoSpread
BoffTactAbilityTargetWeaponsSubsystems
BoffTactAbilityTargetEnginesSubsystems
BoffTactAbilityTargetShieldsSubsystems
BoffTactAbilityTargetAuxiliarySubsystems
BoffTactAbilityAttackPatternBeta
BoffTactAbilityAttackPatternDelta
BoffTactAbilityCannonRapidFire
BoffTactAbilityCannonScatterVolley
BoffTactAbilityDispersalPatternAlpha
BoffTactAbilityDispersalPatternBeta
BoffTactAbilityAttackPatternOmega


BoffEngAbilityEmergencyPowerToAuxiliary
BoffEngAbilityEmergencyPowerToWeapons
BoffEngAbilityEmergencyPowerToEngines
BoffEngAbilityEmergencyPowerToShields
BoffEngAbilityEngineeringTeam
BoffEngAbilityAuxiliaryToBattery
BoffEngAbilityAuxiliaryToDampeners
BoffEngAbilityAuxiliaryToStructural
BoffEngAbilityBoardingParty
BoffEngAbilityDirectedEnergyModulation
BoffEngAbilityExtendShields
BoffEngAbilityReverseShieldPolarity
BoffEngAbilityAcetonBeam
BoffEngAbilityEjectWarpPlasma


BoffSciAbilityHazardEmitters
BoffSciAbilityJamSensors
BoffSciAbilityMaskEnergySignature
BoffSciAbilityPolarizeHull
BoffSciAbilityScienceTeam
BoffSciAbilityTachyonBeam
BoffSciAbilityTractorBeam
BoffSciAbilityTransferShieldStrength
BoffSciAbilityChargedParticleBurst
BoffSciAbilityEnergySiphon
BoffSciAbilityFeedbackPulse
BoffSciAbilityPhotonicOfficer
BoffSciAbilityTractorBeamRepulsors
BoffSciAbilityScrambleSensors
BoffSciAbilityTykensRift
BoffSciAbilityGravityWell
BoffSciAbilityPhotonicShockwave
BoffSciAbilityViralMatrix

SpaceSetAbilityAssimilatedBorgTechnologyTractorBeam
SpaceSetAbilityRomulanSingularityHarnessPlasmaHyperflux
SpaceSetAbilityNukaraStrikeforceTechnologiesUnstableTetryonLattice

UniConAbilityPhotonicShockwaveTorpedo
UniConAbilityTholianWeb
UniConAbilityBattleModule3000BattleMode
UniConAbilityBattleModule3000SwarmMissiles
UniConAbilitySubspaceRupture
UniConAbilityTholianTetryonGrid
UniConAbilityIsometricCharge
UniConAbilitySpatialChargeLauncher
UniConAbilityAcetonAssimilator
UniConAbilitySabotageProbeLauncher
UniConAbilityRepairPlatform
UniConAbilityProjectedSingularity

RepNukAbilityTetryonCascade

InvAbilitiesNimbusPirateDistressCall

CarrierAbilityPetAttackMode

PetAbilityLaunchEliteTholianMeshWeavers
PetAbilityLaunchAdvancedObeliskSwarmers
PetAbilityLaunchEliteScorpionFighters

SingCoreAbilityPlasmaShockwave
SingCoreAbilityQuantumAbsorption

WarpCoreShieldCapacitator

KlingonCaptAbilityBattleCloak 


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


Re: Python handles globals badly.

2014-12-02 Thread Chris Angelico
On Wed, Dec 3, 2014 at 1:27 PM, Skybuck Flying skybuck2...@hotmail.com wrote:
 I don't need snot telling me how to program after 20 years of programming
 experience.

 This is so far the only thing pissing me off in python.

 Now I have to declare global in front of these variables every where I
 want to use em:

Well, I'm not snot, and I also have 20+ years' programming
experience... and I'm telling you that using that many globals is a
poor way to write code. Especially having so many separate, but
related, variables. If your two decades' experience were at all like
mine, you'll have worked with quite a lot of languages, and you'll
know to code to a language's strengths rather than fighting against
it. On the other hand, if you've been working with one language for
twenty years, then maybe you'd do better to stick to it than to try to
learn something new. But either way, don't expect Python to behave
like insert other language here, because if it did, what would be
the point of having both?

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


RE: Python handles globals badly.

2014-12-02 Thread Clayton Kirkwood
You're still young, enjoy your youth while you can.

-Original Message-
From: Python-list [mailto:python-list-
bounces+crk=godblessthe...@python.org] On Behalf Of Skybuck Flying
Sent: Tuesday, December 02, 2014 6:28 PM
To: python-list@python.org
Subject: Python handles globals badly.

Excuse is: bad programming style.

I don't need snot telling me how to program after 20 years of
programming experience.

This is so far the only thing pissing me off in python.

Now I have to declare global in front of these variables every where I
want to use em:

ShipAbilityDistributeShieldPower
ShipAbilityTargetWeaponsSubsystems
ShipAbilityTargetEnginesSubsystems
ShipAbilityTargetShieldsSubsystems
ShipAbilityTargetAuxiliarySubsystems

CapTactAbilityAttackPatternAlpha
CapTactAbilityFireOnMyMark
CapTactAbilityTacticalInitiative
CapTactAbilityGoDownFighting
CapTactAbilityTacticalFleet


CapEngAbilityRotateShieldFrequency
CapEngAbilityEPSPowerTransfer
CapEngAbilityNadionInversion
CapEngAbilityMiracleWorker
CapEngAbilityEngineeringFleet


CapSciAbilitySensorScan
CapSciAbilitySubnucleonicBeam
CapSciAbilityScatteringField
CapSciAbilityPhotonicFleet
CapSciAbilityScienceFleet


CapSharedAbilityEvasiveManeuvers
CapSharedAbilityBraceForImpact
CapSharedAbilityRammingSpeed
CapSharedAbilityAbandonShip
CapSharedAbilityFleetSupport

BoffTactAbilityBeamArrayFireAtWill
BoffTactAbilityBeamArrayOverload
BoffTactAbilityTacticalTeam
BoffTactAbilityTorpedoHighYield
BoffTactAbilityTorpedoSpread
BoffTactAbilityTargetWeaponsSubsystems
BoffTactAbilityTargetEnginesSubsystems
BoffTactAbilityTargetShieldsSubsystems
BoffTactAbilityTargetAuxiliarySubsystems
BoffTactAbilityAttackPatternBeta
BoffTactAbilityAttackPatternDelta
BoffTactAbilityCannonRapidFire
BoffTactAbilityCannonScatterVolley
BoffTactAbilityDispersalPatternAlpha
BoffTactAbilityDispersalPatternBeta
BoffTactAbilityAttackPatternOmega


BoffEngAbilityEmergencyPowerToAuxiliary
BoffEngAbilityEmergencyPowerToWeapons
BoffEngAbilityEmergencyPowerToEngines
BoffEngAbilityEmergencyPowerToShields
BoffEngAbilityEngineeringTeam
BoffEngAbilityAuxiliaryToBattery
BoffEngAbilityAuxiliaryToDampeners
BoffEngAbilityAuxiliaryToStructural
BoffEngAbilityBoardingParty
BoffEngAbilityDirectedEnergyModulation
BoffEngAbilityExtendShields
BoffEngAbilityReverseShieldPolarity
BoffEngAbilityAcetonBeam
BoffEngAbilityEjectWarpPlasma


BoffSciAbilityHazardEmitters
BoffSciAbilityJamSensors
BoffSciAbilityMaskEnergySignature
BoffSciAbilityPolarizeHull
BoffSciAbilityScienceTeam
BoffSciAbilityTachyonBeam
BoffSciAbilityTractorBeam
BoffSciAbilityTransferShieldStrength
BoffSciAbilityChargedParticleBurst
BoffSciAbilityEnergySiphon
BoffSciAbilityFeedbackPulse
BoffSciAbilityPhotonicOfficer
BoffSciAbilityTractorBeamRepulsors
BoffSciAbilityScrambleSensors
BoffSciAbilityTykensRift
BoffSciAbilityGravityWell
BoffSciAbilityPhotonicShockwave
BoffSciAbilityViralMatrix

SpaceSetAbilityAssimilatedBorgTechnologyTractorBeam
SpaceSetAbilityRomulanSingularityHarnessPlasmaHyperflux
SpaceSetAbilityNukaraStrikeforceTechnologiesUnstableTetryonLattice

UniConAbilityPhotonicShockwaveTorpedo
UniConAbilityTholianWeb
UniConAbilityBattleModule3000BattleMode
UniConAbilityBattleModule3000SwarmMissiles
UniConAbilitySubspaceRupture
UniConAbilityTholianTetryonGrid
UniConAbilityIsometricCharge
UniConAbilitySpatialChargeLauncher
UniConAbilityAcetonAssimilator
UniConAbilitySabotageProbeLauncher
UniConAbilityRepairPlatform
UniConAbilityProjectedSingularity

RepNukAbilityTetryonCascade

InvAbilitiesNimbusPirateDistressCall

CarrierAbilityPetAttackMode

PetAbilityLaunchEliteTholianMeshWeavers
PetAbilityLaunchAdvancedObeliskSwarmers
PetAbilityLaunchEliteScorpionFighters

SingCoreAbilityPlasmaShockwave
SingCoreAbilityQuantumAbsorption

WarpCoreShieldCapacitator

KlingonCaptAbilityBattleCloak

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



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


Re: Python handles globals badly.

2014-12-02 Thread Michael Torrie
On 12/02/2014 07:27 PM, Skybuck Flying wrote:
 Excuse is: bad programming style.
 
 I don't need snot telling me how to program after 20 years of programming 
 experience.
 
 This is so far the only thing pissing me off in python.
 
 Now I have to declare global in front of these variables every where I 
 want to use em:

Only if you want to overwrite them, though.  Python has support for any
number of programming paradigms.  That many global variables is
screaming for some kind of organization and Python has good mechanisms
for doing this in a much neater way. Might I suggest you use a namespace
instead?  Put all your globals in a module, and refer to them via the
module.  For example (converting to pep8 which looks better to me):

import globals as g

def some_func():
   g.ship_ability_distribute_shield_power = 5

A whole lot cleaner than trying to use the global keyword everywhere.

If you've really been programming for 20 years, surely you're familiar
with programming patterns.  The fact that you have 6 variables all
prefixed with ShipAbility should suggest something to you. Like maybe
all of these attributes could be encapsulated in one ship object.
Python is very flexible in how you use objects.  You can program in
strict java-style if you want, or adopt a more freeform approach:

ship = object()
ship.ability = object()
ship.ability.distribute_shield_power = 5
etc.


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


Re: Python handles globals badly.

2014-12-02 Thread Ben Finney
Skybuck Flying skybuck2...@hotmail.com writes:

 I don't need snot telling me how to program after 20 years of
 programming experience.

If you've already determined what advice you do or do not need, then
you're welcome to solve your problems by yourself.

We'll be here when you decide it's time to humble yourself to the point
where you can ask for advice without assuming you already know best.

-- 
 \   “But Marge, what if we chose the wrong religion? Each week we |
  `\  just make God madder and madder.” —Homer, _The Simpsons_ |
_o__)  |
Ben Finney

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


Re: Python handles globals badly.

2014-12-02 Thread Skybuck Flying

Meanwhile...

I modified my code, and added these globals in front of it.

It didn't take too long to do.

But it did add something like 300 unnecessary lines of code, which is what 
kinda annoys me.


I'd like to keep my code compact.

Anyway I double checked to make sure other routines had global for other 
variables as well.


Perhaps I made some programming mistakes which went unnoticed because of 
smart code handling optimizations and such.


But because the global was omitted perhaps those optimizations never kicked 
in.


I am not completely sure, but so far my bot seems to run real fast.

Personally I do not like the way global works in python... it sucks quite 
bad, because it's confusing and inconsistent as hell and it doesn't do 
anything usefull example:


a = 1

def Test()
   if a == 1:
   print hello
   return

a can still be accessed by Test, so this makes it highly confusing ?!

Should global be added to a or not ?!

This creates doubts among the programmers.

Was a perhaps maybe initialized or not ?

What is it's contents ?

The lack of a debugger in Sikuli makes this problem much worse.

Only way to know for sure would be to print debug logs of variables which 
would get a bit excessive to do always, but I guess in case of doubt perhaps 
it could be done temporarely, however this additional paranoid checking 
does waste some programmer time.


Therefore enough reasons for me not to like this... it's weird/akward.

I hope python one day gets rid of it;

1. To stop the confusion.
2. To stop the doubt.
3. To stop the wasted lines.
4. To program with more confidence.
5. To stop to have to inspect what's going on if one wants to know for sure.
6. To stop any weird programming mistakes because a global declaration was 
not used somewhere in a function, it's probably easier to miss, cause in the 
programmers mind he's thinking: it's global.


Now it's just some 
half-ass-fucked-up-not-really-global-variable-unless-you-specify-it-local-to-be-global-holy-shit-batman-feel-the-brain-pain 
?!


Bye,
 Skybuck. 


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


Re: Python handles globals badly.

2014-12-02 Thread Skybuck Flying

Some issues I'd like to address to you:

1. Structured programming requires more programming time.
2. Structured programming implies structure which might be less flexible.
3. Python objects require self keyword to be used everywhere, and other 
akwardness wich leads to more typing/programming/writing time.


I used the list feature of python to dump these variable in a list so that 
all variables can be processed by a while loop and so forth.


At first I wanted flexibility and all variables were individually logic-ed 
/ processed but this became too much code to work with.


I was also under the impression using many ifs might be faster than lists, 
but this was bogus information at best.


I wrote a simple short benchmark for if vs list and list performed fast 
enough for my purposes, it could both handle 500k of items without breaking 
a sweat, meaning within 1 to 3 seconds or so.


I am still new at python and definetly don't feel comfortable with the 
object feature, though I did use it for these variables which are actually 
objects.


I used to program in Delphi, there I would do everything OO and modular.

However python feels more like a script language and I am enjoying it quite 
a lot.


I try not to get entangled into all kinds of structuring which leads to 
much time wasted.


Though sometimes it can also gain some time.

Lastly I also don't like the module approach in python because the sikuli 
ide doesn't really support working with multiple files that well.


Even if it did, having all code in one big file is a pretty big adventage.

This allow me to see the code every day I work on it, and think about how to 
improve the code further, making it faster, more reliable, shorter, and so 
forth.


And it also offers a lot of flexibility and time savings.

No need to search in what file, what was located.

Python also comes with nice libaries/lists/dictionaries/file io etc.. all 
easy to use...


I haven't tried networking with python yet... that could be funny to try 
next for my bots :)


Anyway this global thing made my doubt if python is a good thing... all in 
all it wasn't too bad...


Though I do hope to see a programming language some day, that is aimed at 
more mature programmers that know what they are doing.


Instead of a language aimed at noobs :) a noob language which forbids 
certain styles of programming because it would be bad.


There is a word for it in dutch: beteutelend I am not sure what the word 
is in english but it's a bit like childesh


So features I miss in python are: labels goto statements and repeat 
until.


Funny thing is these goto statements would be very handy for bot 
programming, so it's a painfull feature to miss.


Also as already pointed out above structure programming has disadventages as 
well. I'd like to see other languages which focus at more flexibility 
instead of structure.


Python is already a nice step towards more flexiblity, for example it's 
auto-type feature is nice, it can detect if a variable is an integer, string 
or object.


Bye,
 Skybuck. 


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


Re: Python handles globals badly.

2014-12-02 Thread Chris Angelico
On Wed, Dec 3, 2014 at 3:17 PM, Skybuck Flying skybuck2...@hotmail.com wrote:
 I hope python one day gets rid of it;

 1. To stop the confusion.
 2. To stop the doubt.
 3. To stop the wasted lines.
 4. To program with more confidence.
 5. To stop to have to inspect what's going on if one wants to know for sure.
 6. To stop any weird programming mistakes because a global declaration was
 not used somewhere in a function, it's probably easier to miss, cause in the
 programmers mind he's thinking: it's global.

 Now it's just some
 half-ass-fucked-up-not-really-global-variable-unless-you-specify-it-local-to-be-global-holy-shit-batman-feel-the-brain-pain
 ?!


If you want C-like infinitely nested scopes, you basically have to
have declared variables, which Python doesn't want. There are other
languages which are very Python-like but do have declared variables
and infinitely-nested scopes, but I'm not sure I want to deal with
this kind of anger on another mailing list, so I won't name one. Once
again, though, you need to (a) learn the language before getting
irate, and (b) play to its strengths, not its weaknesses. Python's
requirement to declare all globals is a major weakness when you have
hundreds of globals, so don't do that (or don't complain about how
your code looks when you do).

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


Re: Python handles globals badly.

2014-12-02 Thread Chris Angelico
On Wed, Dec 3, 2014 at 3:32 PM, Skybuck Flying skybuck2...@hotmail.com wrote:
 Though I do hope to see a programming language some day, that is aimed at
 more mature programmers that know what they are doing.

 Instead of a language aimed at noobs :) a noob language which forbids
 certain styles of programming because it would be bad.

If you want assembly language, you know where to find it.

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


Re: Python handles globals badly.

2014-12-02 Thread Dave Angel

On 12/02/2014 11:32 PM, Skybuck Flying wrote:

Some issues I'd like to address to you:

1. Structured programming requires more programming time.
2. Structured programming implies structure which might be less flexible.
3. Python objects require self keyword to be used everywhere, and
other akwardness wich leads to more typing/programming/writing time.

I used the list feature of python to dump these variable in a list so
that all variables can be processed by a while loop and so forth.


Care to share what you mean by the list feature?  Perhaps you'd do 
better with the dict feature, or the attribute feature.




At first I wanted flexibility and all variables were individually
logic-ed / processed but this became too much code to work with.


No meaning without an example.



I was also under the impression using many ifs might be faster than
lists, but this was bogus information at best.


They do entirely different things.  Without example code, this statement 
is also meaningless to me.




I wrote a simple short benchmark for if vs list and list performed fast
enough for my purposes, it could both handle 500k of items without
breaking a sweat, meaning within 1 to 3 seconds or so.

I am still new at python and definetly don't feel comfortable with the
object feature, though I did use it for these variables which are
actually objects.


Everything in Python is an object, from ints to functions.  That makes 
lots of things easier and more symmetric.




I used to program in Delphi, there I would do everything OO and modular.


So why do you no longer want to do that?



Lastly I also don't like the module approach in python because the
sikuli ide doesn't really support working with multiple files that well.


So don't use modules.  Nothing about the language forces you to.  The 
main time you might need modules is when you write your second program. 
 Of course, it's nice that somebody else wrote lots of modules for you, 
the standard library, and PIPI.




Python also comes with nice libaries/lists/dictionaries/file io etc..
all easy to use...

I haven't tried networking with python yet... that could be funny to try
next for my bots :)

Anyway this global thing made my doubt if python is a good thing... all
in all it wasn't too bad...

You still haven't figured out that declaring the occasional global is 
much less typing than declaring every local.  If you're writing code 
that's mostly using globals, you probably should investigate the tens of 
thousands of other languages.




Though I do hope to see a programming language some day, that is aimed
at more mature programmers that know what they are doing.

Instead of a language aimed at noobs :) a noob language which forbids
certain styles of programming because it would be bad.


That's ridiculous.  Python is far from a noob language.  But when 
you're a noob, and can still get things accomplished, that's a good 
thing.  Then when you're ready to learn more about the language, asking 
non-confrontational questions might get you some help.


I suggest you learn enough about classes to understand how to make and 
utilize an object with arbitrary attributes.  Even if you did something 
as crude as:


class Dummy(object):
pass

global = Dummy()
global.ShipAbilityDistributeShieldPower = 42
global.ShipAbilityTargetWeaponsSubsystems = 12
...

You can then read and write those values inside functions with no global 
declarations at all.


def myfunc():
ifsomething:
global.ShipAbilityDistributeShieldPower = 2



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


Re: html page mail link to webmail program

2014-12-02 Thread Cameron Simpson

On 11Nov2014 17:35, Ethan Furman et...@stoneleaf.us wrote:

Okay, the explicit Python question:  Clicking on a mail link in a web browser 
can start an external program.  I would like that external program to be a 
Python script that: opens a new tab in the currently running browser (or a new 
default browser window), loads up the default web mail client (or one specified 
if there is no way to know/have a default), navigates to the compose pane (or 
starts there if possible), enters in the email address from the link that was 
passed to it, and, if not too much more, move the cursor to the subject field.

Surely this can be done in Python.


Yes and no. It is dependent on how much control GMail allows you from outside.

A quick web search on open gmail compose using url led me to this discussion:

 http://stackoverflow.com/a/8852679

which espouses this URL template:

 
https://mail.google.com/mail/?view=cmfs=1to=some...@example.comsu=SUBJECTbody=BODYbcc=someone.e...@example.com

which I have tested, and it works. It does require your browser to be logged 
into GMail already.


Given that, you just need a Python script that can be invoked as a standard 
browser external mail client accepting the mailto: URL from the browser. Decode 
the URL into to/subject/etc and then open the right URL using the above 
template.


As an exercise, I wrote a short shell script:

 https://bitbucket.org/cameron_simpson/css/src/tip/bin-cs/gmail

which I would invoke from a shell prompt as:

 gmail -s subject line here j...@blogs.com b...@ben.com ...

Adapting it to (a) Python (b) accept a mailto:URL and decoding its fields and 
(c) opening that URL from inside Python using the webbrowser module's:


 https://docs.python.org/3/library/webbrowser.html#module-webbrowser

open function I leave as an exercise for the reader. Should take less thatn 
an hour I'd hope.


Cheers,
Cameron Simpson c...@zip.com.au

Perhaps this morning there were only three Euclidean solids, but god changed
its mind retroactively at lunchtime, remaking the whole history of the
universe.  That's the way it is with omnipotent beings.
   - mi...@apple.com (Mikel Evins)
--
https://mail.python.org/mailman/listinfo/python-list


Re: Python handles globals badly.

2014-12-02 Thread Michael Torrie
On 12/02/2014 09:32 PM, Skybuck Flying wrote:
 Some issues I'd like to address to you:
 
 1. Structured programming requires more programming time.
 2. Structured programming implies structure which might be less flexible.
 3. Python objects require self keyword to be used everywhere, and other 
 akwardness wich leads to more typing/programming/writing time.

You forgot to mention that horrible white-space being syntax! Surely
that is inflexible and awkward!

 I used to program in Delphi, there I would do everything OO and modular.

Python allows you to explicitly use an OO paradigm if you wish, or use a
more procedural form, or functional form (to a degree anyway).  All the
while using and exploiting object-oriented characteristics (modules,
attributes, etc) throughout.  It's really the best of both worlds.

 Lastly I also don't like the module approach in python because the sikuli 
 ide doesn't really support working with multiple files that well.

A poor craftsman blames his tools for his own shortcomings.  I suggest
you change tools to something a little more flexible (just about
anything really)

 Even if it did, having all code in one big file is a pretty big adventage.

Not really.  Keeping things as simple as possible and modular is easier
to debug, easier to test, add features to, and easier to understand
three months from now.  I can tell by your opinions that you've never
done any medium to large-scale development before.

 So features I miss in python are: labels goto statements and repeat 
 until.

Python is newbie friendly (mostly), but it is a far, far more powerful,
capable, and expressive language than Delphi ever was.  Take a theory of
computer languages class some time (create your own language even...
Scheme is a good place to start).  It might open your eyes a lot.
Python is not just a scripting language, it's a powerful application
development language that allows me to create code rapidly that actually
works.  I'm far more productive in Python than in any language I've used
to date.

 
 Funny thing is these goto statements would be very handy for bot 
 programming, so it's a painfull feature to miss.

Haven't heard that argued in many years.  And I don't see how.  Python
has very powerful ways of dispatching execution including dictionaries
of functions, callable objects, etc.  Sounds like you're programming in
a very primitive way, reinventing many structures that Python already
has.  I know that some low-level C programming does rely on and use
goto, but in Python I've never needed it.

You're not the first person to not grasp Python fundamentals (such as
how variables work with name binding vs the Delphi idea of named boxes
that can actually be change; python variables can only be rebound to new
objects, unless you call a method on a mutable object), who ends up
fighting the language and being really frustrated with it.  Sounds like
you're trying to code Pascal (or some other language) in Python.  This
is going to be frustrating.  I suggest you learn what it means to code
in a Pythonic way and you'll find you are really productive and having
a lot of fun.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PyEval_GetLocals and unreferenced variables

2014-12-02 Thread Gregory Ewing

Kasper Peeters wrote:

I could in principle decide to make these settings a proper
Python object, and ask the user to create one and pass it along at
every C-function call.


I would make the C functions methods of the object holding
the settings. Your nested function example would then look
something like this:

  def fun():
cpp = Cpp()
cpp.set_some_flag()
cpp.cfun(...)
def fun2():
  cpp2 = Cpp(cpp)
  cpp2.set_some_other_flag()
  cpp2.fun(...)


Hence my question: how can I ask, purely on the C side, for Python to
pull objects into the local frame?


You can't.

Firstly, it's not possible to add locals to a frame that
didn't exist when the bytecode was compiled. The compiler
figures out how many locals there are, allocates them in
an array, and generates bytecodes that reference them by
their array index.

I'm not sure how you think you're adding a local from C
code. If you're using PyEval_GetLocals(), that only gives
you a dict containing a *copy* of the locals; modifying
that dict doesn't change the locals in the function's frame.

Secondly, the way references to outer scopes is implemented
is by effectively passing the referenced variables as
implicit parameters. If the bytecode of the nested function
doesn't reference a given variable in the outer function,
it doesn't get passed in. Again, this is determined when
the bytecode is compiled and can't be changed at run time.


Final note: I am actually trying to make this look as close as possible
to an older custom-built language, which didn't require passing the
settings object either, so it's kinda important to make the user feel
'at home'.


I doubt it's worth the extreme level of hackery that would
be required to make it work, though. I think it would be
better to provide a clean, pythonic API that makes the
scope of the options explicit, rather than try to mimic
another language's dubious implicit scoping features.

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


Re: PyEval_GetLocals and unreferenced variables

2014-12-02 Thread Gregory Ewing

Ned Batchelder wrote:

I would use thread locals for this: 
https://docs.python.org/2/library/threading.html#threading.local


You could get dynamic scoping that way, but the OP
seems to want lexical scoping.

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


Re: Need Help

2014-12-02 Thread Miki Tebeka
Greetings,

 I'm a beginner of python, I just want your help.
We'll gladly do it, however you need to invest some time and write better 
questions :) See http://www.catb.org/esr/faqs/smart-questions.html

 How can I get the Failure values from the Console in to a txt or a csv file?
We need more information. What is the test suite you're using? How are you 
running the tests? Example output ...

All the best,
--
Miki
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cherrypy - prevent browser prefetch?

2014-12-02 Thread Gregory Ewing

Israel Brewster wrote:

Primary because they aren’t forms, they are links. And links are, by
definition, GET’s. That said, as I mentioned in earlier replies, if using a
form for a simple link is the Right Way to do things like this, then I can
change it.


I'd look at it another way and say that an action with side
effects shouldn't appear as a simple link to the user. Links
are for requesting information; buttons are for triggering
actions.

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


Re: Python handles globals badly.

2014-12-02 Thread Marko Rauhamaa

 On 12/02/2014 09:32 PM, Skybuck Flying wrote:
 Some issues I'd like to address to you:
 
 1. Structured programming requires more programming time.
 2. Structured programming implies structure which might be less flexible.
 3. Python objects require self keyword to be used everywhere, and other 
 akwardness wich leads to more typing/programming/writing time.

 You forgot to mention that horrible white-space being syntax! Surely
 that is inflexible and awkward!

Hook...

 Lastly I also don't like the module approach in python because the sikuli 
 ide doesn't really support working with multiple files that well.

 A poor craftsman blames his tools for his own shortcomings.

... line...

 Funny thing is these goto statements would be very handy for bot 
 programming, so it's a painfull feature to miss.

 Haven't heard that argued in many years.  And I don't see how.

... and sinker.


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


Re: Parsing XML Using XPATH for Python

2014-12-02 Thread dieter
Uzoma Ojemeni uojem...@gmail.com writes:
...
One easy option would be to use the XPath support in the lxml
package -- provided you have not problem with the installation
of external libraries (libxml2 and libxslt) and C-extensions (lxml).

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


Re: Python handles globals badly.

2014-12-02 Thread Joel Goldstick
troll

On Wed, Dec 3, 2014 at 1:52 AM, Marko Rauhamaa ma...@pacujo.net wrote:

 On 12/02/2014 09:32 PM, Skybuck Flying wrote:
 Some issues I'd like to address to you:

 1. Structured programming requires more programming time.
 2. Structured programming implies structure which might be less flexible.
 3. Python objects require self keyword to be used everywhere, and other
 akwardness wich leads to more typing/programming/writing time.

 You forgot to mention that horrible white-space being syntax! Surely
 that is inflexible and awkward!

 Hook...

 Lastly I also don't like the module approach in python because the sikuli
 ide doesn't really support working with multiple files that well.

 A poor craftsman blames his tools for his own shortcomings.

 ... line...

 Funny thing is these goto statements would be very handy for bot
 programming, so it's a painfull feature to miss.

 Haven't heard that argued in many years.  And I don't see how.

 ... and sinker.


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



-- 
Joel Goldstick
http://joelgoldstick.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Proposed new conditional operator: or else

2014-12-02 Thread Sturla Molden
Dennis Lee Bieber wlfr...@ix.netcom.com wrote:

   foo == 42 or else
 
 
   Has a PERL stink to it... like: foo == 42 or die

I think this statement needs to take ellipsis as well

foo == 42 or else ...




Sturls

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


[issue22356] mention explicitly that stdlib assumes gmtime(0) epoch is 1970

2014-12-02 Thread Akira Li

Akira Li added the comment:

 Alexander Belopolsky added the comment:

 I've provide the direct quote from *C* standard ...

 I understand that C standard uses the word encoding, but it does so
 for a reason that is completely unrelated to the choice of epoch.
 Encoding is how the bytes in memory should be interpreted as number
 of seconds or some other notion of time.  For, example two's
 complement little-endian 32-bit signed int is an example of valid
 time_t encoding, another example would be IEEE 754 big-endian 64-bit
 double.  Note that these choices are valid for both C and POSIX
 standards.

I agree one *part* of encoding is how time_t is *represented* in
memory but it is not the only part e.g.:

  The mktime function converts the broken-down time, expressed as local
  time, in the structure pointed to by timeptr into a calendar time
  value with the same encoding as that of the values returned by the
  time function.

notice: the same encoding as ... returned by the time function.

time() function can return values with different epoch (implementation
defined). mktime() is specified to use the *same* encoding i.e., the
same epoch, etc.

i.e., [in simple words] we have calendar time (Gregorian date, time) and
we can convert it to a number (e.g., Python integer), we can call that
number seconds and we can represent that number as some (unspecified)
bit-pattern in C.

I consider the whole process of converting time to a bit-pattern in
memory as encoding i.e., 32/64, un/signed int/754 double is just
*part* of it e.g.,

1. specify that 1970-01-01T00:00:00Z is zero (0)
2. specify 0 has time_t type
3. specify how time_t type is represented in memory.

I may be wrong that C standard includes the first item in time
encoding.

 If you google for your phrase time in POSIX encoding, this issue is
 the only hit.  This strongly suggests that your choice of words is not
 the most natural.

I've googled the phrase (no surrounding quotes) and the links talk about
time encoded as POSIX time [1] and some *literally* contain the phrase
*POSIX encoding* [2] because *Python* documentation for calendar.timegm
contains it [3]:

  [timegm] returns the corresponding Unix timestamp value, assuming an
  epoch of 1970, and the POSIX encoding. In fact, time.gmtime() and
  timegm() are each others’ inverse.

In an effort to avoid personal influence, I've repeated the expreriment
using Tor browser and other search engines -- the result is the same.

timegm() documentation might be the reason why I've used the phrase.

I agree POSIX encoding might be unclear. The patch could be replaced
by any phrase that expresses that some functions in stdlib assume that
time.time() returns (+/- fractional part) seconds since the Epoch as
defined by POSIX [4].

[1] http://en.wikipedia.org/wiki/Unix_time#Encoding_time_as_a_number
[2] 
http://ruslanspivak.com/2011/07/20/how-to-convert-python-utc-datetime-object-to-unix-timestamp/
[3] https://docs.python.org/3/library/calendar.html#calendar.timegm
[4]
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_15

--

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



[issue22968] types._calculate_meta nit: isinstance != PyType_IsSubtype

2014-12-02 Thread Greg Turner

Greg Turner added the comment:

Also:

In types.prepare_class, here is what currently happens:

we let x be, in order of preference:
  (a) the explicitly given type if, one is given, else
  (b) type(bases[0]), if it exists, else
  (c) type

and then, if isinstance(x, type), we run _calculate_bases.

In python 2, I think something like this really does happen, although, perhaps 
isinstance(x, type) should have been issubclass(x, type) to correctly 
capture how python 2 does it.

In particular, I think we can stick a Callable in there as bases[0], and then 
any old crazy list of objects as base classes, and it will call our Callable, 
although if we don't do something about our crazy base classes, it will still 
break later (something like that... I don't remember exactly, except that the 
first base is definitely special somehow).

But in python 3, if I'm reading the C code correctly, I don't think the first 
base class receives any special handling, and the cpython-equivalent to 
_calculate_bases /always/ happens, suggesting that any non-descending-from-type 
metaclass is expected to have removed itself from the picture before type_new 
is invoked.

So maybe more minor re-factoring is needed to get it all straightened out.  My 
brain is kind of fried from looking at it, I'll try again later.

--

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



[issue20192] pprint chokes on set containing frozenset

2014-12-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

For now sets and frozensets are comparable with other types in Python 2.

 frozenset(xrange(10))  1
False
 set(xrange(10))  1
False

The only known to me uncomparable types in Python 2 are naive and aware 
datetime.

--
nosy: +serhiy.storchaka

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



[issue22931] cookies with square brackets in value

2014-12-02 Thread Waldemar Parzonka

Waldemar Parzonka added the comment:

Thanks for taking a look into that.

And yes the behaviour when invalid value is encountered is bit weird as the 
rest of the cookie is being silently ignored which is probably less than ideal 
in most cases.

Just wonder if there is any easy way of making the matching more aware as 
browsers may allow various things as cookie values I guess.

--

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



[issue12657] Cannot override JSON encoding of basic type subclasses

2014-12-02 Thread Stefan Champailler

Stefan Champailler added the comment:

I'm adding a scenario for this problem, a real life one, so it gives a bit more 
substance.

I use SQLALchemy. I do queries with it which returns KeyedTuples (an SQLALchemy 
type). KeyedTuples inherits from tuple. KeyedTuples are, in principle, like 
NamedTuple. I want to transmit the result of my queries over json. Since 
KeyedTuple inherit from tuple, json can't serialize them. Of course one might 
say that that problem is outside the scope of json. But if so, it means we have 
to first convert KeyedTuples to dict and then pass the dict to json. That's 
alot of copies to do... This problem is rather big because it affects my whole 
API (close to a hundred of functions)...

I've looked into the code and as noted above, one could replace 
'isinstance(x,tuple)' with 'type(x) == tuple'. But without knowledge of how 
many people use the flexibility introduced by isinstance, it's dangerous. We 
could also change the nature of default and say that default is called before 
any type checking in json (so default is not a 'default' anymore). We could 
also duplicate the default functionnality (so a function called before any type 
checks and then a default called if all type checks fail). But for these two 
last cases, I guess the difficulty is : how do we know the pre-type 'default' 
was applied correctly ?

Patching is not easy because, at least in my case, the C code path is taken = 
an easy patch (i.e. full python) would force me out of the C path which may be 
bad for performance (I didn't measure the difference between the 2 paths).

I see this bug is old and not much commented, should we conclude that nobody 
cares ? That'd a good news since it'd mean a patch wouldn't hurt many people :-)

--
nosy: +wiz21
versions: +Python 3.4

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



[issue22976] multiprocessing Queue empty() is broken on Windows

2014-12-02 Thread Radosław Szkodziński

New submission from Radosław Szkodziński:

multiprocessing.Queue.empty() uses pipe polling on Windows. Unfortunately, pipe 
semantics on windows are different from POSIX.

The result is either:
- Hang when one process tries to get() and another checks for empty()
- Falsely returning empty() == False despite nothing being possible to get - 
because the other process is actually trying to read from the queue.

The attached testcase demonstrates the first case, with main process hard 
hanging on my Python 2.7.8 (anaconda), 32-bit on Windows 7 64-bit. Whether 1 or 
2 happens depends on specific program flow.
Both can cause deadlocks in code that should be valid.

Note that get(block=False) actually works correctly.

It is possible that the problem is also present in Python 3.

--
components: Library (Lib), Windows
files: testmp.py
messages: 231984
nosy: Radosław.Szkodziński, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: multiprocessing Queue empty() is broken on Windows
versions: Python 2.7
Added file: http://bugs.python.org/file37342/testmp.py

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



[issue12657] Cannot override JSON encoding of basic type subclasses

2014-12-02 Thread Stefan Champailler

Stefan Champailler added the comment:

Reading bugs a bit, I see this is quite related to :

http://bugs.python.org/issue14886

stF

--

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



[issue12987] Demo/scripts/newslist.py has non-free licensing terms

2014-12-02 Thread Matthias Klose

Matthias Klose added the comment:

thanks for bringing this up. I don't agree that the non-availability in the 
windows build should be used to close the issue.  Linux distros distribute the 
source, and are still affected? If it's already removed in Python3, why not 
remove it here as well?

Anyway, I can repackage the sources for Debian/Ubuntu

--
nosy: +ncoghlan
status: closed - open

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



[issue22977] Unformatted “Windows Error 0x%X” exception message

2014-12-02 Thread Martin Panter

New submission from Martin Panter:

The following code generates a connection reset error on Wine (Windows 
emulator, because I don’t have actual Windows to test on). Probably only a 
minor issue, but the error message isn’t quite right:

 s = create_connection((localhost, 8181))
 # Server end accepts connection and then closes it
 s.sendall(b3 * 300) 
Traceback (most recent call last):
  File stdin, line 1, in module
ConnectionResetError: [WinError 10054] Windows Error 0x%X

I’m just guessing, but looking at Python/errors.c, there are two 
PyUnicode_FromFormat(Windows Error 0x%X, ...) calls. The documentation for 
that function says only a lower-case %x is supported, so that would explain the 
behaviour I am seeing.

--
components: Windows
messages: 231987
nosy: steve.dower, tim.golden, vadmium, zach.ware
priority: normal
severity: normal
status: open
title: Unformatted “Windows Error 0x%X” exception message
type: behavior
versions: Python 3.3

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



[issue22977] Unformatted “Windows Error 0x%X” exception message

2014-12-02 Thread STINNER Victor

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


--
keywords: +easy
nosy: +haypo

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



[issue16041] poplib: unlimited readline() from connection

2014-12-02 Thread Matthias Klose

Matthias Klose added the comment:

this looks ok to me, can we apply this for 2.7.9?

--
nosy: +doko

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



[issue16042] smtplib: unlimited readline() from connection

2014-12-02 Thread Matthias Klose

Changes by Matthias Klose d...@debian.org:


--
nosy: +doko

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



[issue16043] xmlrpc: gzip_decode has unlimited read()

2014-12-02 Thread Matthias Klose

Matthias Klose added the comment:

updated patch to use an optional parameter max_decode.

--
nosy: +doko
Added file: http://bugs.python.org/file37343/xmlrpc_gzip_27_parameter.patch

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



[issue18967] Find a less conflict prone approach to Misc/NEWS

2014-12-02 Thread Nick Coghlan

Nick Coghlan added the comment:

As an interim step, should we add Ezio's newsmerge.py to Tools/scripts and 
instructions for enabling it to the devguide?

That seems straightforward enough, and doesn't require any global workflow 
changes.

--

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



[issue12987] Demo/scripts/newslist.py has non-free licensing terms

2014-12-02 Thread Nick Coghlan

Nick Coghlan added the comment:

Given that it's only the demo directory (and a relatively obscure demo as well 
these days), I'm inclined to just fix it upstream rather than making the 
distros patch it.

There's also the fact that we distribute the source tarballs from python.org as 
well, and assert that those are under the PSF license, which this script 
doesn't adhere to.

--
nosy: +bkabrda
resolution: wont fix - 
stage: resolved - 

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



[issue16043] xmlrpc: gzip_decode has unlimited read()

2014-12-02 Thread Matthias Klose

Matthias Klose added the comment:

document the new exception

--
Added file: http://bugs.python.org/file37344/xmlrpc_gzip_27_parameter.patch

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



[issue20453] json.load() error message changed in 3.4

2014-12-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In issue19361 I suggest to change error messages even more and drop end 
position from Extra data error message.

--

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



[issue22701] Write unescaped unicode characters (Japanese, Chinese, etc) in JSON module when ensure_ascii=False

2014-12-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Looks either you have opened a file with the backslashreplace error handler or 
ran Python with PYTHONIOENCODING which sets the backslashreplace error handler.

--
nosy: +serhiy.storchaka
status: open - pending

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



[issue13027] python 2.6.6 interpreter core dumps on modules command from help prompt

2014-12-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I suggest to close this issue as caused by a bug in third party extension.

--
nosy: +serhiy.storchaka
resolution:  - third party
status: open - pending

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



[issue7567] Messed up terminal after calling curses.initscr() twice.

2014-12-02 Thread Serhiy Storchaka

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


--
nosy: +serhiy.storchaka

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



[issue22978] Logical Negation of NotImplemented

2014-12-02 Thread Maytag Metalark

New submission from Maytag Metalark:

Performing a logical negation (`not`) on `NotImplemented` should return 
`NotImplemented`. Currently, it returns `False`.

A common pattern for implementing __eq__ and __ne__ is to implement the 
comparison in __eq__, and simply delegate to it in __ne__ with a negation. 
However, if two values are incomparable, then __eq__ and __ne__ should both 
return NotImplemented. If you try to negate NotImplemented in __ne__, you will 
end up with a value of False, instead of NotImplemented, so you have to 
specifically test for this case.

For instance, here is how one would write the code now:

def __ne__(self, other):
eq = self.__eq__(other)
if eq is NotImplemented:
return NotImplemented
return not eq

Where as the following would be simpler, and could be used if this change was 
made:

def __ne__(self, other):
return not self.__eq__(other)

This is not simply sugar to reduce typing, it is safer because some coders may 
forget about NotImplemented and implement __ne__ as shown in the second example 
anyway, which is not actually correct with the current behavior.

--
messages: 231996
nosy: Brian.Mearns
priority: normal
severity: normal
status: open
title: Logical Negation of NotImplemented
type: enhancement
versions: Python 2.7

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



[issue9647] os.confstr() does not handle value changing length between calls

2014-12-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I agree with Victor that two calls to confstr() should be enough. An example in 
confstr manpage uses two calls and I think there is no many software (if any) 
in the world which does more.

--
keywords: +easy
nosy: +serhiy.storchaka
stage:  - needs patch
versions: +Python 3.4, Python 3.5 -Python 3.1, Python 3.2

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



[issue22979] Use of None in min and max

2014-12-02 Thread Maytag Metalark

New submission from Maytag Metalark:

`None` should never be the result of the built-in `min` and `max` functions. 
When `None` is supplied as one of the values to check, it should never be 
chosen as the result.

This would make it much easier to find a minimum and/or maximum while iterating 
over values. For instance, the following is a common pattern:

mn = None
mx = None
for x in iterable:
if mn is None or x  mn:
mn = x
if mx is None or x  mx:
mx = x

Note that although the `min` and `max` functions could be applied directly to 
`iterable` in the above case, the above pattern is more efficient (only once 
through the loop) and covers the common case where additional operations are 
performed on each value of the iterable.

If the suggested enhancement was made, the above code could be written more 
simply as:

mn = None
mx = None
for x in iterable:
mn = min(mn, x)
mx = max(mx, x)

At present, this will actually work for `max`, as None evaluates as less than 
every number, but it will not work for `min` (for the same reason).

The suggested change would mean that None is simultaneously greater than and 
less than every other value, but that only matters if we assume a total 
ordering of all the values including None, which doesn't seem like it would be 
important.

--
messages: 231998
nosy: Brian.Mearns
priority: normal
severity: normal
status: open
title: Use of None in min and max
type: enhancement
versions: Python 2.7

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



[issue18290] json encoder does not support JSONP/JavaScript safe escaping

2014-12-02 Thread Tom Christie

Tom Christie added the comment:

I believe the status of this should be reassessed and that python should 
default to escaping '\u2028' and '\u2029'. *Strictly* speaking this isn't a bug 
and is per the JSON spec.

*However* this *is* a bug in the JSON spec - which *should* be a strict subset 
of JSON. Given that both escaped and unescaped are valid, ensuring that those 
two characters *are* always escaped would clearly be more user-friendly 
behavior on our part, and *would* lead to less bugs in, say web frameworks that 
use the JSON module and then pass the output to template (eg populating a 
javscript variable with some JSON output).

--
nosy: +tomchristie

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



[issue22980] C extension naming doesn't take bitness into account

2014-12-02 Thread Antoine Pitrou

New submission from Antoine Pitrou:

Currently, C extensions are named something like _helperlib.cpython-34dm.so. 
This doesn't take into account the bitness of the interpreter (32- vs. 64-bit), 
which makes it awkward to use the same working copy with two different 
interpreters (you have to rebuild everything each time you switch bitnesses).

Worse, under Windows it seems ABI tags aren't even used, giving generic names 
such as _helperlib.pyd. Why is that?

--
messages: 232000
nosy: barry, brett.cannon, eric.snow, ncoghlan, pitrou, steve.dower, 
tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: C extension naming doesn't take bitness into account
type: enhancement
versions: Python 3.5

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



[issue22980] C extension naming doesn't take bitness into account

2014-12-02 Thread STINNER Victor

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


--
nosy: +haypo

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



[issue22980] C extension naming doesn't take bitness into account

2014-12-02 Thread STINNER Victor

STINNER Victor added the comment:

See also the PEP 3149.

--

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



[issue22980] C extension naming doesn't take bitness into account

2014-12-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

PEP 3149 says It is not currently clear that the facilities in this PEP are 
even useful for Windows. Well, it seems I have found a use for it :-)

--

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



[issue22980] C extension naming doesn't take bitness into account

2014-12-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ideally, we would use distutils.util.get_platform(). However, there are two 
cases where it relies on other modules:
- the re module under CygWin
- the sysconfig and _osx_support under OS X

Of course, ideally we should be able to hardcode this into the compiled CPython 
executable...

--

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



[issue18290] json encoder does not support JSONP/JavaScript safe escaping

2014-12-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There is explicit note in the documentation about incompatibility with 
JavaScript.

--

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



[issue21161] list comprehensions don't see local variables in pdb in python3

2014-12-02 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
nosy: +flox

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



[issue22979] Use of None in min and max

2014-12-02 Thread Simeon Visser

Simeon Visser added the comment:

This doesn't happen in Python 3 as None can't be compared to other elements:

 min([1,2,3,None])
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: unorderable types: NoneType()  int()

I can also imagine people now using min with the intended behaviour of give me 
the smallest element, or None if it happens to be present.

--
nosy: +simeon.visser

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



[issue18290] json encoder does not support JSONP/JavaScript safe escaping

2014-12-02 Thread Tom Christie

Tom Christie added the comment:

 There is explicit note in the documentation about incompatibility with 
 JavaScript.

That may be, but we're still unnecessarily making for a poorer user experience. 
There's no good reason why we shouldn't just treat \u2028 and \u2029 as control 
characters - it's only going to making things better for developers using the 
json module. It is an unnecessary usability bug as it stands.

Just because JSON has a bug in its spec wrt those two characters, doesn't mean 
we can't help our users avoid ever having to know about that or work around it 
in user code.

--

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



[issue22980] C extension naming doesn't take bitness into account

2014-12-02 Thread Antoine Pitrou

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


--
nosy: +ned.deily

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



[issue22976] multiprocessing Queue empty() is broken on Windows

2014-12-02 Thread R. David Murray

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


--
nosy: +sbt

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



[issue22979] Use of None in min and max

2014-12-02 Thread Simeon Visser

Simeon Visser added the comment:

So, to clarify, as the problem no longer occurs in Python 3 (as it requires the 
caller to provide only orderable objects) I'm not sure a meaningful change can 
be made here. It would require changing the behaviour of min/max in Python 
2.7.x in a way that could break existing code.

--

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



[issue22980] C extension naming doesn't take bitness into account

2014-12-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

As a side-note, it is interesting to note that Python currently wrongly 
identifies 32-bit builds under 64-bit Linux:

Python 3.5.0a0 (default:64a54f0c87d7, Nov  2 2014, 17:18:13) 
[GCC 4.9.1] on linux
Type help, copyright, credits or license for more information.
 import sys, os, sysconfig
 sys.maxsize
2147483647
 os.uname()
posix.uname_result(sysname='Linux', nodename='fsol', 
release='3.16.0-25-generic', version='#33-Ubuntu SMP Tue Nov 4 12:06:54 UTC 
2014', machine='x86_64')
 sysconfig.get_platform()
'linux-x86_64'

AFAIU, sysconfig.get_platform() (or its sibling distutils.util.get_platform()) 
is used for the naming of binary distributions...

--

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



[issue22978] Logical Negation of NotImplemented

2014-12-02 Thread R. David Murray

R. David Murray added the comment:

This would break Python's consistency.  'not' of a value returns its boolean 
inverse, and the boolean value of NotImplemented is True, just like the boolean 
value of any object that does not have methods that set its boolean value is 
True.  Having anything that is True return True when not is applied would be 
even more perverse than NANs are :)

The correct implementation of your __ne__ method is to not define it.  Python 
will then do the 'not __eq__(other)' call itself.

--
nosy: +r.david.murray
resolution:  - not a bug
stage:  - resolved
status: open - closed

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



[issue22979] Use of None in min and max

2014-12-02 Thread R. David Murray

R. David Murray added the comment:

Just select your initial value as something that works with the sequence you 
are iterating.  If necessary, you can define custom 'always maximum' and 
'always minimum' objects.  (You could try proposing builtin objects with that 
feature on the python-ideas mailing list, if you want to pursue this, but since 
this is a specialized need and usually you don't even need custom objects, I 
suspect you won't get much enthusiasm.  But I could be wrong, especially if you 
can some up with additional use cases.

--
nosy: +r.david.murray
resolution:  - not a bug
stage:  - resolved
status: open - closed

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



[issue22981] Use CFLAGS when extracting multiarch

2014-12-02 Thread Antoine Pitrou

New submission from Antoine Pitrou:

This patch fixes MULTIARCH computation when using CFLAGS=-m32:

diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -5402,7 +5402,7 @@ hp*|HP*)
 esac;;
 esac
 
-MULTIARCH=$($CC --print-multiarch 2/dev/null)
+MULTIARCH=$($CC $CFLAGS --print-multiarch 2/dev/null)
 
 
 
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -788,7 +788,7 @@ hp*|HP*)
 esac;;
 esac
 
-MULTIARCH=$($CC --print-multiarch 2/dev/null)
+MULTIARCH=$($CC $CFLAGS --print-multiarch 2/dev/null)
 AC_SUBST(MULTIARCH)

--
messages: 232013
nosy: barry, doko, pitrou
priority: normal
severity: normal
status: open
title: Use CFLAGS when extracting multiarch
type: enhancement
versions: Python 3.5

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



[issue18053] Add checks for Misc/NEWS in make patchcheck

2014-12-02 Thread Brett Cannon

Brett Cannon added the comment:

If it's bugging you, Terry, feel free to delete that part of the check as it's 
of more use to core devs and we won't forget.

--
assignee:  - terry.reedy

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



[issue22980] C extension naming doesn't take bitness into account

2014-12-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

The MULTIARCH variable can help at least under Linux:

 import sysconfig
 sysconfig.get_platform()
'linux-x86_64'
 sysconfig.get_config_var('MULTIARCH')
'i386-linux-gnu'

--

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



[issue9584] Allow curly brace expansion

2014-12-02 Thread Arfrever Frehtes Taifersar Arahesis

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


--
nosy: +Arfrever
versions: +Python 3.5 -Python 3.4

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



[issue22982] BOM incorrectly inserted before writing, after seeking in text file

2014-12-02 Thread MarkIngramUK

New submission from MarkIngramUK:

If you open a text file for append, but then perform any form of seeking, 
before attempting to write to the file, it will cause the BOM to be written 
before you text. See the attached file for an example.

If you run the test, take a look at the output file, and you'll notice the 
UTF16 BOM gets written out before each number.

I'm running a 2014 iMac with Yosemite.

--
components: IO
files: append-test.py
messages: 232015
nosy: MarkIngramUK
priority: normal
severity: normal
status: open
title: BOM incorrectly inserted before writing, after seeking in text file
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file37345/append-test.py

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



[issue22966] py_compile: foo.bar.py → __pycache__/foo.cpython-34.pyc

2014-12-02 Thread Brett Cannon

Brett Cannon added the comment:

Apparently this broke under Windows: 
http://buildbot.python.org/all/builders/x86%20Windows7%203.x/builds/8999/steps/test/logs/stdio

--
status: closed - open

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



[issue22980] C extension naming doesn't take bitness into account

2014-12-02 Thread STINNER Victor

STINNER Victor added the comment:

There is also platform.architecture(). I don't like its implementation, it 
relies on the external file program :-(

--

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



[issue22685] memory leak: no transport for pipes by create_subprocess_exec/shell

2014-12-02 Thread STINNER Victor

STINNER Victor added the comment:

 Buildbot failures observed on koobs-freebsd9 and koobs-freebsd10 for 3.x and 
 3.4, respectively.

It looks like test_asyncio pass on the last 5 builds of the following 
buildbots, and so I consider the issue as closed.

http://buildbot.python.org/all/builders/AMD64 FreeBSD 9.x 3.x
http://buildbot.python.org/all/builders/AMD64%20FreeBSD%2010.0%203.x

--

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



[issue22473] The gloss on asyncio future with run_forever example is confusing

2014-12-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a4b58e779a16 by Victor Stinner in branch '3.4':
Close #22473: asyncio doc: rephrase Future with run_forever() example
https://hg.python.org/cpython/rev/a4b58e779a16

--
nosy: +python-dev
resolution:  - fixed
stage:  - resolved
status: open - closed

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



[issue22473] The gloss on asyncio future with run_forever example is confusing

2014-12-02 Thread STINNER Victor

STINNER Victor added the comment:

I rephrase the explanation of the example and I removed the useless note. 
Thanks for your feedback David. Don't hesitate to propose other enhancements to 
the documentation!

--

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



[issue22966] py_compile: foo.bar.py → __pycache__/foo.cpython-34.pyc

2014-12-02 Thread Arfrever Frehtes Taifersar Arahesis

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


--
nosy: +Arfrever

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



[issue22983] Cookie parsing should be more permissive

2014-12-02 Thread Demian Brecht

New submission from Demian Brecht:

As found in #22931, if an invalid cookie value is found while parsing, the rest 
of the cookie is silently ignored. The expected behavior is undefined in RFC 
6265, but does state that if unexpected values are encountered that user agents 
MAY ignore an entire set-cookie string (not just a subsection of it). Given 
that, invalid cookie portions should likely be handled by either:

1. Ignore the cookie string in its entirety and log an error message, or
2. Ignore invalid cookie-pairs but still parse the rest of the string

The latter would likely be the best path (Postel's law and all)

--
components: Library (Lib)
messages: 232020
nosy: demian.brecht
priority: normal
severity: normal
status: open
title: Cookie parsing should be more permissive
type: enhancement
versions: Python 3.5

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



  1   2   >