import locale and print range on same line

2016-01-23 Thread raiwil
Can someone tell me why next code doesn't work? import locale; locale.setlocale(locale.LC_ALL, ""); for i in range(1,20,4): print(locale.format("%2f", i, 1)) It gives an error: SyntaxError: invalid syntax --> indicating 'for' However I need to put the code on one single line. When I separate th

locale and for loop on same line

2016-01-23 Thread Ramo
Can someone tell me why this doesn't work? import locale; locale.setlocale(locale.LC_ALL, ""); for i in range(1,20,4): print(locale.format("%2f", i, 1)) It gives an error: SyntaxError: invalid syntax (highlighting the word 'for') I need this code on one and the same line. However when I separat

Re: one more question on regex

2016-01-23 Thread Vlastimil Brom
2016-01-22 23:47 GMT+01:00 mg : > Il Fri, 22 Jan 2016 21:10:44 +0100, Vlastimil Brom ha scritto: > >> [...] > > You explanation of re.findall() results is correct. My point is that the > documentation states: > > re.findall(pattern, string, flags=0) > Return all non-overlapping matches of patte

Re: import locale and print range on same line

2016-01-23 Thread Marko Rauhamaa
rai...@gmail.com: > Can someone tell me why next code doesn't work? > > import locale; locale.setlocale(locale.LC_ALL, ""); for i in > range(1,20,4): print(locale.format("%2f", i, 1)) > > It gives an error: SyntaxError: invalid syntax --> indicating 'for' > > However I need to put the code on one

Re: import locale and print range on same line

2016-01-23 Thread Vlastimil Brom
2016-01-23 11:36 GMT+01:00 Marko Rauhamaa : > rai...@gmail.com: > >> Can someone tell me why next code doesn't work? >> >> import locale; locale.setlocale(locale.LC_ALL, ""); for i in >> range(1,20,4): print(locale.format("%2f", i, 1)) >> >> It gives an error: SyntaxError: invalid syntax --> indica

Re: import locale and print range on same line

2016-01-23 Thread Ramo
This works also but I thought it was possible to do it easier: import locale; locale.setlocale(locale.LC_ALL, ""); print('\n'.join(locale.format("%2f", i, 1) for i in range(1,20,4))) -- https://mail.python.org/mailman/listinfo/python-list

Re: How to simulate C style integer division?

2016-01-23 Thread Grobu
On 22/01/16 04:48, Steven D'Aprano wrote: [ ... ] math.trunc( float(a) / b ) That fails for sufficiently big numbers: py> a = 3**1000 * 2 py> b = 3**1000 py> float(a)/b # Exact answer should be 2 Traceback (most recent call last): File "", line 1, in OverflowError: long int too large t

Re: How to simulate C style integer division?

2016-01-23 Thread Grobu
def intdiv(a, b): return (a - (a % (-b if a < 0 else b))) / b Duh ... Got confused with modulos (again). def intdiv(a, b): return (a - (a % (-abs(b) if a < 0 else abs(b / b -- https://mail.python.org/mailman/listinfo/python-list

Re: import locale and print range on same line

2016-01-23 Thread Steven D'Aprano
On Sat, 23 Jan 2016 09:02 pm, rai...@gmail.com wrote: > However I need to put the code on one single line. Why? Is the Enter key on your keyboard broken? -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: import locale and print range on same line

2016-01-23 Thread Chris Angelico
On Sun, Jan 24, 2016 at 12:07 AM, Steven D'Aprano wrote: > On Sat, 23 Jan 2016 09:02 pm, rai...@gmail.com wrote: > >> However I need to put the code on one single line. > > Why? Is the Enter key on your keyboard broken? Maybe it's for a python -c invocation. ChrisA -- https://mail.python.org/ma

Re: locale and for loop on same line

2016-01-23 Thread Bev in TX
According to the documentation, "...simple statements may occur on a single line separated by semicolons." The "for" statement is a compound, not simple, statement. Would it be possible to place your statements in a function and then you would just need to invoke the function? Bev in TX On

Re: import locale and print range on same line

2016-01-23 Thread Steven D'Aprano
On Sun, 24 Jan 2016 12:19 am, Chris Angelico wrote: > On Sun, Jan 24, 2016 at 12:07 AM, Steven D'Aprano > wrote: >> On Sat, 23 Jan 2016 09:02 pm, rai...@gmail.com wrote: >> >>> However I need to put the code on one single line. >> >> Why? Is the Enter key on your keyboard broken? > > Maybe it's

Re: import locale and print range on same line

2016-01-23 Thread Chris Angelico
On Sun, Jan 24, 2016 at 12:45 AM, Steven D'Aprano wrote: > On Sun, 24 Jan 2016 12:19 am, Chris Angelico wrote: > >> On Sun, Jan 24, 2016 at 12:07 AM, Steven D'Aprano >> wrote: >>> On Sat, 23 Jan 2016 09:02 pm, rai...@gmail.com wrote: >>> However I need to put the code on one single line. >>>

Re: import locale and print range on same line

2016-01-23 Thread Ramo
The reason why I want to have it on onto one line has nothing to do with my question, "why doesn't it work on one line" :) But if you want to know it, I use this python code in the commandline of a texteditor :) Btw.. thank you all for your help. Very happy with it :) -- https://mail.python.or

Question about asyncio and blocking operations

2016-01-23 Thread Frank Millman
Hi all I am developing a typical accounting/business application which involves a front-end allowing clients to access the system, a back-end connecting to a database, and a middle layer that glues it all together. Some time ago I converted the front-end from a multi-threaded approach to an

Re: import locale and print range on same line

2016-01-23 Thread Chris Angelico
On Sun, Jan 24, 2016 at 1:03 AM, Ramo wrote: > The reason why I want to have it on onto one line has nothing to do with my > question, "why doesn't it work on one line" :) > > But if you want to know it, I use this python code in the commandline of a > texteditor :) Called it! :) It actually h

pip install mitmproxy - fails on watchdog-0.8.3.tar.gz with "Permission denied" error (Python 2.7.11 on Win XP SP3);

2016-01-23 Thread Steve Petrie, P.Eng.
Greetings To Python-list, I'm trying to install Python package: mitmproxy (https://mitmproxy.org/) on Windows XP SP3. I'm a complete Python newbie. Not planning to do any Python programming at this time. Just trying to get package mitmproxy working (or at least the mitmdump component, sinc

Release of PyGreSQL version 4.2

2016-01-23 Thread D'Arcy J.M. Cain
The PyGreSQL team is please to announce release 4.2 of PyGreSQL. It is available at: http://pygresql.org/files/PyGreSQL-4.2.tgz. If you are running NetBSD, look in the packages directory under databases for py-postgresql. There should also be a package in the FreeBSD ports collection. Please ref

Deprecation warning for async and await

2016-01-23 Thread Marco Buttu
I enabled the deprecation warning in Python 3.5.1 and Python 3.6 dev, but I did not get any warning when assigning to async or await: $ python -Wd -c "import sys; print(sys.version); async = 33" 3.5.1 (default, Jan 21 2016, 19:59:28) [GCC 4.8.4] Is it normal? -- Marco Buttu INAF-Osservatorio

FW: Bill Sconce memorial, SAT 13 FEB, Boire Field, Nashua, NH

2016-01-23 Thread Ben Scott
:-( -- Forwarded message -- From: mad...@li.org Date: Sat, Jan 16, 2016 at 2:11 PM Subject: Bill Sconce obituary and memorial date (February 13th at Boire Field, Nashua, NH) To: "Linux, Greater" Cc: "Hall, Jon" Bill (William Joseph) Sconce, age 72, Lyndeborough, NH, died on Ja

Re: How to simulate C style integer division?

2016-01-23 Thread Jussi Piitulainen
Grobu writes: >> def intdiv(a, b): >> return (a - (a % (-b if a < 0 else b))) / b >> >> > > Duh ... Got confused with modulos (again). > > def intdiv(a, b): > return (a - (a % (-abs(b) if a < 0 else abs(b / b You should use // here to get an exact integer result. -- https://mail.pyt

Re: Question about asyncio and blocking operations

2016-01-23 Thread Chris Angelico
On Sun, Jan 24, 2016 at 1:38 AM, Frank Millman wrote: > I find I am bumping my head more that I expected, so I thought I would try > to get some feedback here to see if I have some flaw in my approach, or if > it is just in the nature of writing an asynchronous-style application. I don't have a l

Re: pip install mitmproxy - fails on watchdog-0.8.3.tar.gz with "Permission denied" error (Python 2.7.11 on Win XP SP3);

2016-01-23 Thread Chris Angelico
On Fri, Jan 22, 2016 at 3:40 AM, Steve Petrie, P.Eng. wrote: > In both failure cases, it looks to me like there is a bug in the pip logic, > that is using a *nix forward slash "/" instead of a double backslash "\\" > before the file name "make.bat". I'm not sure what your exact problem is, but I

Re: Question about asyncio and blocking operations

2016-01-23 Thread Ian Kelly
On Sat, Jan 23, 2016 at 7:38 AM, Frank Millman wrote: > Here is the difficulty. The recommended way to handle a blocking operation > is to run it as task in a different thread, using run_in_executor(). This > method is a coroutine. An implication of this is that any method that calls > it must als

Re: Question about asyncio and blocking operations

2016-01-23 Thread Ian Kelly
On Sat, Jan 23, 2016 at 8:44 AM, Ian Kelly wrote: > This is where it would make sense to me to use callbacks instead of > subroutines. You can structure your __init__ method like this: Doh. s/subroutines/coroutines -- https://mail.python.org/mailman/listinfo/python-list

Re: Question about asyncio and blocking operations

2016-01-23 Thread Frank Millman
"Frank Millman" wrote in message news:n8038j$575$1...@ger.gmane.org... So I thought I would ask here if anyone has been through a similar exercise, and if what I am going through sounds normal, or if I am doing something fundamentally wrong. Thanks for any input Just a quick note of thank

Re: How to simulate C style integer division?

2016-01-23 Thread Grobu
On 23/01/16 16:07, Jussi Piitulainen wrote: Grobu writes: def intdiv(a, b): return (a - (a % (-b if a < 0 else b))) / b Duh ... Got confused with modulos (again). def intdiv(a, b): return (a - (a % (-abs(b) if a < 0 else abs(b / b You should use // here to get an exact int

Install Numba on Debian

2016-01-23 Thread Dave Farrance
I'd like to install Numba on Debian Jessie to work with the system Python 2.7.9 (rather than installing Anaconda). When I follow the instructions at https://github.com/numba/numba#custom-python-environments ...I get errors when trying to install Numba either with the git clone method or installin

Re: pip install mitmproxy - fails on watchdog-0.8.3.tar.gz with "Permission denied" error (Python 2.7.11 on Win XP SP3);

2016-01-23 Thread Chris Angelico
On Sun, Jan 24, 2016 at 6:43 AM, Steve Petrie, P.Eng. wrote: > In case other Windows XP "orphans" want to use mitmdump, here's what I > learned (via Google): > > I changed the bang line (wrapping the pathname in double quotes) in file > mitmdump-script.py: > > from: #!e:\a p p s\python27\python.

Re: Same function but different names with different set of default arguments

2016-01-23 Thread Paulo da Silva
Às 07:30 de 21-01-2016, Paulo da Silva escreveu: > Hi all. > > What is the fastest implementation of the following code? > > def g(p): > ... > return something > > def f1(p="p1"): > return g(p) > > def f2(p="p2"): > return g(p) > Thanks to all who responded. I'll try

Re: Question about how to do something in BeautifulSoup?

2016-01-23 Thread Cody Piersall
On Fri, Jan 22, 2016 at 8:01 AM, inhahe wrote: > Say I have the following HTML (I hope this shows up as plain text here > rather than formatting): > > "Is > today the day?" > > And I want to extract the "Is today the day?" part. There are other places > in the document with and , but this is the

Re: Install Numba on Debian

2016-01-23 Thread Dave Farrance
Dave Farrance wrote: >I'd like to install Numba on Debian Jessie to work with the system >Python 2.7.9 (rather than installing Anaconda). OK, never mind. Fixed. By Googling the first error code, finding a suggested fix for that, running again, Googling the new error, and several repeats of that

Calculating longitudinal acceleration, lateral acceleration and normal acceleration

2016-01-23 Thread Robert James Liguori
Is there a python library to calculate longitudinal acceleration, lateral acceleration and normal acceleration? Thanks. -- https://mail.python.org/mailman/listinfo/python-list

How do I add 18 seconds ISO-8301 String in Python?

2016-01-23 Thread Robert James Liguori
How do I add 18 seconds to this string in Python? 2000-01-01T16:36:25.000Z -- https://mail.python.org/mailman/listinfo/python-list

Re: How do I add 18 seconds to an ISO-8601 String in Python?

2016-01-23 Thread Ben Finney
Robert James Liguori writes: (I've corrected the Subject field. The standard you're referring to is ISO 8601, I believe.) > How do I add 18 seconds to this string in Python? > > 2000-01-01T16:36:25.000Z Two separate parts: * How do I get a timestamp object from a text representation in ISO 860

Re: How do I add 18 seconds to an ISO-8601 String in Python?

2016-01-23 Thread Robert James Liguori
Oh... How do I convert it back to ISO 8301? -- https://mail.python.org/mailman/listinfo/python-list

Re: How do I add 18 seconds to an ISO-8601 String in Python?

2016-01-23 Thread Robert James Liguori
I cant thank you enough -- https://mail.python.org/mailman/listinfo/python-list

Re: How do I add 18 seconds to an ISO-8601 String in Python?

2016-01-23 Thread Robert James Liguori
Thank you so much! Btw, how do I convert back to ISO-8301? -- https://mail.python.org/mailman/listinfo/python-list

Re: How do I add 18 seconds to an ISO-8601 String in Python?

2016-01-23 Thread Michael Torrie
On 01/23/2016 07:22 PM, Robert James Liguori wrote: > Thank you so much! Btw, how do I convert back to ISO-8301? Have a look at the documentation for the datetime module. The docs will tell you how you can convert to a string, formatted to your specifications and needs. As always, the documenta

Re: import locale and print range on same line

2016-01-23 Thread Terry Reedy
On 1/23/2016 8:58 AM, Chris Angelico wrote: On Sun, Jan 24, 2016 at 12:45 AM, Steven D'Aprano wrote: On Sun, 24 Jan 2016 12:19 am, Chris Angelico wrote: On Sun, Jan 24, 2016 at 12:07 AM, Steven D'Aprano wrote: On Sat, 23 Jan 2016 09:02 pm, rai...@gmail.com wrote: However I need to put the

Re: import locale and print range on same line

2016-01-23 Thread Chris Angelico
On Sun, Jan 24, 2016 at 1:45 PM, Terry Reedy wrote: > C:\Users\Terry>python -c "for i in range(5):\n\tprint('hello world')" > File "", line 1 > for i in range(5):\n print('hello world') > ^ > SyntaxError: unexpected character after line continuat

Re: How do I add 18 seconds to an ISO-8601 String in Python?

2016-01-23 Thread Ben Finney
Robert James Liguori writes: > Thank you so much! Btw, how do I convert back to ISO-8301? You are consistently referring to “ISO 8301”, but I am confident that you are not intending to talk about: ISO 8301: Thermal insulation -- Determination of steady-state thermal resistance and rela

Re: Calculating longitudinal acceleration, lateral acceleration and normal acceleration

2016-01-23 Thread Steven D'Aprano
On Sunday 24 January 2016 11:27, Robert James Liguori wrote: > Is there a python library to calculate longitudinal acceleration, lateral > acceleration and normal acceleration? Calculate acceleration of what? I think we need some more detail before we can give a sensible answer, but you could t

Re: Calculating longitudinal acceleration, lateral acceleration and normal acceleration

2016-01-23 Thread Bernardo Sulzbach
Showing any bits of input would help us help you. Your question also seems too vague. Almost a "how to optimize". -- https://mail.python.org/mailman/listinfo/python-list

Re: Calculating longitudinal acceleration, lateral acceleration and normal acceleration

2016-01-23 Thread Steven D'Aprano
Second attempt. On Sunday 24 January 2016 11:27, Robert James Liguori wrote: > Is there a python library to calculate longitudinal acceleration, lateral > acceleration and normal acceleration? Calculate acceleration of what? I think we need some more detail before we can give a sensible answer