On Mon, Apr 21, 2014 at 1:43 PM, Steven D'Aprano
wrote:
>> Both explicit forms can be done cleanly without empowering the language
>> with the magic of int/int->float.
>
> It's hardly magic, and I really am having difficult in working out
> exactly what your objection to it is. Is it really as sim
On Mon, Apr 21, 2014 at 1:43 PM, Steven D'Aprano
wrote:
>> Explicitly choosing float division:
>>
>> x / float(y)
>
> But here you're not choosing an *operator*, you're choosing a *type*.
> With this model, how do I distinguish between floor division and true
> division using, say, Fractions?
Ear
On Mon, 21 Apr 2014 10:00:01 +1000, Chris Angelico wrote:
> On Mon, Apr 21, 2014 at 9:50 AM, Walter Hurry
> wrote:
>> I would use Python 3 in a flash if only wxPython would support it.
>
> There seems to be a "Project Phoenix" (found it at the other end of a
> Google search) with that goal. I've
On Mon, 21 Apr 2014 09:24:09 +1000, Chris Angelico wrote:
> On Mon, Apr 21, 2014 at 8:52 AM, Gregory Ewing
> wrote:
>> Chris Angelico wrote:
>>
>>> Truncating vs true is not the same as int vs float. If you mean to
>>> explicitly request float division, you call float() on one or both
>>> argumen
On Sun, 20 Apr 2014 14:40:38 -0700, Roy Smith wrote:
> In article ,
> Chris Angelico wrote:
>
>> On Mon, Apr 21, 2014 at 2:22 AM, Ian Kelly
>> wrote:
>> > When I'm writing a generic average function, I probably don't know
>> > whether it will ever be used to average complex numbers.
>>
>> Thi
On Apr 20, 2014 8:01 PM, "Gregory Ewing"
wrote:
>
> Ian Kelly wrote:
>
>> def average(values):
>> return sum(values) / len(values)
>>
>> This works for decimals, it works for fractions, it works for complex
numbers, it works for numpy types, and in Python 3 it works for ints.
>
>
> That depend
Richard Damon wrote:
If you thing of the Standard Deviation being the Root Mean Norm2 of the
deviations, it has a very similar meaning as to over the reals, a
measure of the "spread" of the values.
NumPy appears to handle this:
http://docs.scipy.org/doc/numpy/reference/generated/numpy.std.html
On 21/04/2014 00:50, Walter Hurry wrote:
On Sat, 19 Apr 2014 20:25:32 -0700, Paul Rubin wrote:
Terry Reedy writes:
LibreOffice bundles 3.3. So anyone who does Python scripting in
LibreOffice is using Python 3. Actually, I believe LO uses Python
internally for some of its scripting. If so, eve
On 4/20/2014 7:13 PM, Gregory Ewing wrote:
Terry Reedy wrote:
On 4/19/2014 9:06 PM, Gregory Ewing wrote:
Similarly, when you write // you're explicitly requesting
integer division.
One is requesting 'floor division'
>>> 3.0//2.0
1.0
The name 'floor division' and the float result are inte
On Mon, Apr 21, 2014 at 9:50 AM, Walter Hurry wrote:
> I would use Python 3 in a flash if only wxPython would support it.
There seems to be a "Project Phoenix" (found it at the other end of a
Google search) with that goal. I've no idea what its status is, but
you could help that project along by
Ian Kelly wrote:
def average(values):
return sum(values) / len(values)
This works for decimals, it works for fractions, it works for complex
numbers, it works for numpy types, and in Python 3 it works for ints.
That depends on what you mean by "works". I would actually
find it rather dis
On Sat, 19 Apr 2014 20:25:32 -0700, Paul Rubin wrote:
> Terry Reedy writes:
>> LibreOffice bundles 3.3. So anyone who does Python scripting in
>> LibreOffice is using Python 3. Actually, I believe LO uses Python
>> internally for some of its scripting. If so, everyone using LO is
>> indirectly us
On Sat, 19 Apr 2014 19:37:31 +1000, Chris Angelico wrote:
>
In Python 3, you have to say "Oh but I want my integer division to
result in an integer":
I don't see why that's such a big hardship.
There are clear advantages to having an explicit way to
request non-floor division. Whatever way is
On 2014-04-20 15:34, Mariano DAngelo wrote:
> I have the following string:
...
> but since the string have { i can't.
> Is there a way to solve this?
I second Chris Angelico's suggestion about using the older percent
formatting:
nginx_conf = '''
server {
listen 80;
server_name dev
On Mon, Apr 21, 2014 at 8:52 AM, Gregory Ewing
wrote:
> Chris Angelico wrote:
>
>> Truncating vs true is not the same as int vs float. If you mean to
>> explicitly request float division, you call float() on one or both
>> arguments. You're being explicit about something different.
>
>
> If you kn
Terry Reedy wrote:
On 4/19/2014 9:06 PM, Gregory Ewing wrote:
Similarly, when you write // you're explicitly requesting
integer division.
One is requesting 'floor division'
>>> 3.0//2.0
1.0
In general that's true, but I'm talking about a context
in which you have some expectations as to t
Chris Angelico wrote:
Truncating vs true is not the same as int vs float. If you mean to
explicitly request float division, you call float() on one or both
arguments. You're being explicit about something different.
If you know you're dealing with either ints or floats,
which is true in the va
On Mon, Apr 21, 2014 at 8:34 AM, Mariano DAngelo
wrote:
> And I want to format like this:
>
> context = {
> "project_name":project_name,
> "project_url":project_url,
> }
>
> nginx_conf.format(**context)
>
>
> but since the string have { i can't.
> Is there a way to solve this?
Are you in full
I have the following string:
nginx_conf = '''
server {
listen 80;
server_name dev.{project_url};
location / {
proxy_pass http://127.0.0.1:8080;
include /etc/nginx/proxy.conf;
}
location /media {
alias /home/mariano/PycharmProjects/{project
On 4/20/14, 5:40 PM, Roy Smith wrote:
> In article ,
> Chris Angelico wrote:
>
>> On Mon, Apr 21, 2014 at 2:22 AM, Ian Kelly wrote:
>>> When I'm writing a generic average function, I probably don't know whether
>>> it will ever be used to average complex numbers.
>>
>> This keeps coming up in t
On 4/20/2014 5:40 PM, Roy Smith wrote:
In article ,
Chris Angelico wrote:
On Mon, Apr 21, 2014 at 2:22 AM, Ian Kelly wrote:
When I'm writing a generic average function, I probably don't know whether
it will ever be used to average complex numbers.
This keeps coming up in these discussion
In article ,
Chris Angelico wrote:
> On Mon, Apr 21, 2014 at 2:22 AM, Ian Kelly wrote:
> > When I'm writing a generic average function, I probably don't know whether
> > it will ever be used to average complex numbers.
>
> This keeps coming up in these discussions. How often do you really
> wr
In article <267e12d3-ea01-4886-bfa7-5c7270adb...@googlegroups.com>,
Miki Tebeka wrote:
> Greetings,
>
> How do you deal with tests (both on dev machine and Jenkins) that need
> credentials (such as AWS keys)?. I know of the following methods:
>
> 1. Test user with known (stored in source cont
On 04/20/2014 12:02 PM, Bernd Waterkamp wrote:
> Michael Torrie schrieb:
>
>> For example, RHEL 6 is Red Hat's most current enterprise distribution and
>> it does not yet even ship Python 2.7, to say nothing of Python 3. RHEL
>> 7 has python 2.7 as the default system dependency, and currently doe
On Sunday, April 20, 2014 10:43:37 PM UTC+4, Ivan Ivanivich wrote:
> hi all, i have simple programming task:
>
>
>
> [quot]
>
> If we list all the natural numbers below 10 that are multiples of 3 or 5, we
> get 3, 5, 6 and 9. The sum of these multiples is 23.
>
>
>
> Find the sum of all the
On Sun, Apr 20, 2014 at 3:02 PM, Chris Angelico wrote:
> On Mon, Apr 21, 2014 at 4:43 AM, Ivan Ivanivich
> wrote:
> > [quot]
> > If we list all the natural numbers below 10 that are multiples of 3 or
> 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
> >
> > Find the sum of all the mul
Ivan Ivanivich wrote:
> hi all, i have simple programming task:
>
> [quot]
> If we list all the natural numbers below 10 that are multiples of 3 or 5,
> we get 3, 5, 6 and 9. The sum of these multiples is 23.
>
> Find the sum of all the multiples of 3 or 5 below 1000.
> [/quote]
>
> this task f
On Mon, Apr 21, 2014 at 4:43 AM, Ivan Ivanivich wrote:
> [quot]
> If we list all the natural numbers below 10 that are multiples of 3 or 5, we
> get 3, 5, 6 and 9. The sum of these multiples is 23.
>
> Find the sum of all the multiples of 3 or 5 below 1000.
> [/quote]
>
> this task from http://pr
hi all, i have simple programming task:
[quot]
If we list all the natural numbers below 10 that are multiples of 3 or 5, we
get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
[/quote]
this task from http://projecteuler.net/ site
I wrote
Michael Torrie schrieb:
> For example, RHEL 6 is Red Hat's most current enterprise distribution and
> it does not yet even ship Python 2.7, to say nothing of Python 3. RHEL
> 7 has python 2.7 as the default system dependency, and currently does
> not yet have any python3 packages in the official
On Saturday, April 19, 2014 12:50:09 PM UTC+8, Ethan Furman wrote:
> On 04/18/2014 08:28 PM, Anthony Papillion wrote:
>
> >
>
> > What is the general feel of /this/ community? I'm about to start a
>
> > large scale Python project. Should it be done in 2 or 3? What are the
>
> > benefits, aside
On Mon, Apr 21, 2014 at 2:36 AM, Miki Tebeka wrote:
> How do you deal with tests (both on dev machine and Jenkins) that need
> credentials (such as AWS keys)?. I know of the following methods:
>
> 1. Test user with known (stored in source control) limited credentials
> 2. ~/.secrets (or any other
On Mon, Apr 21, 2014 at 2:22 AM, Ian Kelly wrote:
> When I'm writing a generic average function, I probably don't know whether
> it will ever be used to average complex numbers.
This keeps coming up in these discussions. How often do you really
write a function that generic? And if you do, isn't
On 2014-04-20 17:22, Ian Kelly wrote:
On Apr 19, 2014 2:54 PM, "Chris Angelico" mailto:ros...@gmail.com>> wrote:
>
> On Sun, Apr 20, 2014 at 6:38 AM, Ian Kelly mailto:ian.g.ke...@gmail.com>> wrote:
> >> Or you just cast one of them to float. That way you're sure you're
> >> working with floa
Greetings,
How do you deal with tests (both on dev machine and Jenkins) that need
credentials (such as AWS keys)?. I know of the following methods:
1. Test user with known (stored in source control) limited credentials
2. ~/.secrets (or any other known location) RC file which is not in source
c
On Apr 19, 2014 2:54 PM, "Chris Angelico" wrote:
>
> On Sun, Apr 20, 2014 at 6:38 AM, Ian Kelly wrote:
> >> Or you just cast one of them to float. That way you're sure you're
> >> working with floats.
> >
> > Which is inappropriate if the type passed in was a Decimal or a complex.
>
> In that cas
Many hours later I found a working solutions in ctypes:
The below makes sense to me but I am still at a loss why the first solution
did not work.
Anybody willing to explain for my better understanding?
Regards,
Alex van der Spek
_snns =
ctypes.w
On Sun, 20 Apr 2014 15:38:03 +0300, Jussi Piitulainen wrote:
> Steven D'Aprano writes:
>
>> It doesn't round, it truncates.
>>
>> [steve@ando ~]$ python2.7 -c "print round(799.0/100)" 8.0
>> [steve@ando ~]$ python2.7 -c "print 799/100" 7
>
> Seems it floors rather than truncates:
>
> $ python2
On 04/20/2014 02:47 AM, Ian Foote wrote:
>> Depends on what OS you want to be running on. I don't know of any
>> currently-supported Enterprise distributions (long-term support)
>> that ship with Python 3.4.
>
> I don't know if you'd count it as an "Enterprise" distribution, but
> ubuntu 14.04 (
Steven D'Aprano writes:
> It doesn't round, it truncates.
>
> [steve@ando ~]$ python2.7 -c "print round(799.0/100)"
> 8.0
> [steve@ando ~]$ python2.7 -c "print 799/100"
> 7
Seems it floors rather than truncates:
$ python2.7 -c "from math import trunc;print trunc(799./-100)"
-7
$ python2.7 -c "f
I have a C code function like this:
++
int __declspec(dllexport) __stdcall bnd2prb(float *in, float *out, int init)
{enum {OK, Error, Not_Valid};
...
return(OK):
}
++
And in Python I am trying to call this C function:
++
On 2014-04-20 09:43, Steven D'Aprano wrote:
> So really the advice comes down to:
>
> - if you can, use the latest version of Python, which is 3.4;
>
> - if you must, use the version of Python provided by your operating
> system, which could be anything from Python 2.3 to 3.3;
>
> - if you hav
On Sat, 19 Apr 2014 19:37:31 +1000, Chris Angelico wrote:
> On Sat, Apr 19, 2014 at 7:25 PM, Ian Kelly
> wrote:
>> The change from / denoting "classic
>> division" to "true division" really only affects the case where both
>> operands are integers, so far as I'm aware. If you want to divide two
On Sat, 19 Apr 2014 09:26:53 -0400, Roy Smith wrote:
> One of the problems is you don't know in advance if something is going
> to stop you. By committing to P3 now, you are eliminating from possible
> future use, all of those third-party modules which only support P2. And
> you don't know which
On Fri, 18 Apr 2014 23:40:18 -0700, Paul Rubin wrote:
> It's just that the improvement
> from 2 to 3 is rather small, and 2 works perfectly well and people are
> used to it, so they keep using it.
Spoken like a true ASCII user :-)
The "killer feature" of Python 3 is improved handling of Unicode,
On Fri, 18 Apr 2014 21:50:09 -0700, Ethan Furman wrote:
> Use Python 3 if you can. The best reason not to is if you have some
> critical library that you absolutely need and it's not yet available on
> 3.
That's good advice, but it isn't just applicable to Python 3, it applies
to *any* critic
Paul Rubin writes:
> [people I know] use whatever is in the OS distro, and that is
> generally still 2.6 or 2.7.
When the OS contains *both* Python 2 and Python 3, does Python 3 count
as “in the OS”?
Or will you only count Python 3 as “in the OS” when Python 2 is not
present at all in the OS?
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 20/04/14 03:34, Michael Torrie wrote:
> On 04/18/2014 10:49 PM, Andrew Berg wrote:
>> Python 3 is not the future; it is the present. If you're
>> developing an application, just use Python 3.4 and don't look
>> back unless you absolutely positively
48 matches
Mail list logo