Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64
bit (AMD64)] on win32
>>> from datetime import timedelta
>>> from babel.dates import format_timedelta
>>> td = timedelta(seconds=39.28355172422679)
>>> format_timedelta(td)
Traceback (most recent call last):
File "", line 1,
Seymore4Head wrote:
> http://www.practicepython.org/exercise/2014/03/12/06-string-lists.html
>
> Here is my answers. What would make it better?
1. Break the code into functions: one to generate a random string (the
desired length could be a parameter) and one to check if the string is a
palin
Abhiram R wrote:
> Haha. Nice. Although with your length of string and the range you're
> picking from,the chances of you getting a palindrome are (1/24!) :D
Are you sure?
>>> candidates = list(itertools.product(string.ascii_lowercase, repeat=4))
>>> len(candidates)/len([c for c in candidate
Steven D'Aprano wrote:
>On Mon, 16 Nov 2015 05:15 pm, Gregory Ewing wrote:
>
>> Ints are not the only thing that // can be applied to:
>>
>> >>> 1.0//0.01
>> 99.0
>
>Good catch!
Hmmm. I see that the float for 0.01 _is_ slightly larger than 0.01
>>> Decimal(0.01)
Decimal('0.012
HI!
It seems there are already three modules for implementing JOSE (see RFC
7515..7520). :-/
Anyone here who has practical experience with any of them (with Python 2.7.x
and preferrably with elliptic curves)?
Ciao, Michael.
pyjwkest
https://pypi.python.org/pypi/pyjwkest
JWCrypto
https://pypi.p
Hello,
does anybody know how to create a HTTPS connections in python2 or python3?
I tried second day to do that with http.client[1], but every time get error:
from http.client import HTTPSConnection
ImportError: cannot import name HTTPSConnection
Where is HTTPSConnection located? Which module?
Alex Naumov wrote:
> Hello,
>
> does anybody know how to create a HTTPS connections in python2 or python3?
> I tried second day to do that with http.client[1], but every time get
> error:
>
> from http.client import HTTPSConnection
> ImportError: cannot import name HTTPSConnection
>
>
> Where
Peter Otten <__pete...@web.de>:
> Alex Naumov wrote:
>> I tried second day to do that with http.client[1], but every time get
>> error:
>>
>> from http.client import HTTPSConnection
>> ImportError: cannot import name HTTPSConnection
>> [...]
>> I use openSUSE 13.1 x86_64.
>
> Did you compile Pyth
On Tue, Nov 17, 2015 at 12:22 PM, Peter Otten <__pete...@web.de> wrote:
> Alex Naumov wrote:
>
>> Hello,
>>
>> does anybody know how to create a HTTPS connections in python2 or python3?
>> I tried second day to do that with http.client[1], but every time get
>> error:
>>
>> from http.client import
Hello,
I installed 3.5, "successfully" as the installer indicated, yet the program
wouldn't run, with the following error message: "...failed to start because
api-ms-win-crt-runtime-I1-1-0.dll was not found. Re-installing the application
may fix this problem." I reinstalled, but no luck.
I no
Alex Naumov wrote:
> On Tue, Nov 17, 2015 at 12:22 PM, Peter Otten <__pete...@web.de> wrote:
>> Alex Naumov wrote:
>>
>>> Hello,
>>>
>>> does anybody know how to create a HTTPS connections in python2 or
>>> python3? I tried second day to do that with http.client[1], but every
>>> time get error:
>
Hello List,
I am working with relatively humongous binary files (created via cPickle),
and I stumbled across some unexpected (for me) performance differences between
two approaches I use to load those files:
1. Simply use cPickle.load(fid)
2. Read the file as binary using file.read() and
andrea.gav...@gmail.com wrote:
> Hello List,
>
> I am working with relatively humongous binary files (created via
> cPickle), and I stumbled across some unexpected (for me) performance
> differences between two approaches I use to load those files:
>
> 1. Simply use cPickle.load(f
Hi Peter,
On Tuesday, November 17, 2015 at 3:14:57 PM UTC+1, Peter Otten wrote:
> Andrea Gavana wrote:
>
> > Hello List,
> >
> > I am working with relatively humongous binary files (created via
> > cPickle), and I stumbled across some unexpected (for me) performance
> > difference
Hello,
I saw the following retweet by Raymond Hettinger in this morning:
https://twitter.com/sanityinc/status/666485814214287360
Programming tip: many of those arrays and hashes in your code
should actually be sets. Match data structures to data
constraints!
I saw just in time beca
> Hello,
>
> I installed 3.5, "successfully" as the installer indicated, yet the program
> wouldn't run, with the following error message: "...failed to start because
> api-ms-win-crt-runtime-I1-1-0.dll was not found. Re-installing the
> application may fix this problem." I reinstalled, but no
>> Hello,
>>
>> I installed 3.5, "successfully" as the installer indicated, yet the program
>> wouldn't run, with the following error message: "...failed to start because
>> api-ms-win-crt-runtime-I1-1-0.dll was not found. Re-installing the
>> application may fix this problem." I reinstalled, b
On Wed, Nov 18, 2015 at 1:20 AM, wrote:
> Thank you for your answer. I do get similar timings when I swap the two
> functions, and specifically still 15 seconds to read the file via file.read()
> and 2.4 seconds (more or less as before) via cPickle.load(fid).
>
> I thought that the order of ope
On Wed, Nov 18, 2015 at 1:27 AM, Nicolas Évrard wrote:
> I saw just in time because in a review I wrote something like this:
>
>if operator not in ('where', 'not where')
>
> and my colleague proposed that I should use a list instead of a tuple.
> But reading the mentioned tweet I tend to think
Hi Chris,
On Tuesday, November 17, 2015 at 4:20:34 PM UTC+1, Chris Angelico wrote:
> On Wed, Nov 18, 2015 at 1:20 AM, Andrea Gavana wrote:
> > Thank you for your answer. I do get similar timings when I swap the two
> > functions, and specifically still 15 seconds to read the file via
> > file.r
Hello Peter,
thanks for your reply.
>>> import ssl
Works well in python2 and 3.
Maybe somebody know another way to create a SSL connection (username/password)?
I just need to log in and log out.
Thanks,
Alex
On Tue, Nov 17, 2015 at 2:24 PM, Peter Otten <__pete...@web.de> wrote:
> Alex Naumov
andrea.gav...@gmail.com wrote:
> Hi Chris,
>
> On Tuesday, November 17, 2015 at 4:20:34 PM UTC+1, Chris Angelico wrote:
>> On Wed, Nov 18, 2015 at 1:20 AM, Andrea Gavana wrote:
>> > Thank you for your answer. I do get similar timings when I swap the two
>> > functions, and specifically still 15
On 17 November 2015 at 14:27, Nicolas Évrard wrote:
> Hello,
>
> I saw the following retweet by Raymond Hettinger in this morning:
>
>https://twitter.com/sanityinc/status/666485814214287360
>
>Programming tip: many of those arrays and hashes in your code
>should actually be sets. Match
On Tue, Nov 17, 2015 at 8:51 AM, Nagy László Zsolt wrote:
> I think Vista and XP was supported up to Python 3.4. The newest Python
> 3.5 does not support Vista or XP.
Vista is still supported in Python 3.5, but it requires the Universal
CRT update, which requires the latest Service Pack for Vista
Hi,
I find the parameters of savefig function has the similar format of that of
main(*argc, **argv) in C. I have tried with savefig("temp.pdf", format='pdf'),
and it works. I get the help content of savefig() as below.
But I cannot understand why they also give:
savefig(fname, dpi=None, facecolor
Hi Peter,
On Tuesday, November 17, 2015 at 4:57:57 PM UTC+1, Peter Otten wrote:
> Andrea Gavana wrote:
>
> > Hi Chris,
> >
> > On Tuesday, November 17, 2015 at 4:20:34 PM UTC+1, Chris Angelico wrote:
> >> On Wed, Nov 18, 2015 at 1:20 AM, Andrea Gavana wrote:
> >> > Thank you for your answer. I
On Tue, 17 Nov 2015 08:31:08 -0800, fl wrote:
> Hi,
> I find the parameters of savefig function has the similar format of that
> of main(*argc, **argv) in C. I have tried with savefig("temp.pdf",
> format='pdf'),
> and it works. I get the help content of savefig() as below.
> But I cannot understa
andrea.gav...@gmail.com wrote:
>> > I am puzzled with no end... Might there be something funny with my C
>> > libraries that use fread? I'm just shooting in the dark. I have a
>> > standard Python installation on Windows, nothing fancy :-(
>>
>> Perhaps there is a size threshold? You could experi
Playing around a bit with PEP 484, I annotated a function that returns
an asyncio.Future:
import asyncio
def get_future() -> asyncio.Future[int]:
future = asyncio.Future()
future.set_result(42)
return future
The problem with this is that in Python 3.5, asyncio.Future can't be
used as
Hi,
I find the following code snippet, which is useful in my project:
n_iter = 50
sz = (n_iter,) # size of array
x = -0.37727
z = np.random.normal(x,0.1,size=sz)
Q = 1e-5 # process variance
# allocate space for arrays
xhat=np.zeros(sz)
P=np.zeros(sz)
I learn Python now and t
In fl
writes:
> correctly. Could you see something useful with variable 'sz'?
'sz' is fewer characters than '(n_iter,)', which may make your code easier
to read.
The np.zeros() function explicitly accepts an 'int or sequence of ints',
so you don't specifically need a sequence. Is the same tr
On Tuesday, November 17, 2015 at 4:03:05 PM UTC-5, John Gordon wrote:
> In fl <@gmail.com>
> writes:
>
> > correctly. Could you see something useful with variable 'sz'?
>
> 'sz' is fewer characters than '(n_iter,)', which may make your code easier
> to read.
>
> The np.zeros() function explici
In fl
writes:
> I still don't see the necessity of 'sz'. Thanks,
sz isn't required. You can use (n_iter,) in place of sz.
However, as I posted earlier, sz is shorter so it might make your code
easier to read.
Using sz can also lead to easier code maintenance. If the contents of
the tuple w
On 17/11/2015 21:27, fl wrote:
On Tuesday, November 17, 2015 at 4:03:05 PM UTC-5, John Gordon wrote:
In fl <@gmail.com>
writes:
correctly. Could you see something useful with variable 'sz'?
'sz' is fewer characters than '(n_iter,)', which may make your code easier
to read.
The np.zeros()
Hi,
Do you know if there is a library to match a python package (from PyPI)
and find the right debian/redhat packages ?
Thank you,
Stephane
--
Stéphane Wirtel - http://wirtel.be - @matrixise
--
https://mail.python.org/mailman/listinfo/python-list
Stephane Wirtel writes:
> Do you know if there is a library to match a python package (from PyPI)
> and find the right debian/redhat packages ?
What would count as “the right package”?
Do you mean “the package that has that PyPI distribution URL in its
‘debian/watch’ configuration”?
Do you mea
On Wed, Nov 18, 2015 at 3:33 PM, Ben Finney wrote:
> What would count as “the right package”?
>
> Do you mean “the package that has that PyPI distribution URL in its
> ‘debian/watch’ configuration”?
>
> Do you mean “the package that names that PyPI distribution in its
> ‘debian/copyright’ “Source”
Hello,
I'm trying to implement some (but not all) methods of a Python class in C.
What I've found on the Net is:
- how to implement entire modules in C so that I can import that module and
use the C functions (successfully done it, too).
- how to implement entire classes in C
But I can't fin
38 matches
Mail list logo