Re: Using threads for audio computing?

2014-05-12 Thread Chris Angelico
On Mon, May 12, 2014 at 3:54 PM, lgabiot lgab...@hotmail.com wrote:
 So back to my original question: A Queue and two threads (producer/consumer)
 seems a good answer to my problem, or is there a better way to solve it?
 (again, I'm really a beginner, so I made up this solution, but really wonder
 if I do not miss a well known obvious much better idea).

Well, the first thing I'd try is simply asking for more data when
you're ready for it - can you get five seconds' of data all at once?
Obviously this won't work if your upstream buffers only a small
amount, in which case your thread is there to do that buffering; also,
if you can't absolutely *guarantee* that you can process the data
quickly enough, every time, then you need to use the queue to buffer
that.

But otherwise, it sounds like a quite reasonable way to do things.

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


Re: Using threads for audio computing?

2014-05-12 Thread lgabiot

Le 12/05/14 07:58, Chris Angelico a écrit :


Well, the first thing I'd try is simply asking for more data when
you're ready for it - can you get five seconds' of data all at once?
Obviously this won't work if your upstream buffers only a small
amount, in which case your thread is there to do that buffering; also,
if you can't absolutely *guarantee* that you can process the data
quickly enough, every time, then you need to use the queue to buffer
that.

But otherwise, it sounds like a quite reasonable way to do things.

ChrisA



Ok, thanks a lot!
--
https://mail.python.org/mailman/listinfo/python-list


Re: Using threads for audio computing?

2014-05-12 Thread Stefan Behnel
lgabiot, 12.05.2014 07:33:
 Le 11/05/14 17:40, lgabiot a écrit :
 
 I guess if my calculation had to be performed on a small number of
 samples (i.e. under the value of the Pyaudio buffer size (2048 samples
 for instance), and that the calculation would last less than the time it
 takes to get the next 2048 samples from Pyaudio, I wouldn't need the
 Queue and Thread system.
 But in my case where I need a large buffer, it might not work?
 Unless I ask pyaudio to feed me directly with 5 seconds chunks (instead
 of the usual buffer sizes: 1024, 2048, etc...), which I didn't try,
 because I hadn't though of it.
 
 I guess this solution might probably not work, since it would mean that the
 calculation should be quick enough so it wouldn't last longer than 1 sample
 (1/48000 s for instance), since while doing the calculation, no audio would
 be ingested (unless pyAudio possess some kind of internal concurrency system).
 Which leads me to think that a buffer (queue) and separate threads
 (producer and consumer) are necessary for this task.

This sounds like a use case for double buffering. Use two buffers, start
filling one. When it's full, switch buffers, start filling the second and
process the first. When the second is full, switch again.

Note that you have to make sure that the processing always terminates
within the time it takes to fill the other buffer. If you can't assure
that, however, you have a problem anyway and should see if there's a way to
improve your algorithm.

If the fill my buffer call in PyAudio is blocking (i.e. if it returns
only after filling the buffer), then you definitely need two threads for this.


 But AFAIK the python GIL (and in smaller or older computers that have only
 one core) does not permit true paralell execution of two threads.

Not for code that runs in the *interpreter, but it certainly allows I/O
and low-level NumPy array processing to happen in parallel, as they do not
need the interpreter.

Stefan


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


ANN: Cerridwen 1.0c4 (initial release)

2014-05-12 Thread leslie . polzer
Dear Python friends,

today I'm proud to be

ANNOUNCING: The initial release of a new package, named Cerridwen (1.0c4).

PyPI entry: https://pypi.python.org/pypi/cerridwen


What gives?

  The author perceives a lack of modern open source software
  providing high quality planetary data that is suitable for
  astronomical and astrological purposes.

  So, to start amending that situation I wrote Cerridwen.

  Cerridwen is a moon data API relying on pyswisseph and numpy
  to provide accurate and comprehensive data on the moon.

  With its help you will, for example, be able to get the moon's
  current tropical sign, the dates of the next new and full moons
  and its current absolute and relative diameter.

  Cerridwen offers a JSON HTTP API and comes a simple command-line
  tool. These are built on a library module that you can use to
  develop your own applications.


And you're invited too!

  Please try it if you're interested! :-)

  I've also set up a test server for the API here:

http://cerridwen.viridian-project.de/api/v1/moon

  You can load it in your browser too for a quick peek! Please
  note that the given information may be up to 10 seconds old,
  due to efficiency considerations in the current version of
  Cerridwen.

  All feedback and participation is welcome, including forks and
  patches. Cerridwen's code is on Github.


Need more information?

  Please do take a look at the PyPI page, it contains more detailed
  information. Also feel free to write to me at leslie.polzer SPAMPROTECT AT 
gmx.net.


Thanks for reading!

  With Cerridwen I'm trying to give something back to the Python
  community. This is my first publicly released Python package.

Cheers,

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


Re: Using threads for audio computing?

2014-05-12 Thread lgabiot

Le 12/05/14 08:13, Stefan Behnel a écrit :

This sounds like a use case for double buffering. Use two buffers, start
filling one. When it's full, switch buffers, start filling the second and
process the first. When the second is full, switch again.

Note that you have to make sure that the processing always terminates
within the time it takes to fill the other buffer. If you can't assure
that, however, you have a problem anyway and should see if there's a way to
improve your algorithm.

If the fill my buffer call in PyAudio is blocking (i.e. if it returns
only after filling the buffer), then you definitely need two threads for this.



But AFAIK the python GIL (and in smaller or older computers that have only
one core) does not permit true paralell execution of two threads.


Not for code that runs in the *interpreter, but it certainly allows I/O
and low-level NumPy array processing to happen in parallel, as they do not
need the interpreter.

Stefan



Thanks for your answer.

If I follow your explanations, I guess I have to review my understanding 
of python execution model (I have to admit it is quite crude anyway).


In my understanding, without threads, I would have two functions:
- get_audio() would get the 5 seconds of audio from Pyaudio
- process_audio() would process the 5 seconds of audio

the main code would be roughly executing this:
while(True)
get_audio()
process_audio()

so since the audio is a live feed (which makes a difference, say, with 
an audio file analyser program), the get_audio() part must take 5 
seconds to execute. (but most probably the processor stays still most of 
the time during the get_audio() part).

then once get_audio() is done, process_audio() begins.
Process_audio will take some time. If that time is greater that the 
times it takes for the next audio sample to arrive, I have a problem.

(which you already explained differently maybe with:
 If the fill my buffer call in PyAudio is blocking (i.e. if it returns
 only after filling the buffer), then you definitely need two threads 
for this.

)

So if I follow you, if the Pyaudio part is Non-blocking there would be 
a way to make it work without the two threads things. I'm back to the 
Pyaudio doc, and try to get my head around the callback method, which 
might be the good lead.





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


Re: parsing multiple root element XML into text

2014-05-12 Thread Peter Otten
Percy Tambunan wrote:

 On Friday, May 9, 2014 4:02:42 PM UTC+7, Chris Angelico wrote:
 On Fri, May 9, 2014 at 6:59 PM, Percy Tambunan percy.tambu...@gmail.com
 wrote:
 
  Hai, I would like to parse this multiple root element XML
 
 
 
 Easy fix might be to wrap it in root and /root, which will give
 
 you a new root. Would that help?
 
 
 
 ChrisA
 
 Thanks chris for the idea.
 Any suggestion to make it print like this:
 
 create enumdnsched 4.1.0.1.4.7.3.4.3.2.6.e164.arpa -set naptrFlags=nu
 create enumdnsched 5.1.0.1.4.7.3.4.3.2.6.e164.arpa -set naptrFlags=nu

[Stefan Behnel]

 ElementTree's XMLParser() can be use efficiently for this. Something like
 this should work:
 
 from xml.etree.ElementTree import XMLParser
 
 parser = XMLParser()
 parser.feed(b'root')
 parser.feed(real_input_data)
 parser.feed(b'/root')
 root = parser.close()
 
 for subtree in root:
 ...
 
Have you tried to integrate Stefan's example into your script? If so, what 
is the current state of your code, and what problems prevented you from 
completing it?

Expect help to fix these problems, but not necessarily a ready-to-run 
solution.

If you have not made an attempt yet look here for ideas on how you can use 
XPath to extract interesting data from the subtree:

https://docs.python.org/dev/library/xml.etree.elementtree.html#example


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


Re: Fortran (Was: The does Python have variables? debate)

2014-05-12 Thread Alain Ketterlin
Mark H Harris harrismh...@gmail.com writes:

 On 5/11/14 12:05 PM, Alain Ketterlin wrote:
 Julia is Matlab and  R, Python, Lisp, Scheme; all rolled together on
 steroids. Its amazing as a dynamic language, and its fast, like
 lightning fast as well as multiprocessing (parallel processing) at its
 core. Its astounding, really.

 Hmmm...

 Its number concept is unified,

 What exactly is unified? There is no implicit promotion between
 primitive types and BigInt/Float.


 The built-in math functions (extensive, by the way) just work, and
 they work consistently the way you might expect across types. Consider
 sqrt():
[...]
 You'll notice that I did not need to import anything to use sqrt(),
 and sqrt() takes all types and does something meaningful with them.

Sorry, i wasn't clear enough: doing something meaningful with them is
precisely where the problem is. Every single operation requires
multiple-dispatch (i.e., dynamically testing types, converting to a
common type, and selecting the version of sqrt to use). That's probably
more than the time it takes to actually perform the computation, a bit
like what happens with x+y on integers with Python, where only a
fraction of time is spent on adding integers.

When you are doing scientific computation, this overhead is
unacceptable, because you'll have zillions of computations to perform.

Julia provides a way to make things fast: typing. If you provide
explicit types, the dynamic typing part obviously disappears, and
the overhead is removed.

But then, you're not too far from Fortran, or C/C++.

 The following code will produce over 100,000 digits of π (pi) in less
 than 2 seconds on a low-end processor, like my mac mini dual core
 2Ghz:

You seem to be discovering the power of the libraries that are behind
all this (MPFR in that case)...

[...]
 But, like lisp, Julia's internal structures are lists, so, it can
 create and modify its own code on-the-fly. [...]

Sorry, I was comparing to Fortran, and it's use in scientific computing.
Self modifying code is totally irrelevant there.

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


Re: Plotting multiple datasets with gnuplot

2014-05-12 Thread s . c . wouters
On Friday, October 9, 2009 12:12:54 PM UTC+2, Gabriel Genellina wrote:
 En Fri, 09 Oct 2009 06:36:45 -0300, Rob Garrett rgagarr...@gmail.com  
 escribiï¿oe:
 
  I'm trying to get gnuplot to display multiple data series on a single
  plot using gnuplot in python.  I've searched around and haven't found
  a solution to how to do this when I have a variable-length list of
  plots to add.
 
  For example, the following code will work:
 
  plotData1 = Gnuplot.PlotItems.Data(data1, title=title1)
  plotData2 = Gnuplot.PlotItems.Data(data2, title=title2)
  g.plot( plotData1, plotData2 )
 
  [I've removed the rest of the code for clarity]
 
  But how can I do the following instead:
 
  data = []
  ...
  # Populate data
  ...
  plots = []
  for dataSet in data:
plots.append(dataSet)
  g.plot(plots)
 
 g.plot(*plots) should work; it's like calling g.plot(plots[0], plots[1],  
 plots[2]...)
 
 See http://docs.python.org/reference/expressions.html#calls for the gory  
 details.
 
 -- 
 Gabriel Genellina

I just spend an hour searching the web for a similar problem and finally found 
your answer. Thank you, it works great!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Fortran

2014-05-12 Thread Mark Lawrence

On 12/05/2014 03:28, Steven D'Aprano wrote:

On Mon, 12 May 2014 01:27:17 +0100, Mark Lawrence wrote:


On 12/05/2014 00:51, Steven D'Aprano wrote:


Cars are standardized -- there are basically two types, manuals and
automatics.



Sadly they can still go wrong due to modern engineering practices.  In
my neck of the woods some years ago people were killed when standing at
a bus stop, because the car driver was desperately pressing down on the
automatic's brake


Perhaps (s)he should have steered the car away from the people. Or I
suppose the steering wheel failed as well?


The entire vehicle was perfectly sound after the event, including the 
brake and accelerator controls.  It was only during the accident that 
the interference played havoc.  Pure coincidence of course.






but EMI overrode the engine controls


EMI? The record company? Wow, I knew they were evil, but I didn't realise
they were *that* evil.


Ho, ho, ho :)





and the car
simply went faster.  At least that is what the defence claimed at the
trial.  With no expert on the prosecution to refute the claim not
guilty was the verdict.


Sounds like the prosecution were just going through the motions. They
should have either had an expert able to refute the claim, or not
prosecuted in the first place.


Can't do that if you don't know in advance what the defence is :(



Personally, I'm rather skeptical about claims of I kept pushing the
brake but the car just accelerated. There is a long and inglorious
history of people stepping on the wrong pedal when in a panic, or drunk,
or distracted. I've even done it myself. (I expect *every* driver
has, at some point.) And a not-quite-as-long but even more inglorious
history of lawyers inventing nonsense links between the brake pedal and
the accelerator in order to extort money from car manufacturers. E.g. see
Galileo's Revenge by Peter W Huber and the case of the mythical, but
amazingly profitable for the lawyers involved, Audi Sudden Acceleration
Syndrome.

For me personally, perhaps the most despicable part of the whole sordid
story was the case of Wende Gatts, who ran over Darlene Norris, causing
$300,000 in damages. Not only did she got off scot-free, thanks to the
junk science invented by her expert witness, but actual victim Norris
was ordered to pay Gatts' legal fees of $64K.

Of course, that was in the late 1980s, when even luxury cars still had
mechanical linkage between the user and the brakes. These days, when
nearly everything in the car is computer controlled, I wouldn't be
*quite* so skeptical. Nevertheless, chances are almost certain that by
far the majority of unexpected acceleration cases are PEBCAP errors.

http://www.caranddriver.com/features/its-all-your-fault-the-dot-renders-its-verdict-on-toyotas-unintended-acceleration-scare-feature

http://www.caranddriver.com/news/toyota-recall-scandal-media-circus-and-stupid-drivers-editorial



I hadn't heard about ASAS, another to add to my list of syndromes :)

--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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


Re: Using threads for audio computing?

2014-05-12 Thread lgabiot

Le 12/05/14 10:14, lgabiot a écrit :

So if I follow you, if the Pyaudio part is Non-blocking there would be
a way to make it work without the two threads things. I'm back to the
Pyaudio doc, and try to get my head around the callback method, which
might be the good lead.


So far, if I understand correctly PyAudio, the callback method is a way 
to do some sort of computing on a Pyaudio stream, by declaring a 
function (the callback one) at stream opening time, the callback 
function being executed in a separate thread (as per the Pyaudio 
documentation)...

Still investigating.


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


Re: Error while calling round() from future.builtins

2014-05-12 Thread Preethi
On Saturday, May 10, 2014 5:26:56 PM UTC+5:30, Steven D'Aprano wrote:
 On Sat, 10 May 2014 04:39:05 -0700, Preethi wrote:
 
 
 
  Hi,
 
  
 
  I am new to python. I am getting an error AttributeError: type object
 
  'Decimal' has no attribute 'from_float' when I run the following in
 
  python prompt:
 
  
 
  from future.builtins import int, round 
 
 
 
 I get an error when I try that:
 
 
 
 
 
 py from future.builtins import int, round
 
 Traceback (most recent call last):
 
   File stdin, line 1, in module
 
 ImportError: No module named future.builtins
 
 
 
 
 
 Perhaps you are using the third-party library future? 
 
 
 
 https://pypi.python.org/pypi/future
 
 
 
 If so, then I believe the library is buggy and you should report it to 
 
 the Centos package maintainer. You might also manually install a more 
 
 recent version of future.
 
 
 
 Decimal.from_float was only added in 2.7, it is not available in 2.6.
 
 
 
 https://docs.python.org/2/library/decimal.html#decimal.Decimal.from_float
 
 
 
 
 
 
 
 
 
 -- 
 
 Steven D'Aprano
 
 http://import-that.dreamwidth.org/

Yes, I upgraded to 0.12.0 and it worked! Thanks a lot!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PyPy updated

2014-05-12 Thread km
I tried compiling pandas on pypy 2.3 but it gave error as follows

numpy/core/src/multiarray/scalarapi.c:742:16: error: 'PyUnicodeObject' has
no member named 'str'

 uni-str[length] = 0;

^

numpy/core/src/multiarray/scalarapi.c:743:16: error: 'PyUnicodeObject' has
no member named 'length'

 uni-length = length;

Cleaning up...
Command /home/user/test101/bin/pypy-c -c import setuptools,
tokenize;__file__='/home/user/test101/build/numpy/setup.py';exec(compile(getattr(tokenize,
'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))
install --record /tmp/pip-d2Eg7e-record/install-record.txt
--single-version-externally-managed --compile --install-headers
/home/user/test101/include/site/python2.7 failed with error code 1 in
/home/user/test101/build/numpy
Storing debug log for failure in /home/user/.pip/pip.log

Regards,
Krishna



On Fri, May 9, 2014 at 7:18 PM, Mark Lawrence breamore...@yahoo.co.ukwrote:

 Might interest some of you fine folk out there :-

 http://morepypy.blogspot.co.uk/2014/05/pypy-23-terrestrial-arthropod-trap.
 html

 --
 My fellow Pythonistas, ask not what our language can do for you, ask what
 you can do for our language.

 Mark Lawrence

 ---
 This email is free from viruses and malware because avast! Antivirus
 protection is active.
 http://www.avast.com


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

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


Re: What is the difference between 32 and 64 bit Python on Windows 7 64 bit?

2014-05-12 Thread Sturla Molden

On 11/05/14 08:56, Ross Gayler wrote:


It looks to me as though 32 and 64 bit versions of Python on 64 bit
Windows are both really 32 bit Python, differing only in how they
interact with Windows.


No! Pointers are 64 bit, Python integers (on Python 2.x) are 32 bit. 
Microsoft decided to use a 32 bit long in MSVC for backwards 
compatiblity, but also because the AMD64 (x86-64) architecture was 
designed to use a 64 address with a 32 bit offset. (A 64 bit long was 
originally slightly less efficient.) You can see the value of 64 bit 
Python e.g. if you allocate a lot of objects or if you try to mmap a 
huge file. With 32 bit Python you are limited to only 2 GB of virtual 
memory. In 64 bit Python you can in practice mmap as much as you want.


The element size of what you try to index also matters. While a C long 
and a Python int is 32 bit on Windows, 64-bit Python will use a 64-bit 
offset internally (Py_ssize_t and Py_intptr_t) even on Windows. The 32 
bit Python int just limits how many objects you can index from Python 
space before Python roll over to using long instead of int. It does not 
limit the amount of memory a Python int can index. In is only when you 
index an array of bytes you will see the roll-over from Python int to 
Python long at the 2 GB limit. Typically, object will be much larger 
than one byte.


Here are two examples:

- A one-dimensional NumPy array with dtype np.float64 can keep 16 GB of 
data before a 32 bit index is too small and Python starts to use long. 
A two-dimensional NumPy array with dtype np.float64 can keep 256 GB of 
data before a 32 bit index is too small.


- A Python list stores internally an array of pointers, each of which is 
64 bit. So just indexing those goes up to 16 GB of pointer data before 
the int rolls over. Then each of these pointers point to a Python 
object. A Python float on my computer (not Windows) is 24 bytes, which I 
got from sys.getsizeof(1.) So 2**32 of those are another 383 GB. So if I 
indexed a list of Python floats on this computer, Python could handle an 
almost 400 GB data structure with a 32 bit int as indexer without 
rolling over to long.


This is obviously way beyond anything the 2 GB limit on 32 bit Python 
allows.





Sturla





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


Re: Fortran

2014-05-12 Thread Grant Edwards
On 2014-05-12, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
 On Mon, 12 May 2014 00:51:01 +0100, MRAB wrote:
 On 2014-05-12 00:15, Steven D'Aprano wrote:

 The F and J keys have F and J printed on them instead of G and
 K. They're also in slightly different positions, offset one position
 to the left. Otherwise they are identical, to the limits of my vision
 and touch. (I haven't tried measuring them with a micrometer, or doing
 chemical analysis of the material they are made of.)

Really?  No rised dots or ridges?

 Maybe keyboards are different where you are! :-)

 Certainly not. However they may be different where *you* are :-P

 I'm using an IBM keyboard, model SK-8820.

 Mine have an little ridge on the keytop of those keys.

 I've seen keyboards with those, but not many. 

I would guess that at least 95% of the keyboards I've seen in the past
30 years have had them

-- 
Grant Edwards   grant.b.edwardsYow! One FISHWICH coming
  at   up!!
  gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Fortran

2014-05-12 Thread alister
On Sun, 11 May 2014 20:14:14 -0400, Roy Smith wrote:

 In article mailman.9900.1399852263.18130.python-l...@python.org,
  MRAB pyt...@mrabarnett.plus.com wrote:
 
 On 2014-05-12 00:15, Steven D'Aprano wrote:
  On Sun, 11 May 2014 14:43:19 -0400, Roy Smith wrote:
 
  In article mailman.9891.1399833209.18130.python-l...@python.org,
   Chris Angelico ros...@gmail.com wrote:
 
  Some things are more standardized than others. A piano keyboard is
  incredibly standard, to make it possible to play without having to
  look at your fingers (even when jumping your hands around, which
  doesn't happen as much on a computer keyboard)
 
  Speaking of which, here's a trivia question.  Without looking at
  your keyboard, describe how the F and J keys (assuming a
  US-English key layout) differ from, say, the G and K keys.
 
  The F and J keys have F and J printed on them instead of G and
  K.
  They're also in slightly different positions, offset one position to
  the left. Otherwise they are identical, to the limits of my vision
  and touch.
  (I haven't tried measuring them with a micrometer, or doing chemical
  analysis of the material they are made of.)
 
 Maybe keyboards are different where you are! :-)
 
 Mine have an little ridge on the keytop of those keys.
 
 Yup.  Long before the days of computers, the F/J keys have had some sort
 of tactile feedback (a raised dot or whatever) so you can tell when you
 hands are in the home position by feel.  Pyjrteodr upi vsm rmf i[ yu[omh
 ;olr yjod/

I once used an Osborn one where each key-cap was individually sculptured 
to fit the finger depending on its position on the keyboard.




-- 
Bridge ahead.  Pay troll.
-- 
https://mail.python.org/mailman/listinfo/python-list


Everything you did not want to know about Unicode in Python 3

2014-05-12 Thread Mark Lawrence
This was *NOT* written by our resident unicode expert 
http://lucumr.pocoo.org/2014/5/12/everything-about-unicode/


Posted as I thought it would make a rather pleasant change from 
interminable threads about names vs values vs variables vs objects.


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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


a better way to operate svn with python(better than pysvn)?

2014-05-12 Thread xs . nepaul

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


Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions.

2014-05-12 Thread Simon Evans
Hi Ian, thank you for your help. 
Yes that is the book by Vineeth J Nair.
At the top of page 12, at step 1 it says :

1.Download the latest tarball from 
https://pypi.python.org/packages/source/b/beautifulsoup4/.

So yes, the version the book is dealing with is beautiful soup 4. 
I am using Pyhon 2.7, I have removed Python 3.4.
Also on the bottom of page 10, Mr Nair states:

Pick the path variagble and add the following section to the Path variable:

;C:\PythonXY for example C:\Python27

Which tells me that the Python version cited in the book must be 2.7

I downloaded beautiful soup 4 last night. I unzipped it with 'Just unzip it' to 
a folder I called Beautiful Soup, the same as I did with the previous beautiful 
soup download. The console return is as below, showing that I am now facing the 
same conundrum as yesterday, before changing my version of Beautiful Soup. re:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Intel Atomcd c:\Beautiful Soup

c:\Beautiful SoupBeautiful Soupc:\Python27\python setup.py install
'Beautiful' is not recognized as an internal or external command,
operable program or batch file.

c:\Beautiful Soup


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


Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions.

2014-05-12 Thread Simon Evans
The version of Python the book seems to be referring to is 2.7, re: bottom of 
page 10-
'Pick the Path variable and add the following section to the Path variable: 
;C:\PythonXY for example C:\Python 27'

The version of Beautiful Soup seems to be Beautiful Soup 4 as at the top of 
page 12 it states:
'1.Download the latest tarball from 
https://pypi.python.org/packages/source/b/beautifulsoup4/.'

I have downloaded and unzipped to a folder called 'Beautiful Soup' on the C 
drive the Beautiful Soup 4 version. I am using the Python 2.7 console and IDLE, 
I have removed the 3.4 version. 

All the same I seem to be having difficulties again as console wont accept the 
code it did when it was the previous version of BS that I used yesterday. I 
realise I would not be having this problem if I proceeded to input the 'Hello 
World' code on the Python console, but as said, the text never specifically 
said 'change to Python 2.7 console'. I thought the problem was with the BS 
version and so changed it, but now can't even get as far as I had before 
changing it. Anyhow be that as it may, this is the console response to my input:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Intel Atomcd c:\Beautiful Soup

c:\Beautiful SoupBeautiful Soupc:\Python27\python setup.py install
'Beautiful' is not recognized as an internal or external command,
operable program or batch file.

c:\Beautiful Soup
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions.

2014-05-12 Thread Simon Evans
Thank you for your advice. I did buy a book on Python, 'Hello Python' but the 
code in it wouldn't run, so I returned it to the shop for a refund. I am going 
to visit the local library to see if they have any books on Python. I am 
familiar with Java and Pascal, and looking at a few You tubes on the subject, 
thought it was not much different, and shares many of the oop concepts 
(variables, initializing, expressions, methods, and so on, but I realize there 
is no point in walking backwards in new territory.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions.

2014-05-12 Thread Simon Evans
Dear Ian, 
The book does recommend to use Python 2.7 (see bottom line of page 10).
The book also recommends to use Beautiful Soup 4. 
You are right that in that I have placed the unzipped BS4 folder within a 
folder, and I therefore removed the contents of the inner folder and 
transferred them to the outer folder. 
The console now can access the contents of the Beautiful Soup folder, but it is 
still having problems with it as the last output to my console demonstrates :


Microsoft Windows [Version 6.1.7601]

Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Intel Atomcd c:\Beautiful Soup

c:\Beautiful Soupc:\Python27\python setup.py install
running install
running build
running build_py
error: package directory 'bs4' does not exist

c:\Beautiful Soup
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: NumPy, SciPy, Python 3X Installation/compatibility issues

2014-05-12 Thread Joseph Martinot-Lagarde

Le 10/05/2014 19:07, esaw...@gmail.com a écrit :

Hi All--

Let me state at the start that I am new to Python. I am moving away from 
Fortran and Matlab to Python and I use all different types of numerical and 
statistical recipes in my work. I have been reading about NumPy and SciPy and 
could not find any definitive answers to my questions, below.  I had run into 
many mostly installation problems that I could never get NumPy or SciPy to work 
with Python 3.3 or newer.  I am using Windows7 64 bit OS.
A few questions:
1.  What are the latest versions of NumPy and SciPy that are compatible 
with Python 3.3 or newer and Windows7 64 bit?
2.  What is the best source to download and install them on my computer?
3.  Are they all installable on my OS w/o any major problems/addition?
4.  In the long run, would it be better to use UNIX instead of Windows, if 
I were to use Python for all of my research?
Thanks in advance. EK

Building the scientific libraries on windows is very tricky because you 
need a compatible C and Fortran compiler, as well as some libraries. The 
usual and recommended route is to use python distributions where the 
most used libraries are installed. You can still use pip to install 
additionnal packages. You have a list over here: 
http://www.scipy.org/install.html


---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce 
que la protection avast! Antivirus est active.
http://www.avast.com


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


Re: How can this assert() ever trigger?

2014-05-12 Thread Joseph Martinot-Lagarde

Le 10/05/2014 17:24, Albert van der Horst a écrit :

I have the following code for calculating the determinant of
a matrix. It works inasfar that it gives the same result as an
octave program on a same matrix.

/ 

def determinant( mat ):
 ''' Return the determinant of the n by n matrix mat
 i row j column
 Destroys mat ! '''
 #print getting determinat of, mat
 n=len(mat)
 nom = 1.
 if n == 1: return mat[0][0]
 lastr = mat.pop()
 jx=-1
 for j in xrange(n):
if lastr[j]:
jx=j
break
 if jx==-1: return 0.
 result = lastr[jx]
 assert(result0.)
 # Make column jx zero by subtracting a multiple of the last row.
 for i in xrange(n-1):
 pivot = mat[i][jx]
 if 0. == pivot: continue
 assert(result0.)
 nom *= result   # Compenstate for multiplying a row.
 for j in xrange(n):
 mat[i][j] *= result
 for j in xrange(n):
 mat[i][j] -= pivot*lastr[j]
 # Remove colunm jx
 for i in xrange(n-1):
x= mat[i].pop(jx)
assert( x==0 )

 if (n-1+jx)%20: result = -result
 det = determinant( mat )
 assert(nom0.)
 return result*det/nom

/-

Now on some matrices the assert triggers, meaning that nom is zero.
How can that ever happen? mon start out as 1. and gets multiplied
with a number that is asserted to be not zero.

Any hints appreciated.

Groetjes Albert

I know it's not the question, but if you want a replacement for octave 
did you try numpy (and scipy) ? The determinant would be computer faster 
and with less memory than with your function.


---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce 
que la protection avast! Antivirus est active.
http://www.avast.com


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


Re: Why isn't my re.sub replacing the contents of my MS Word file?

2014-05-12 Thread scottcabit
On Friday, May 9, 2014 8:12:57 PM UTC-4, Steven D'Aprano wrote:

 Good:
 
 
 
 fStr = re.sub(b'#x2012', b'-', fStr)
 

  Doesn't work...the document has been verified to contain endash and emdash 
characters, but this does NOT replace them.
 
 
 Better:
 
 
 
 fStr = fStr.replace(b'#x2012', b'-')
 
 
   Still doesn't work
 
 
 
 But having said that, you actually can make use of the nuclear-powered 
 
 bulldozer, and do all the replacements in one go:
 
 
 
 Best:
 
 
 
 # Untested
 
 fStr = re.sub(b'#x(201[2-5])|(2E3[AB])|(00[2A]D)', b'-', fStr)

  Still doesn't work.

  Guess whatever the code is for endash and mdash are not the ones I am 
using

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


Re: Everything you did not want to know about Unicode in Python 3

2014-05-12 Thread alister
On Mon, 12 May 2014 16:19:17 +0100, Mark Lawrence wrote:

 This was *NOT* written by our resident unicode expert
 http://lucumr.pocoo.org/2014/5/12/everything-about-unicode/
 
 Posted as I thought it would make a rather pleasant change from
 interminable threads about names vs values vs variables vs objects.

Surely those example programs are not the pythonoic way to do things or 
am i missing something?

if those code samples are anything to go by this guy makes JMF look 
sensible.



-- 
The Heineken Uncertainty Principle:
You can never be sure how many beers you had last night.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Everything you did not want to know about Unicode in Python 3

2014-05-12 Thread Ian Kelly
On Mon, May 12, 2014 at 11:47 AM, alister
alister.nospam.w...@ntlworld.com wrote:
 On Mon, 12 May 2014 16:19:17 +0100, Mark Lawrence wrote:

 This was *NOT* written by our resident unicode expert
 http://lucumr.pocoo.org/2014/5/12/everything-about-unicode/

 Posted as I thought it would make a rather pleasant change from
 interminable threads about names vs values vs variables vs objects.

 Surely those example programs are not the pythonoic way to do things or
 am i missing something?

The _is_binary_reader and _is_binary_writer functions look like they
could be simplified by calling isinstance on the io object itself
against io.TextIOBase, io.BufferedIOBase or io.RawIOBase, rather than
doing those odd 0-length reads and writes.  And then perhaps those
exception-swallowing try-excepts wouldn't be necessary.  But perhaps
there's a non-obvious reason why it's written the way it is.

And there appears to be a bug where everything *except* the filename
'-' is treated as stdin, so the script probably hasn't been tested at
all.

 if those code samples are anything to go by this guy makes JMF look
 sensible.

This is an ad hominem.  Just because his code sucks doesn't mean he's
wrong about the state of Unicode and UNIX in Python 3.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions.

2014-05-12 Thread Simon Evans
I did download the latest version of Beautiful Soup 4 from the download site, 
as the book suggested. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Everything you did not want to know about Unicode in Python 3

2014-05-12 Thread MRAB

On 2014-05-12 19:31, Ian Kelly wrote:

On Mon, May 12, 2014 at 11:47 AM, alister
alister.nospam.w...@ntlworld.com wrote:

On Mon, 12 May 2014 16:19:17 +0100, Mark Lawrence wrote:


This was *NOT* written by our resident unicode expert
http://lucumr.pocoo.org/2014/5/12/everything-about-unicode/

Posted as I thought it would make a rather pleasant change from
interminable threads about names vs values vs variables vs objects.


Surely those example programs are not the pythonoic way to do things or
am i missing something?


The _is_binary_reader and _is_binary_writer functions look like they
could be simplified by calling isinstance on the io object itself
against io.TextIOBase, io.BufferedIOBase or io.RawIOBase, rather than
doing those odd 0-length reads and writes.  And then perhaps those
exception-swallowing try-excepts wouldn't be necessary.  But perhaps
there's a non-obvious reason why it's written the way it is.


How about checking sys.stdin.mode and sys.stdout.mode?


And there appears to be a bug where everything *except* the filename
'-' is treated as stdin, so the script probably hasn't been tested at
all.


if those code samples are anything to go by this guy makes JMF look
sensible.


This is an ad hominem.  Just because his code sucks doesn't mean he's
wrong about the state of Unicode and UNIX in Python 3.



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


Re: NumPy, SciPy, Python 3X Installation/compatibility issues

2014-05-12 Thread Sturla Molden
esaw...@gmail.com wrote:

 4.In the long run, would it be better to use UNIX instead of Windows, if
 I were to use Python for all of my research?
 Thanks in advance. EK

For scientific computing, a UNIX or Linux system is clearly preferable.
Most of the scientific computing software is built around the UNIX
ecosystem.

This is the reason many scientists prefer to work on a Mac. I have a UNIX
system ready to use in the terminal, developer tools are free, and it
stills runs all the deskop apps I need (even Microsoft Office).  Apple even
provides us with highly optimized LAPACK, BLAS and FFT libraries as a part
of the operating system (Accelerate Framework). Even the free NumPy and
SciPy installers can link to Accelerate on a Mac. 

Matlab runs on Linux and Mac as well. That is not s reason to stay on
Windows.

An alternative to a Mac is to install Oracle Virtualbox and use it to run
Windows or Linux. Windows as host tends to work best on a laptop. On a
workstation it does not matter. 

If you are using Windows now and are happy with it, I would suggest you
just install Ubuntu into an VM with Virtualbox and forget about Windows
installers for Python, NumPy, SciPy, et al. Spend some money to buy an SSD
drive and more RAM if you need. The performance with Virtualbox is
excellent. Get a Python distro that uses MKL for faster linear algebra,
such as Enthought or Anaconda. Windows can be a great desktop OS because of
all the available applications. It sucks rocks for any coding or scientific
computing. But there is no law that says you need to use either. You can
have the best of both world's if you like.

Sturla

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


Re: [Twisted-web] Twisted 14.0.0 Release Announcement

2014-05-12 Thread Glyph

On May 12, 2014, at 4:07 AM, HawkOwl hawk...@atleastfornow.net wrote:

 Twisted Agent can also now do HTTPS hostname verification.

I feel that it's important to note that Twisted Web's client Agent *does* do 
HTTPS hostname verification by default; you don't need to turn it on ;).

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


Re: How do I access 'Beautiful Soup' on python 2.7 or 3.4 , console or idle versions.

2014-05-12 Thread Ian Kelly
On Mon, May 12, 2014 at 10:35 AM, Simon Evans
musicalhack...@yahoo.co.uk wrote:
 Dear Ian,
 The book does recommend to use Python 2.7 (see bottom line of page 10).
 The book also recommends to use Beautiful Soup 4.
 You are right that in that I have placed the unzipped BS4 folder within a 
 folder, and I therefore removed the contents of the inner folder and 
 transferred them to the outer folder.
 The console now can access the contents of the Beautiful Soup folder, but it 
 is still having problems with it as the last output to my console 
 demonstrates :


 Microsoft Windows [Version 6.1.7601]

 Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

 C:\Users\Intel Atomcd c:\Beautiful Soup

 c:\Beautiful Soupc:\Python27\python setup.py install
 running install
 running build
 running build_py
 error: package directory 'bs4' does not exist

In the same folder where setup.py is, there should be a bs4 folder.
You might want to just wipe your Beautiful Soup directory and do a
clean unzip.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Everything you did not want to know about Unicode in Python 3

2014-05-12 Thread Ian Kelly
On Mon, May 12, 2014 at 1:42 PM, MRAB pyt...@mrabarnett.plus.com wrote:
 How about checking sys.stdin.mode and sys.stdout.mode?

Seems to work, but I notice that the docs only define the mode
attribute for the FileIO class, which sys.stdin and sys.stdout are not
instances of.
-- 
https://mail.python.org/mailman/listinfo/python-list


SQLAlchemy - web framework ?

2014-05-12 Thread flebber
If I want to use SQLAlchemy as my ORM what would be the best option for a web 
framework?

It appears the general advice regarding Django is to do it the Django way and 
use the django ORM and change it out for SQLAlchemy.

That to me limited knowledge leaves flask, pyramid and turbogears 2. So if I 
wanted to not build it all myself as with flask then potentially pyramid, 
turbogears is the best option?

Is this true? I have completed the TG2 intro tutorial and have built several 
small things with flask although I feel offput by doing anything bigger in 
flask.

See what I have done is got my python knowledge to a fair point where I can do 
useful things, good knowledge of web HTML/CSS, built a few small projects in 
flask to get an idea for python web, completed django tutorials, turogears 
tutorials and now looking to design out a bigger project I want to set myself 
and i am trying to compile the parts so I can see what I will need to use and 
gather info to cover what othe things I will need to know.

Do I have a false fear of flask and doing bigger projects?

So at this point I know I want SQLAlchemy, will use postgres(although 
mysql/maria would work fine). 

Any pratical advice warmly welcomed, I think I am thining too much aimlessly 
maybe.

http://turbogears.org/
http://www.pylonsproject.org/
http://flask.pocoo.org/
https://www.djangoproject.com/
http://www.tornadoweb.org/en/stable/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What is the difference between 32 and 64 bit Python on Windows 7 64 bit?

2014-05-12 Thread Sturla Molden

On 12/05/14 15:42, Sturla Molden wrote:


- A one-dimensional NumPy array with dtype np.float64 can keep 16 GB of
data before a 32 bit index is too small and Python starts to use long. A
two-dimensional NumPy array with dtype np.float64 can keep 256 GB of
data before a 32 bit index is too small.



Oops, the latter should be 34359738336 GB (that is, 32767 pentabytes) :)

Sturla





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


Re: Everything you did not want to know about Unicode in Python 3

2014-05-12 Thread Chris Angelico
On Tue, May 13, 2014 at 4:31 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
 Just because his code sucks doesn't mean he's
 wrong about the state of Unicode and UNIX in Python 3.

Uhm... I think wrongness of code is generally fairly indicative of
wrongness of thinking :) If I write a rant about how Python's list
type sucks and it turns out my code is using it like a cons cell and
never putting more than two elements into a list, then you would
accurately conclude that I'm wrong about the state of data type
support in Python.

I don't have a problem with someone coming to the list here with
misconceptions. That's what discussions are for. But rants like that,
on blogs, I quickly get weary of reading. The tone is always Look
what's so wrong, not inviting dialogue, and I can't be bothered
digging into the details to compose a full response. Chances are the
author's (a) not looking at what 3.4 and what's happened to improve
things (and certainly not 3.5 and what's going to happen), and (b) not
listening to responses anyway.

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


Re: What is the difference between 32 and 64 bit Python on Windows 7 64 bit?

2014-05-12 Thread Sturla Molden

On 11/05/14 08:56, Ross Gayler wrote:


Is that true?I have spent a couple of hours searching for a definitive
description of the difference between the 32 and 64 bit versions of
Python for Windows and haven't found anything.


Why do you care if a Python int object uses 32 or 64 bits internally? 
Python 2.x will automatically switch to long when needed. The size of 
the Python integer is an internal implementation detail you will not 
notice. Python knows when to use a long instead of an int. Python 3.x 
does not even have a fixed-size integer.


64 bit Python is 64 bit Python, even on Windows. The difference between 
32 bit and 64 bit Python is what you would expect: The size of a C 
pointer is 64 bits, and the virtual address space is much larger (in 
general not 2**63-1 bytes, but some OS dependent value).


Sturla



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


Re: What is the difference between 32 and 64 bit Python on Windows 7 64 bit?

2014-05-12 Thread MRAB

On 2014-05-13 00:41, Sturla Molden wrote:

On 12/05/14 15:42, Sturla Molden wrote:


- A one-dimensional NumPy array with dtype np.float64 can keep 16 GB of
data before a 32 bit index is too small and Python starts to use long. A
two-dimensional NumPy array with dtype np.float64 can keep 256 GB of
data before a 32 bit index is too small.



Oops, the latter should be 34359738336 GB (that is, 32767 pentabytes) :)


Double oops, Sturla, it's petabyte (well, pebibyte actually). :-)
--
https://mail.python.org/mailman/listinfo/python-list


Re: What is the difference between 32 and 64 bit Python on Windows 7 64 bit?

2014-05-12 Thread Chris Angelico
On Tue, May 13, 2014 at 10:05 AM, Sturla Molden sturla.mol...@gmail.com wrote:
 On 11/05/14 08:56, Ross Gayler wrote:

 Is that true?I have spent a couple of hours searching for a definitive
 description of the difference between the 32 and 64 bit versions of
 Python for Windows and haven't found anything.


 Why do you care if a Python int object uses 32 or 64 bits internally? Python
 2.x will automatically switch to long when needed. The size of the Python
 integer is an internal implementation detail you will not notice. Python
 knows when to use a long instead of an int. Python 3.x does not even have a
 fixed-size integer.

Sometimes you just want to confirm. :) Or maybe you want your program
to be able to detect which it's on. There are ways of doing both, but
sys.maxint isn't one of them, as it's specific to the int-long
promotion of Py2.

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


Re: What is the difference between 32 and 64 bit Python on Windows 7 64 bit?

2014-05-12 Thread Sturla Molden

On 13/05/14 02:09, Chris Angelico wrote:


Sometimes you just want to confirm. :) Or maybe you want your program
to be able to detect which it's on. There are ways of doing both, but
sys.maxint isn't one of them, as it's specific to the int-long
promotion of Py2.


The OPs main mistake, I guess, was to assume that sys.maxint is the 
biggest integer value Python 2.x can use.


Sturla


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


Re: SQLAlchemy - web framework ?

2014-05-12 Thread Iuri
I don't know what exactly you mean with wanted to not build it all
myself, but Flask is great with SQLAlchemy. You have the Flask-SQLAlchemy
extension and it has a lot of other integrations, like Flask-Admin.

You don't have to fear flask to bigger projects. To be honest, I prefer it
instead of Django because I can grow the project the way I want, without
framework strings.




On Mon, May 12, 2014 at 8:34 PM, flebber flebber.c...@gmail.com wrote:

 If I want to use SQLAlchemy as my ORM what would be the best option for a
 web framework?

 It appears the general advice regarding Django is to do it the Django way
 and use the django ORM and change it out for SQLAlchemy.

 That to me limited knowledge leaves flask, pyramid and turbogears 2. So if
 I wanted to not build it all myself as with flask then potentially pyramid,
 turbogears is the best option?

 Is this true? I have completed the TG2 intro tutorial and have built
 several small things with flask although I feel offput by doing anything
 bigger in flask.

 See what I have done is got my python knowledge to a fair point where I
 can do useful things, good knowledge of web HTML/CSS, built a few small
 projects in flask to get an idea for python web, completed django
 tutorials, turogears tutorials and now looking to design out a bigger
 project I want to set myself and i am trying to compile the parts so I can
 see what I will need to use and gather info to cover what othe things I
 will need to know.

 Do I have a false fear of flask and doing bigger projects?

 So at this point I know I want SQLAlchemy, will use postgres(although
 mysql/maria would work fine).

 Any pratical advice warmly welcomed, I think I am thining too much
 aimlessly maybe.

 http://turbogears.org/
 http://www.pylonsproject.org/
 http://flask.pocoo.org/
 https://www.djangoproject.com/
 http://www.tornadoweb.org/en/stable/
 --
 https://mail.python.org/mailman/listinfo/python-list

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


Re: SQLAlchemy - web framework ?

2014-05-12 Thread Ben Finney
flebber flebber.c...@gmail.com writes:

 If I want to use SQLAlchemy as my ORM what would be the best option
 for a web framework?

 It appears the general advice regarding Django is to do it the Django
 way and use the django ORM and change it out for SQLAlchemy.

You don't say any more about this. Have you evaluated this option? What
leads you to believe it is not satisfactory (as implied by the rest of
your message)?

-- 
 \ “We are no more free to believe whatever we want about God than |
  `\ we are free to adopt unjustified beliefs about science or |
_o__)  history […].” —Sam Harris, _The End of Faith_, 2004 |
Ben Finney

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


Re: SQLAlchemy - web framework ?

2014-05-12 Thread Roy Smith
In article 17149f49-bb71-4c97-9d07-d80766b93...@googlegroups.com,
 flebber flebber.c...@gmail.com wrote:

 If I want to use SQLAlchemy as my ORM what would be the best option for a web 
 framework?
 
 It appears the general advice regarding Django is to do it the Django way and 
 use the django ORM and change it out for SQLAlchemy.

I'm not quite sure how to parse that last sentence.  In any case, if 
you're afraid of using a third-party ORM with django, don't worry about 
that.  We make extensive use of django and do not use the supplied ORM 
layer.  In our case, we couldn't, because we're using MongoDB (we use 
mongoengine as our ORM).  Django is modular enough that there's really 
no problem swapping the ORM out for another component.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Everything you did not want to know about Unicode in Python 3

2014-05-12 Thread Steven D'Aprano
On Mon, 12 May 2014 17:47:48 +, alister wrote:

 On Mon, 12 May 2014 16:19:17 +0100, Mark Lawrence wrote:
 
 This was *NOT* written by our resident unicode expert
 http://lucumr.pocoo.org/2014/5/12/everything-about-unicode/
 
 Posted as I thought it would make a rather pleasant change from
 interminable threads about names vs values vs variables vs objects.
 
 Surely those example programs are not the pythonoic way to do things or
 am i missing something?

Feel free to show us your version of cat for Python then. Feel free to 
target any version you like. Don't forget to test it against files with 
names and content that:

- aren't valid UTF-8;

- are valid UTF-8, but not valid in the local encoding.



 if those code samples are anything to go by this guy makes JMF look
 sensible.

Armin Ronacher is an extremely experienced and knowledgeable Python 
developer, and a Python core developer. He might be wrong, but he's not 
*obviously* wrong.

Unicode is hard, not because Unicode is hard, but because of legacy 
problems. I can create a file on a machine that uses ISO-8859-7 for the 
file name, put JShift-JIS encoded text inside it, transfer it to a 
machine that uses Windows-1251 as the file system encoding, then SSH into 
that machine from a system using Big5, and try to make sense of it. If 
everybody used UTF-8 any time data touched a disk or network, we'd be 
laughing. It would all be so simple.

Reading Armin's post, I think that all that is needed to simplify his 
Python 3 version is:

- have a bytes version of sys.argv (bargv? argvb?) and read 
  the file names from that;

- have a simple way to write bytes to stdout and stderr.

Most programs won't need either of those, but file system utilities will.



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


Re: SQLAlchemy - web framework ?

2014-05-12 Thread Sayth Renshaw
I am saying 'do it myself' in that with flask that provide a small base and
then all functionality is added by me directly, with the assistance of
community modules. Compared to Django whose developers have created an
integrated set of defaults with more functionality standard,  which is good
if you like the defaults.

Sayth
 On 13/05/2014 10:44 am, Iuri iurisil...@gmail.com wrote:

 I don't know what exactly you mean with wanted to not build it all
 myself, but Flask is great with SQLAlchemy. You have the Flask-SQLAlchemy
 extension and it has a lot of other integrations, like Flask-Admin.

 You don't have to fear flask to bigger projects. To be honest, I prefer it
 instead of Django because I can grow the project the way I want, without
 framework strings.




 On Mon, May 12, 2014 at 8:34 PM, flebber flebber.c...@gmail.com wrote:

 If I want to use SQLAlchemy as my ORM what would be the best option for a
 web framework?

 It appears the general advice regarding Django is to do it the Django way
 and use the django ORM and change it out for SQLAlchemy.

 That to me limited knowledge leaves flask, pyramid and turbogears 2. So
 if I wanted to not build it all myself as with flask then potentially
 pyramid, turbogears is the best option?

 Is this true? I have completed the TG2 intro tutorial and have built
 several small things with flask although I feel offput by doing anything
 bigger in flask.

 See what I have done is got my python knowledge to a fair point where I
 can do useful things, good knowledge of web HTML/CSS, built a few small
 projects in flask to get an idea for python web, completed django
 tutorials, turogears tutorials and now looking to design out a bigger
 project I want to set myself and i am trying to compile the parts so I can
 see what I will need to use and gather info to cover what othe things I
 will need to know.

 Do I have a false fear of flask and doing bigger projects?

 So at this point I know I want SQLAlchemy, will use postgres(although
 mysql/maria would work fine).

 Any pratical advice warmly welcomed, I think I am thining too much
 aimlessly maybe.

 http://turbogears.org/
 http://www.pylonsproject.org/
 http://flask.pocoo.org/
 https://www.djangoproject.com/
 http://www.tornadoweb.org/en/stable/
 --
 https://mail.python.org/mailman/listinfo/python-list



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


Re: Everything you did not want to know about Unicode in Python 3

2014-05-12 Thread Chris Angelico
On Tue, May 13, 2014 at 11:18 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 Reading Armin's post, I think that all that is needed to simplify his
 Python 3 version is:

 - have a bytes version of sys.argv (bargv? argvb?) and read
   the file names from that;

argb? :)

 - have a simple way to write bytes to stdout and stderr.

I'm not sure how that goes with I/O redirection, but sure.

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


Re: a better way to operate svn with python(better than pysvn)?

2014-05-12 Thread alex23

On 13/05/2014 1:16 AM, xs.nep...@gmail.com wrote:
 ...

Rather than just send an empty message, why not explain what you don't 
like about pysvn so that someone could provide more pertinant advice?


But since you didn't: 
https://pypi.python.org/pypi?%3Aaction=searchterm=svnsubmit=search

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


Re: Everything you did not want to know about Unicode in Python 3

2014-05-12 Thread Mark H Harris

On 5/12/14 8:18 PM, Steven D'Aprano wrote:

Unicode is hard, not because Unicode is hard, but because of legacy
problems.


Yes.  To put a finer point on that, Unicode (which is only a 
specification constantly being improved upon) is harder to implement 
when it hasn't been on the design board from the ground up; Python in 
this case.


Julia has Unicode support from the ground up, and it was easier for 
those guys to implement (in beta release) than for the Python crew when 
they undertook the Unicode work that had to be done for Python3.x (just 
an observation).


Anytime there are legacy code issues, regression testing problems, and a 
host of domain issues that weren't thought through from the get-go there 
are going to be more problematic hurdles; not to mention bugs.


Having said that, I still think Unicode is somewhat harder than you're 
admitting.


marcus

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


Re: a better way to operate svn with python(better than pysvn)?

2014-05-12 Thread Mark H Harris

On 5/12/14 10:16 AM, xs.nep...@gmail.com wrote:

 {nothing}

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


Re: Everything you did not want to know about Unicode in Python 3

2014-05-12 Thread Mark Lawrence

On 13/05/2014 02:18, Steven D'Aprano wrote:

On Mon, 12 May 2014 17:47:48 +, alister wrote:


On Mon, 12 May 2014 16:19:17 +0100, Mark Lawrence wrote:


This was *NOT* written by our resident unicode expert
http://lucumr.pocoo.org/2014/5/12/everything-about-unicode/

Posted as I thought it would make a rather pleasant change from
interminable threads about names vs values vs variables vs objects.


Surely those example programs are not the pythonoic way to do things or
am i missing something?


Feel free to show us your version of cat for Python then. Feel free to
target any version you like. Don't forget to test it against files with
names and content that:

- aren't valid UTF-8;

- are valid UTF-8, but not valid in the local encoding.




if those code samples are anything to go by this guy makes JMF look
sensible.


Armin Ronacher is an extremely experienced and knowledgeable Python
developer, and a Python core developer. He might be wrong, but he's not
*obviously* wrong.

Unicode is hard, not because Unicode is hard, but because of legacy
problems. I can create a file on a machine that uses ISO-8859-7 for the
file name, put JShift-JIS encoded text inside it, transfer it to a
machine that uses Windows-1251 as the file system encoding, then SSH into
that machine from a system using Big5, and try to make sense of it. If
everybody used UTF-8 any time data touched a disk or network, we'd be
laughing. It would all be so simple.

Reading Armin's post, I think that all that is needed to simplify his
Python 3 version is:

- have a bytes version of sys.argv (bargv? argvb?) and read
   the file names from that;

- have a simple way to write bytes to stdout and stderr.

Most programs won't need either of those, but file system utilities will.



I think http://bugs.python.org/issue8776 and 
http://bugs.python.org/issue8775 are relevant but both were placed in 
the small round filing cabinet.


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


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


Re: Why isn't my re.sub replacing the contents of my MS Word file?

2014-05-12 Thread Rustom Mody
On Monday, May 12, 2014 11:05:53 PM UTC+5:30, scott...@gmail.com wrote:
 On Friday, May 9, 2014 8:12:57 PM UTC-4, Steven D'Aprano wrote:
  fStr = fStr.replace(b'#x2012', b'-')
 
Still doesn't work
 
 
  Best:
  
  
  # Untested
  
  fStr = re.sub(b'#x(201[2-5])|(2E3[AB])|(00[2A]D)', b'-', fStr)
 
   Still doesn't work.
 
   Guess whatever the code is for endash and mdash are not the ones I am 
 using

What happens if you divide two string?
 'a' / 'b'
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: unsupported operand type(s) for /: 'str' and 'str'

Or multiply 2 lists?

 [1,2]*[3,3]
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: can't multiply sequence by non-int of type 'list'

Trying to do a text operation like re.sub on a NON-text object like a doc-file
is the same.

Yes python may not be intelligent enough to give you such useful error messages
outside its territory ie on contents of random files, however logically its the
same -- an impossible operation.


The options you have:
1. Use doc-specific tools eg MS/Libre office to work on doc files ie dont use 
python
2. Follow Tim Golden's suggestion, ie use win32com which is a doc-talking
python API [BTW Thanks Tim for showing how easy it is]
3. Get out of the doc format to txt (export as plain txt) and then try what you 
are trying on the txt
-- 
https://mail.python.org/mailman/listinfo/python-list


Simple Function Decorator Sample Snippet

2014-05-12 Thread Mark H Harris
hi folks, I've come up with a simple snippet that intends to explain the 
concept of decorations without an article (for on app help), while being 
succinct and concise, while not being overly complicated.


Does this work?   I have another one coming for args, similar, if this 
works...  comments appreciated.  thanks.



# BEGIN FUNCTION DECORATOR SIMPLE 
#
# define the function decorator (wrapper function)
def enter_exit(f):
def new_f():
print(entering, f.__name__)
f()
print(f.__name__, exited !, end=\n\n)
return new_f

# the above function decoration takes a 'callable' as an argument
#and returns a 'callable' new function that is used to
#replace the original function (function is decorated),  which
#adds functionality to the original function being decorated ...

# define the original function
def f1():
print(inside f1())

# replace the original function (above) with the new decorated
#'wrapped' function using the function decoration 'enter_exit'...
f1 = enter_exit(f1)

# (OR) accomplish the same thing with decoration lines as below:

# functions wrapped with decoration lines syntax (annotations)
#as below, accomplish the same 'decoration' as above
#by using some 'syntactic sugar' to accomplish same ...

@enter_exit
def f2():
print(inside f2())

@enter_exit
def f3():
print(inside f3())

# demo the new 'decorated' functions
f1()
f2()
f3()

# END FUNCTION DECORATOR SIMPLE ##



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


Re: Everything you did not want to know about Unicode in Python 3

2014-05-12 Thread Rustom Mody
On Tuesday, May 13, 2014 6:48:35 AM UTC+5:30, Steven D'Aprano wrote:
 On Mon, 12 May 2014 17:47:48 +, alister wrote:
 
  Surely those example programs are not the pythonoic way to do things or
  am i missing something?
 
 
 
 Feel free to show us your version of cat for Python then. Feel free to 
 target any version you like. Don't forget to test it against files with 
 names and content that:
 
 
 - aren't valid UTF-8;
 
 
 - are valid UTF-8, but not valid in the local encoding.

Thanks for a non-defensive appraisal!

 
 
  if those code samples are anything to go by this guy makes JMF look
  sensible.
 
 
 
 Armin Ronacher is an extremely experienced and knowledgeable Python 
 developer, and a Python core developer. He might be wrong, but he's not 
 *obviously* wrong.
 
 
 
 Unicode is hard, not because Unicode is hard, but because of legacy 
 problems. I can create a file on a machine that uses ISO-8859-7 for the 
 file name, put JShift-JIS encoded text inside it, transfer it to a 
 machine that uses Windows-1251 as the file system encoding, then SSH into 
 that machine from a system using Big5, and try to make sense of it. If 
 everybody used UTF-8 any time data touched a disk or network, we'd be 
 laughing. It would all be so simple.

I think the most helpful way forward is to accept two things:
a. Unicode is a headache
b. No-unicode is a non-option

 
 
 
 Reading Armin's post, I think that all that is needed to simplify his 
 Python 3 version is:
 
 
 
 - have a bytes version of sys.argv (bargv? argvb?) and read 
   the file names from that;
 
 - have a simple way to write bytes to stdout and stderr.
 
 
 Most programs won't need either of those, but file system utilities will.

About the technical merits of Armin's post and your suggestions, Ive 
nothing to say, since I am an ignoramus on (the mechanics of) unicode

[Consider me an eager, early, ignorant adopter :-) ]

Its however good to note that unicode is rather unique in the history
not just of IT/CS but of humanity, in the sense that no one (to the best
of my knowledge) has ever tried to come up with an all-encompassing umbrella
for all humanity's scripts/writing systems etc.

So hiccups and mistakes are only to be expected.  The absence of these would
be much more surprising!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: SQLAlchemy - web framework ?

2014-05-12 Thread flebber
Roy.that is interesting that you can use mongoengine. 

Recent google results such as seem to assert there are a lot of inherent risk 
in swapping out components, though I may be misinterpreting it. 
http://www.slideshare.net/daikeren/tradeoffs-of-replacing-core-components

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


Re: Fortran (Was: The does Python have variables? debate)

2014-05-12 Thread Mark H Harris

On 5/12/14 3:44 AM, Alain Ketterlin wrote:

multiple-dispatch (i.e., dynamically testing types, converting to a
common type, and selecting the version of sqrt to use). That's probably
more than the time it takes to actually perform the computation, a bit
like what happens with x+y on integers with Python, where only a
fraction of time is spent on adding integers.

When you are doing scientific computation, this overhead is
unacceptable, because you'll have zillions of computations to perform.



I'm still trying to sort that out. I have not tested this yet, but 
it looks like Julia is fully dynamic (yes it has types too), and it does 
parallel processing at its core, so the zillions of computations are 
being handled all at once, depending on how many processors|cores you have.



Julia provides a way to make things fast: typing. If you provide
explicit types, the dynamic typing part obviously disappears, and
the overhead is removed.


Julia is dynamic (depending on how far you want to go with that) 
but what makes it fast is the JIT. It is almost accomplishing C/C++ and 
FORTRAN speeds (even though dynamic) because it is compiling on-the-fly.




But then, you're not too far from Fortran, or C/C++.


Right.  Again, this is really about the design goals and the JIT.


The following code will produce over 100,000 digits of π (pi) in less
than 2 seconds on a low-end processor, like my mac mini dual core
2Ghz:  {snip}


You seem to be discovering the power of the libraries that are behind
all this (MPFR in that case)...


Yes, and more+  Gnu GMP  MPFR are not new to me, but the wrapper 
and repl are !  I am just realizing the power behind the libraries in 
this context, but I am very impressed with the functionality wrapped 
around the Gnu stuff... the interface is quite nice.





But, like lisp, Julia's internal structures are lists, so, it can
create and modify its own code on-the-fly. [...]


Sorry, I was comparing to Fortran, and it's use in scientific computing.
Self modifying code is totally irrelevant there.


   no, no, no...  there has to be a value add for scientists to move 
away from R or Matlab, or from FORTRAN. Why go to the trouble?  FORTRAN 
works well (its fast too), and there are zillions of lines of code 
cranking away on huge linear arrays.  Enter Julia... over the next ten 
years; seriously. Because of the value adds!


   Why?, glad you asked.  Enter self modifying code for one. The 
influence of Lisp|Scheme is potentially huge here. For scientific 
computing the reason for making the switch is that the array functions 
being calculated now in FORTRAN can be calculated (as fast) but more 
elegantly with Julia; because the language has the ease of use of 
Python, the stats of R, the array capabilities of MatLab (on steroids) 
and the almost speed of C/C++ (all together in one package). There is 
enough of a value add in this language to make FORTRAN users (also NumPy 
SciPy) take notice.


   Yes, its on a development curve right now (very much beta); but very 
much out there with some serious capability --- right now. It will take 
some time to mature, but I really think this language has the potential 
to be around for a long long time. There needs to be some serious bench 
marking on the parallel processing model, and there needs to be some 
uptake on the user base to find out what 'they' really need from it, but 
I think this dev group is on the ball. (maybe a little too smart for 
their own good, we'll see)


   I noticed from the MIT videos 
http://julialang.org/blog/2013/03/julia-tutorial-MIT/  from a year ago 
that the project has grown with leaps and bounds... but, there is very 
much an intellectual edge here vs. a usability edge... um, the computer 
scientists are still very much in control.  It might be time for a 
larger user group to get involved with the development direction, and 
code base.


   I agree with D'Aprano that languages come and go. But I think Julia 
is different... like Python... for the scientific community; seriously. 
And, if they really are working together with certain Python group(s) to 
merge technologies, this could be big for years to come!


   I'm excited about it.


   Don't get me wrong anybody, I'm still a Pythonista!   :)


marcus

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


Re: Everything you did not want to know about Unicode in Python 3

2014-05-12 Thread Mark H Harris

On 5/13/14 12:10 AM, Rustom Mody wrote:

I think the most helpful way forward is to accept two things:
a. Unicode is a headache
b. No-unicode is a non-option


QOTW(so far...)

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


Re: Fortran (Was: The does Python have variables? debate)

2014-05-12 Thread Steven D'Aprano
On Tue, 13 May 2014 00:33:47 -0500, Mark H Harris wrote:

 there has to be a value add for scientists to move away from R or
 Matlab, or from FORTRAN. Why go to the trouble?  FORTRAN works well (its
 fast too), and there are zillions of lines of code cranking away on huge
 linear arrays.  Enter Julia... over the next ten years; seriously.
 Because of the value adds!
 
 Why?, glad you asked.  Enter self modifying code for one.

Self-modifying code is a nightmare inside the head of a Lovecraftian 
horror. There's a reason why almost the only people still using self-
modifying code are virus writers, and the viruses they create are 
notorious for being buggy.


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


Re: Everything you did not want to know about Unicode in Python 3

2014-05-12 Thread Gene Heskett
On Tuesday 13 May 2014 01:39:06 Mark H Harris did opine
And Gene did reply:
 On 5/13/14 12:10 AM, Rustom Mody wrote:
  I think the most helpful way forward is to accept two things:
  a. Unicode is a headache
  b. No-unicode is a non-option
 
 QOTW(so far...)

But its early yet, only Tuesday  its just barely started... :)

Cheers, Gene
-- 
There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order.
-Ed Howdershelt (Author)
Genes Web page http://geneslinuxbox.net:6309/gene
US V Castleman, SCOTUS, Mar 2014 is grounds for Impeaching SCOTUS
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Simple Function Decorator Sample Snippet

2014-05-12 Thread Steven D'Aprano
On Mon, 12 May 2014 23:41:18 -0500, Mark H Harris wrote:

 hi folks, I've come up with a simple snippet 

I don't think that this idea is original to you :-) I'm pretty sure many 
people have come up with the idea of a decorator that just announces when 
it runs and when it is called. I know I have  :-) 

People keep independently inventing this because it's an obvious, and 
easy to understand, example. Nicely done.


 that intends to explain the
 concept of decorations without an article (for on app help), while being
 succinct and concise, while not being overly complicated.
 
 Does this work?   I have another one coming for args, similar, if this
 works...  comments appreciated.  thanks.

I tried to run your code, but every line is quoted with a  which causes 
a syntax error. Was there a reason you quoted the snippet?



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


Re: Fortran (Was: The does Python have variables? debate)

2014-05-12 Thread Chris Angelico
On Tue, May 13, 2014 at 3:48 PM, Steven D'Aprano st...@pearwood.info wrote:
 Self-modifying code is a nightmare inside the head of a Lovecraftian
 horror. There's a reason why almost the only people still using self-
 modifying code are virus writers, and the viruses they create are
 notorious for being buggy.

Hmm... what counts as self-modifying, though? When you decorate a
function to modify its behaviour (eg add caching around it), all the
modification happens at compile time, but it's still executing
something other than what you see as the bald code. What about a
microkernel that can load altered code from the disk, compile it into
memory, and replace portions of itself? I've done that a number of
times (not in Python as it has little support for it, but in Pike it's
easy); is that self-modifying code? Or a JIT compiler. As you run
something, it gets changed in form to be more streamlined. None of
these is as horrible as the loop that fiddles with its own code on the
fly, but any of them, if buggy, will have the same effect. And all are
useful.

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


[issue21462] PEP 466: upgrade OpenSSL in the Python 2.7 Windows builds

2014-05-12 Thread Nick Coghlan

Nick Coghlan added the comment:

Yes, since OpenSSL 1.0.2 is still in beta, the target version for 2.7.7 would 
be 1.0.1g

--
nosy: +benjamin.peterson

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



[issue21474] Idle: updata fixwordbreaks() for unicode identifiers

2014-05-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think it is enough to get rid of this function.

--

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



[issue21469] False positive hazards in robotparser

2014-05-12 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


--
nosy: +ethan.furman

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



[issue21452] make_buildinfo.exe with VS2013 fails due ill-formed IntDir path

2014-05-12 Thread Mateusz Łoskot

Mateusz Łoskot added the comment:

On 9 May 2014 19:21, Tim Golden rep...@bugs.python.org wrote:

 Fixed. Thanks for the report


Thank you for the fix.

--

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



[issue1599254] mailbox: other programs' messages can vanish without trace

2014-05-12 Thread Jakub Wilk

Changes by Jakub Wilk jw...@jwilk.net:


--
nosy: +jwilk

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



[issue20115] NUL bytes in commented lines

2014-05-12 Thread Jakub Wilk

Changes by Jakub Wilk jw...@jwilk.net:


--
nosy: +jwilk

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



[issue21475] Support the Sitemap and Crawl-delay extensions in robotparser

2014-05-12 Thread Berker Peksag

Berker Peksag added the comment:

There is a patch for Crawl-delay in issue 16099.

--
nosy: +berker.peksag

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



[issue21221] Minor struct_time documentation bug

2014-05-12 Thread Jakub Wilk

Changes by Jakub Wilk jw...@jwilk.net:


--
nosy: +jwilk

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



[issue21423] concurrent.futures.ThreadPoolExecutor should accept an initializer argument

2014-05-12 Thread Martin Dengler

Changes by Martin Dengler mar...@martindengler.com:


--
nosy: +mdengler

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



[issue17756] test_syntax_error fails when run in the installed location

2014-05-12 Thread Michael Foord

Michael Foord added the comment:

It looks like the simplest fix would be to change NameError: to NameError, 
as the problem is that they're (sometimes!?) on separate lines.

This still tests what we want to test.

--

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



[issue17756] test_syntax_error fails when run in the installed location

2014-05-12 Thread Matthias Klose

Matthias Klose added the comment:

sure, doing this. my follow-up question was if it is necessary to fix anything 
else in unittest.

--

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



[issue21478] mock calls don't propagate to parent (autospec)

2014-05-12 Thread Dmitry Andreychuk

New submission from Dmitry Andreychuk:

Calls to autospecced mock functions are not recorded to mock_calls list of 
parent mock. This only happens if autospec is used and the original object is a 
function.

Example:

import unittest.mock as mock

def foo():
pass

parent = mock.Mock()
parent.child = mock.create_autospec(foo)
parent.child()
print(parent.mock_calls)


Output:
[]

Expected output:
[call.child()]

It works fine if foo function is substituted with a class.

Initially I came across this problem with patch() and attach_mock() but I 
simplified it for the demonstration.

--
components: Library (Lib)
messages: 218321
nosy: and
priority: normal
severity: normal
status: open
title: mock calls don't propagate to parent (autospec)
type: behavior
versions: Python 3.3, Python 3.4

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



[issue9400] multiprocessing.pool.AsyncResult.get() messes up exceptions

2014-05-12 Thread Martin Dengler

Changes by Martin Dengler mar...@martindengler.com:


--
nosy: +mdengler

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



[issue8296] multiprocessing.Pool hangs when issuing KeyboardInterrupt

2014-05-12 Thread Martin Dengler

Changes by Martin Dengler mar...@martindengler.com:


--
nosy: +mdengler

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



[issue21198] Minor tarfile documentation bug

2014-05-12 Thread Berker Peksag

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


--
nosy: +berker.peksag, serhiy.storchaka
stage: needs patch - patch review
Added file: http://bugs.python.org/file35223/issue21198.diff

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



[issue10744] ctypes arrays have incorrect buffer information (PEP-3118)

2014-05-12 Thread mattip

mattip added the comment:

Updated patch for default for empty shape, thanks eryksun

--
Added file: 
http://bugs.python.org/file35224/hg-default-ctypes-fix-pep3118-format-strings-for-arrays-update.patch

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



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

2014-05-12 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee:  - rhettinger
nosy: +rhettinger

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



[issue21479] Document TarFile.open() as a classmethod

2014-05-12 Thread Berker Peksag

New submission from Berker Peksag:

The patch also updates the signature of TarFile.open().

--
assignee: docs@python
components: Documentation
files: tarfile-open-classmethod.diff
keywords: patch
messages: 218323
nosy: berker.peksag, docs@python, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Document TarFile.open() as a classmethod
versions: Python 2.7, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file35225/tarfile-open-classmethod.diff

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



[issue20872] dbm/gdbm/ndbm close methods are not document

2014-05-12 Thread Berker Peksag

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


--
keywords: +patch
nosy: +berker.peksag
stage: needs patch - patch review
versions:  -Python 3.3
Added file: http://bugs.python.org/file35226/issue20872.diff

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



[issue21480] A build now requires...

2014-05-12 Thread Skip Montanaro

New submission from Skip Montanaro:

It's been awhile since I pulled from Mercurial and built, but I tried
today. I almost immediately ran into an error. The configure step
worked fine, but make, not so much:

% make
python  ./Tools/scripts/generate_opcode_h.py ./Lib/opcode.py ./Include/opcode.h
/opt/TWWfsw/bin/gmkdir -p Include
python ./Parser/asdl_c.py -h Include ./Parser/Python.asdl
Traceback (most recent call last):
  File ./Parser/asdl_c.py, line 1312, in module
main(args[0], dump_module)
  File ./Parser/asdl_c.py, line 1251, in main
if not asdl.check(mod):
  File /home/skipm/3rdParty/python/cpython/Parser/asdl.py, line 183, in check
v = Check()
  File /home/skipm/3rdParty/python/cpython/Parser/asdl.py, line 140,
in __init__
super().__init__()
TypeError: super() takes at least 1 argument (0 given)
make: *** [Include/Python-ast.h] Error 1

Trying to figure out what went wrong, I peeked in the Makefile and found:

ASDLGEN_FILES= $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
# XXX Note that a build now requires Python exist before the build starts
ASDLGEN= python $(srcdir)/Parser/asdl_c.py

This is bothersome on a couple levels. One, it assumes that python
means Python 3 (which it doesn't mean here in the office). Two, it
doesnt' offer any suggestions about how to work around this missing
bootstrap. After a couple minutes fussing around, I finally got
around the problem with a few judicious touch commands. It would be
nice if

* The above XXX comment was expanded to describe the necessary workaround

* Even better, some sort of asdl-bootstrap target (referenced in the
above comment) was added to the Makefile which sprinkled the necessary
pixie dust to artificially satisfy the AST_H and AST_C targets.

The bootstrap target shouldn't ever be executed automatically, but be
available to execute manually.

I think this would be sufficient:

# For people building for the first time without an existing Python 3
asdl-bootstrap:
touch $(AST_H) $(AST_C)

--
messages: 218324
nosy: skip.montanaro
priority: normal
severity: normal
status: open
title: A build now requires...

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



[issue21469] False positive hazards in robotparser

2014-05-12 Thread Tal Einat

Tal Einat added the comment:

Changes LGTM.

This module could certainly use some cleanup and updates. For example, 
last_changed should be a property and always accessed one way (instead of 
either .mtime() or .last_changed) and should be initialized to None instead of 
zero to avoid ambiguity, and the and/or trick should be replaced with if/else. 
Would anyone review such a patch if I created one?

--
nosy: +taleinat

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



[issue21481] Argpase Namespace object methods __eq__ and __ne__ raise TypeError when comparing to None

2014-05-12 Thread Joe Borg

New submission from Joe Borg:

See example:

 import argparse
 a = argparse.ArgumentParser()
 b = a.parse_args([])
 if b != None:
... print hey
  File stdin, line 2
print hey
  ^
SyntaxError: invalid syntax
 
 if b != None:   
... print(hey)
... 
Traceback (most recent call last):
  File stdin, line 1, in module
  File /cfd/software/Python/340/lib/python3.4/argparse.py, line 1202, in 
__ne__
return not (self == other)
  File /cfd/software/Python/340/lib/python3.4/argparse.py, line 1199, in 
__eq__
return vars(self) == vars(other)
TypeError: vars() argument must have __dict__ attribute

--
components: Library (Lib)
messages: 218326
nosy: Joe.Borg
priority: normal
severity: normal
status: open
title: Argpase Namespace object methods __eq__ and __ne__  raise TypeError when 
comparing to None
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

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



[issue21482] get_versions() in cygwinccomiler.py cannot return correct gcc version

2014-05-12 Thread Joe Chan

New submission from Joe Chan:

cannot return correct gcc version if the path name contains space.
Suggest to change to:

$ diff -rupN cygwinccompiler.py.original cygwinccompiler.py
--- cygwinccompiler.py.original 2014-05-12 23:54:01.296303800 +0800
+++ cygwinccompiler.py  2014-05-12 23:59:57.429673400 +0800
@@ -418,14 +418,14 @@ def get_versions():

 gcc_exe = find_executable('gcc')
 if gcc_exe:
-out = os.popen(gcc_exe + ' -dumpversion','r')
+out = os.popen('%s -dumpversion'%gcc_exe,'r')
 out_string = out.read()
 out.close()
 result = re.search('(\d+\.\d+(\.\d+)*)',out_string)
 if result:
 gcc_version = LooseVersion(result.group(1))
 else:
-gcc_version = None
+gcc_version = None
 else:
 gcc_version = None
 ld_exe = find_executable('ld')

--
components: Windows
messages: 218327
nosy: 3togo
priority: normal
severity: normal
status: open
title: get_versions() in cygwinccomiler.py cannot return correct gcc version
type: compile error
versions: Python 2.7

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



[issue21480] A build now requires...

2014-05-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Does make touch work for you as well?

--
components: +Devguide
nosy: +eli.bendersky, ezio.melotti, pitrou

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



[issue20969] Author of EPUB version of Python docs is set to Unknown instead of PSF

2014-05-12 Thread Berker Peksag

Berker Peksag added the comment:

Here's a patch. I followed Antoine's name suggestion.

PSF would more suitable for the epub_publisher option:

http://sphinx-doc.org/config.html#confval-epub_publisher

--
keywords: +patch
nosy: +berker.peksag
stage: needs patch - patch review
Added file: http://bugs.python.org/file35227/issue20969.diff

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



[issue21481] Argpase Namespace object methods __eq__ and __ne__ raise TypeError when comparing to None

2014-05-12 Thread Joe Borg

Joe Borg added the comment:

I believe this comes from doing vars(None).  But why would this be happening if 
Namespace is empty.

--

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



[issue21480] A build now requires...

2014-05-12 Thread Eli Bendersky

Eli Bendersky added the comment:

Skip, PTAL at the devguide.

https://docs.python.org/devguide/setup.html#avoiding-re-creating-auto-generated-files

--

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



[issue21482] get_versions() in cygwinccomiler.py cannot return correct gcc version

2014-05-12 Thread Joe Chan

Joe Chan added the comment:

better to parenthesis all three exes[gcc, ld and dllwrap] with %s to better 
support path names that contain non-alphanumeric characters.

$ diff -rupN cygwinccompiler.py.original cygwinccompiler.py
--- cygwinccompiler.py.original 2014-05-12 23:54:01.296303800 +0800
+++ cygwinccompiler.py  2014-05-13 00:24:08.754684500 +0800
@@ -418,19 +418,19 @@ def get_versions():

 gcc_exe = find_executable('gcc')
 if gcc_exe:
-out = os.popen(gcc_exe + ' -dumpversion','r')
+out = os.popen('%s -dumpversion'%gcc_exe,'r')
 out_string = out.read()
 out.close()
 result = re.search('(\d+\.\d+(\.\d+)*)',out_string)
 if result:
 gcc_version = LooseVersion(result.group(1))
 else:
-gcc_version = None
+gcc_version = None
 else:
 gcc_version = None
 ld_exe = find_executable('ld')
 if ld_exe:
-out = os.popen(ld_exe + ' -v','r')
+out = os.popen('%s -v'%ld_exe,'r')
 out_string = out.read()
 out.close()
 result = re.search('(\d+\.\d+(\.\d+)*)',out_string)
@@ -442,7 +442,7 @@ def get_versions():
 ld_version = None
 dllwrap_exe = find_executable('dllwrap')
 if dllwrap_exe:
-out = os.popen(dllwrap_exe + ' --version','r')
+out = os.popen('%s --version'%dllwrap_exe,'r')
 out_string = out.read()
 out.close()
 result = re.search(' (\d+\.\d+(\.\d+)*)',out_string)

--

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



[issue21480] A build now requires...

2014-05-12 Thread Skip Montanaro

Skip Montanaro added the comment:

 Does make touch work for you as well?

Hadn't tried, and wasn't aware of its existence. I searched Makefile
for things like AST_H. Perhaps:

* Note make touch where the A build now requires... comment
exists. That comment currently discourages users, as it gives no idea
about the possibility of a workaround for a missing python.

* Add a comment to the touch target identifying its purpose.

It hadn't occurred to me to read the dev guide. That's for new
contributors, not for old, lapsed contributors. wink Also, it still
seems to me that the ASDLGEN definition should reference something
that is explicitly Python 3 and can't accidentally execute a Python
2.x interpreter (or, the AST-generation script should work in both
Python 2.x and 3.x).

S

--

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



[issue20826] Faster implementation to collapse consecutive ip-networks

2014-05-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Here is a much faster patch, around 30x faster than the original code.

With exhuma's data set and tester.py, the original code gives:

$ time python3.4 tester.py 
Execution time: 5.949284339199949 seconds

real0m30.152s
user0m30.104s
sys 0m0.016s

The patched code gives:

$ time ./python tester.py 
Execution time: 0.25444041779992405 seconds

real0m1.695s
user0m1.681s
sys 0m0.012s


exhuma, perhaps you want to test with other data sets?

--
Added file: http://bugs.python.org/file35228/faster_collapse.patch

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



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

2014-05-12 Thread Josh Triplett

Josh Triplett added the comment:

This rejection is indeed problematic.  If mmap.mmap receives an explicit size, 
checking that size against stat will break on devices or special files.  It's 
perfectly reasonable that mmap.mmap's automatic logic when passed length=0 (to 
map the entire file) won't work if stat says the file has length 0, but the 
mmap syscall works fine on special files with length 0 (or devices), and 
mmap.mmap should work in that case as well.

--
nosy: +joshtriplett

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



[issue21483] Skip os.utime() test on NFS?

2014-05-12 Thread Skip Montanaro

New submission from Skip Montanaro:

I got a strange error during make test in a fresh build (hg clone ;
./configure ; make ; make test)

Traceback (most recent call last):
  File Lib/test/test_import.py, line 293, in test_timestamp_overflow
os.utime(source, (2 ** 33 - 5, 2 ** 33 - 5))
OSError: [Errno 22] Invalid argument

It took me a little while to figure out what was wrong. A simple check
succeeded:

 import os
 os.utime(/tmp/trash, (2 ** 33 - 5, 2 ** 33 - 5))
 2**33-5
8589934587

After a bit of poking around, I realized test.support.TESTFN is on an
NFS filesystem in my work environment:

 import importlib
 from test.support import TESTFN
 TESTFN
'@test_31576_tmp'
 import sys
 sys.path.insert(0, os.curdir)
 source = TESTFN + .py
 compiled = importlib.util.cache_from_source(source)
 compiled
'__pycache__/@test_31576_tmp.cpython-35.pyc'
 open(source, 'w')
_io.TextIOWrapper name='@test_31576_tmp.py' mode='w' encoding='ANSI_X3.4-1968'
 source
'@test_31576_tmp.py'
 os.path.getmtime(source)
1399912946.9349897
 2**33-5
8589934587
 os.utime(source, (2 ** 33 - 5, 2 ** 33 - 5))
Traceback (most recent call last):
  File stdin, line 1, in module
OSError: [Errno 22] Invalid argument
 os.utime(/tmp/trash, (2 ** 33 - 5, 2 ** 33 - 5))
 os.curdir
'.'
 os.getcwd()
'/home/skipm/3rdParty/python/cpython'

blade% df -h .
Filesystem  Size  Used Avail Use% Mounted on
nfshost3:/global/export/home/skipm  2.1T  1.5T  639G  71% /home/skipm

Should this test be skipped on NFS-mounted filesystems? Or should the
test environment try to insure TESTFN is created on a local
filesystem?

Skip

--
messages: 218336
nosy: skip.montanaro
priority: normal
severity: normal
status: open
title: Skip os.utime() test on NFS?

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



[issue20826] Faster implementation to collapse consecutive ip-networks

2014-05-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Uh, those measurements are wrong, sorry, since tester.py doesn't consume the 
iterator. When consuming the iterator, the patch is ~ 4x faster than the 
original code, which is more reasonable :-)

--

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



[issue21484] More clarity needed about difference between x += e and x = x + e

2014-05-12 Thread Feliks

New submission from Feliks:

In Sec. 7.2.1 of the Language Reference, in the description of += we have: 
Also, when possible, the actual operation is performed in-place, meaning that 
rather than creating a new object and assigning that to the target, the old 
object is modified instead.
Although this is quite accurate, not all the consequences are immediately 
obvious, and sometimes they are quite serious.  I would suggest adding a note 
that points the reader's attention in particular to the phenomenon exhibited in 
the following example:
 def f(ls):  ls += [2]
... 
 def g(ls):  ls = ls + [2]
... 
 a = [1]
 g(a)
 a
[1]
 f(a)
 a
[1, 2]

--
assignee: docs@python
components: Documentation
messages: 218338
nosy: Kluzniak, docs@python
priority: normal
severity: normal
status: open
title: More clarity needed about difference between x += e and x = x + e
type: enhancement
versions: Python 3.4

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



[issue16531] Allow IPNetwork to take a tuple

2014-05-12 Thread Antoine Pitrou

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


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

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



[issue21484] More clarity needed about difference between x += e and x = x + e

2014-05-12 Thread Josh Rosenberg

Josh Rosenberg added the comment:

It seems to me like that is one of the most obvious consequences. How is this 
not an immediately obvious consequence?

--
nosy: +josh.rosenberg

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



[issue20826] Faster implementation to collapse consecutive ip-networks

2014-05-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

It seems like the speed of Network.supernet() is a bottleneck here. issue16531 
would probably allow making supernet() much faster.

--

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



[issue16531] Allow IPNetwork to take a tuple

2014-05-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Updated patch with more tests, documentation updates, and an optimized version 
of the supernet() that's now 5x faster than the original.

I would like to commit this if there's no further comment.

--
Added file: http://bugs.python.org/file35229/issue16531-3.patch

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



[issue13742] Add a key parameter (like sorted) to heapq.merge

2014-05-12 Thread Eric Snow

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


--
nosy: +eric.snow

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



[issue17794] Add a key parameter to PriorityQueue

2014-05-12 Thread Eric Snow

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


--
nosy: +eric.snow

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



[issue21485] remove unnecesary .flush() calls in the asyncio subprocess code example

2014-05-12 Thread akira

New submission from akira:

The current code example contains [1]:

print(Python failed with exit code %s: % exitcode)
sys.stdout.flush()
sys.stdout.buffer.flush()
sys.stdout.buffer.write(stdout)
sys.stdout.buffer.flush()

that looks bizarre.

Either a comment should be added that explains why the `.flush()` calls
are necessary or they should be removed.

I've attached the documentation patch that removes the calls.

[1] 
http://hg.python.org/cpython/file/2af5a52b9b87/Doc/library/asyncio-subprocess.rst#l227

--
assignee: docs@python
components: Documentation
files: docs-subprocess-remove-unnecessary-flush-from-code-example.patch
keywords: patch
messages: 218342
nosy: akira, docs@python
priority: normal
severity: normal
status: open
title: remove unnecesary .flush() calls in the asyncio subprocess code example
versions: Python 3.4, Python 3.5
Added file: 
http://bugs.python.org/file35230/docs-subprocess-remove-unnecessary-flush-from-code-example.patch

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



  1   2   >