Good morning,
I have downloaded the version 3.4 and I have a problem to calculate the mean.
The software does not recognise the function mean(). I am getting the following
error.
>>> mean([1, 2, 3, 4, 4])
Traceback (most recent call last):
File "", line 1, in
mean([1, 2, 3, 4, 4])
NameEr
Sorry, you really can't give FunctionType an argument list.
Maybe you can wrap the function with a callable object, this way you can
change the argument list returned, and doest have to eval or compile code.
On Sep 25, 2015 12:46 AM, "Joseph L. Casale"
wrote:
> > I don't think you can easily chan
You can use the FunctionType class found in the types module (and its
friends) to create functions on the run.
And you can use the 'inspect' module to inspect existing functions, if you
need to base the new function on an existing one.
On Sep 24, 2015 11:28 PM, "Joseph L. Casale"
wrote:
> I have
On Friday, September 25, 2015 at 10:55:45 AM UTC+5:30, Cameron Simpson wrote:
> On 24Sep2015 20:57, shiva upreti wrote:
> >Thank you Cameron.
> >I think the problem with my code is that it just hangs without raising any
> >exceptions. And as mentioned by Laura above that when I press CTRL+C, it
On Thursday, September 24, 2015 at 4:09:04 PM UTC+5:30, Laura Creighton wrote:
> In a message of Wed, 23 Sep 2015 19:49:17 -0700, shiva upreti writes:
> >Hi
> >If my script hangs because of the reasons you mentioned above, why doesnt it
> >catch ConnectionError?
> >My script stops for a while and
On Thursday, September 24, 2015 at 4:09:04 PM UTC+5:30, Laura Creighton wrote:
> In a message of Wed, 23 Sep 2015 19:49:17 -0700, shiva upreti writes:
> >Hi
> >If my script hangs because of the reasons you mentioned above, why doesnt it
> >catch ConnectionError?
> >My script stops for a while and
On 24Sep2015 20:57, shiva upreti wrote:
Thank you Cameron.
I think the problem with my code is that it just hangs without raising any
exceptions. And as mentioned by Laura above that when I press CTRL+C, it just
catches that exception and prints ConnectionError which is definitely a lie in
th
Thank you Cameron.
I think the problem with my code is that it just hangs without raising any
exceptions. And as mentioned by Laura above that when I press CTRL+C, it just
catches that exception and prints ConnectionError which is definitely a lie in
this case as you mentioned.
As my code doesnt
Thank you. I didnt know about keyboard interrupt exception.
It means my code hangs without raising any exceptions, what should i do in this
case?
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, 24 Sep 2015 04:54 pm, Ben Finney wrote:
> Steven D'Aprano writes:
>
>> On Thursday 24 September 2015 16:16, Paul Rubin wrote:
>>
>> > Steven D'Aprano writes:
>> >> for k, v in mydict.items():
>> >> del(k)
>>
>> […] The obvious intent is to iterate over the *values* of the
>> diction
On Fri, 25 Sep 2015 06:46 am, Ned Batchelder wrote:
> On Thursday, September 24, 2015 at 2:02:38 AM UTC-4, Steven D'Aprano
> wrote:
>> What are your favorite not-wrong-just-weird Python moments?
>
> I've seen this a number of times:
>
> dict_of_values.update({'key': some_value})
>
> why not
On 24Sep2015 12:38, Laura Creighton wrote:
In a message of Wed, 23 Sep 2015 19:49:17 -0700, shiva upreti writes:
If my script hangs because of the reasons you mentioned above, why doesnt it
catch ConnectionError?
My script stops for a while and when I press CTRL+C, it shows ConnectionError
wi
On Fri, 25 Sep 2015 02:54 am, Todd wrote:
> Using list indexing with booleans in place of a ternary operator.
>
> a = False
> b = [var2, var1][a]
>
> Instead of:
>
> b = var1 if a else var2
Ah, you youngsters... :-)
Using a bool to index into a list used to be the standard idiom, before the
Mark Lawrence writes:
> On 24/09/2015 07:02, Steven D'Aprano wrote:
>> I was looking at an in-house code base today, and the author seems to have a
>> rather idiosyncratic approach to Python. For example:
>>
>> for k, v in mydict.items():
>> del(k)
>> ...
>>
>> instead of the more obvio
On 24/09/2015 07:02, Steven D'Aprano wrote:
I was looking at an in-house code base today, and the author seems to have a
rather idiosyncratic approach to Python. For example:
for k, v in mydict.items():
del(k)
...
instead of the more obvious
for v in mydict.values():
...
What a
On Thu, Sep 24, 2015 at 5:01 PM, Joseph L. Casale
wrote:
>> py> from inspect import Signature, Parameter
>> py> def foo(*args, **kwargs): pass
>> ...
>> py> foo.__signature__ = Signature([Parameter('x',
>> Parameter.POSITIONAL_OR_KEYWORD), Parameter('y',
>> Parameter.KEYWORD_ONLY)])
>> py> help(fo
> py> from inspect import Signature, Parameter
> py> def foo(*args, **kwargs): pass
> ...
> py> foo.__signature__ = Signature([Parameter('x',
> Parameter.POSITIONAL_OR_KEYWORD), Parameter('y',
> Parameter.KEYWORD_ONLY)])
> py> help(foo)
> Help on function foo in module __main__:
>
> foo(x, *, y)
On Wednesday, September 23, 2015 at 11:02:38 PM UTC-7, Steven D'Aprano wrote:
> I was looking at an in-house code base today, and the author seems to have a
> rather idiosyncratic approach to Python. For example:
>
>
> for k, v in mydict.items():
> del(k)
> ...
>
>
> instead of the mo
On Fri, Sep 25, 2015 at 8:19 AM, Ian Kelly wrote:
> Quick and dirty example:
>
> py> from inspect import Signature, Parameter
> py> def foo(*args, **kwargs): pass
> ...
> py> foo.__signature__ = Signature([Parameter('x',
> Parameter.POSITIONAL_OR_KEYWORD), Parameter('y',
> Parameter.KEYWORD_ONLY)]
On Thu, Sep 24, 2015 at 4:10 PM, Ian Kelly wrote:
> On Thu, Sep 24, 2015 at 2:28 PM, Joseph L. Casale
> wrote:
>> I have a class factory where I dynamically add a constructor to the class
>> output.
>> The method is a closure and works just fine, however to accommodate the
>> varied
>> input it
On Thu, Sep 24, 2015 at 2:28 PM, Joseph L. Casale
wrote:
> I have a class factory where I dynamically add a constructor to the class
> output.
> The method is a closure and works just fine, however to accommodate the varied
> input its signature is (*args, **kwargs).
>
> While I modify the doc st
On Fri, Sep 25, 2015 at 7:45 AM, Joseph L. Casale
wrote:
>> I don't think you can easily change the function's own definition,
>> other than by using eval (or equivalent shenanigans, like crafting
>> your own bytecode); but as of Python 3.something, the help() function
>> looks for a __wrapped__ a
On Fri, Sep 25, 2015 at 7:08 AM, Laura Creighton wrote:
> In a message of Thu, 24 Sep 2015 13:46:27 -0700, Ned Batchelder writes:
>>On Thursday, September 24, 2015 at 2:02:38 AM UTC-4, Steven D'Aprano wrote:
>>> What are your favorite not-wrong-just-weird Python moments?
>>
>>I've seen this a numb
> I don't think you can easily change the function's own definition,
> other than by using eval (or equivalent shenanigans, like crafting
> your own bytecode); but as of Python 3.something, the help() function
> looks for a __wrapped__ attribute and will take function args from
> that instead of th
> You can use the FunctionType class found in the types module (and its
> friends) to create functions on the run.
> And you can use the 'inspect' module to inspect existing functions, if you
> need to base the new function on an existing one.
Hi Gal,
Seems the types module docs do not even have
On Fri, Sep 25, 2015 at 6:28 AM, Joseph L. Casale
wrote:
> I have a class factory where I dynamically add a constructor to the class
> output.
> The method is a closure and works just fine, however to accommodate the varied
> input its signature is (*args, **kwargs).
>
> While I modify the doc st
In a message of Thu, 24 Sep 2015 13:46:27 -0700, Ned Batchelder writes:
>On Thursday, September 24, 2015 at 2:02:38 AM UTC-4, Steven D'Aprano wrote:
>> What are your favorite not-wrong-just-weird Python moments?
>
>I've seen this a number of times:
>
>dict_of_values.update({'key': some_value})
On Thursday, September 24, 2015 at 2:02:38 AM UTC-4, Steven D'Aprano wrote:
> What are your favorite not-wrong-just-weird Python moments?
I've seen this a number of times:
dict_of_values.update({'key': some_value})
why not:
dict_of_values['key'] = some_value
I've considered writing a P
On 09/24/2015 11:45 AM, codyw...@gmail.com wrote:
I seem to be having a problem understanding how arguments and parameters work,
Most likely why my code will not run.
Can anyone elaborate on what I am doing wrong?
'''
Cody Cox
9/16/2015
Programming Exercise 1 - Kilometer Converter
Design a modu
I have a class factory where I dynamically add a constructor to the class
output.
The method is a closure and works just fine, however to accommodate the varied
input its signature is (*args, **kwargs).
While I modify the doc strings, the ctor sig is not optimal. Without building
this a string an
On 24/09/2015 18:50, Laurent Pointal wrote:
wxjmfa...@gmail.com wrote:
Le jeudi 24 septembre 2015 08:02:38 UTC+2, Steven D'Aprano a écrit :
What are your favorite not-wrong-just-weird Python moments?
Showing how to make Python 3.5.0 crash by
just using an "é", U+00E9.
Would you like to
In <7ad8941d-04aa-42c5-82e9-10cdf02ab...@googlegroups.com> codyw...@gmail.com
writes:
> I seem to be having a problem understanding how arguments and parameters
> work, Most likely why my code will not run. Can anyone elaborate on what
> I am doing wrong?
> def get_input(kilo):
>kilo = floa
On 2015-09-24 19:45, codyw...@gmail.com wrote:
I seem to be having a problem understanding how arguments and parameters work,
Most likely why my code will not run.
Can anyone elaborate on what I am doing wrong?
'''
Cody Cox
9/16/2015
Programming Exercise 1 - Kilometer Converter
Design a modular
On Thu, Sep 24, 2015 at 2:45 PM, wrote:
> I seem to be having a problem understanding how arguments and parameters
> work, Most likely why my code will not run.
> Can anyone elaborate on what I am doing wrong?
>
> '''
> Cody Cox
> 9/16/2015
> Programming Exercise 1 - Kilometer Converter
> Design
I seem to be having a problem understanding how arguments and parameters work,
Most likely why my code will not run.
Can anyone elaborate on what I am doing wrong?
'''
Cody Cox
9/16/2015
Programming Exercise 1 - Kilometer Converter
Design a modular program that asks the user to enter a distance
On Sep 24, 2015 18:59, "Chris Angelico" wrote:
>
> On Fri, Sep 25, 2015 at 2:54 AM, Todd wrote:
> > Using list indexing with booleans in place of a ternary operator.
> >
> > a = False
> > b = [var2, var1][a]
> >
> > Instead of:
> >
> > b = var1 if a else var2
>
> Be careful - these are not semant
On Thu, Sep 24, 2015 at 12:04 PM, jmp wrote:
> I'm not an expert but I think this "return by value thing" is only for C++.
> In vintage C, you can only return something that fits within a register.
If that was true at one time, it was before ANSI C.
$ cat test.c
#include
struct foo {
int a;
On 09/24/2015 04:26 PM, Ian Kelly wrote:
On Thu, Sep 24, 2015 at 8:07 AM, jmp wrote:
result = getResult()
For the later, the original weird form come from a C habit to allocate
returned structures within the caller and provide a pointer to it so the
function can fill the data in, otherwise the
wxjmfa...@gmail.com wrote:
> Le jeudi 24 septembre 2015 08:02:38 UTC+2, Steven D'Aprano a écrit :
>>
>>
>> What are your favorite not-wrong-just-weird Python moments?
>>
>>
> Showing how to make Python 3.5.0 crash by
> just using an "é", U+00E9.
Like this ?
Python 3.5.0 (default, Sep 24 201
On Fri, Sep 25, 2015 at 2:54 AM, Todd wrote:
> Using list indexing with booleans in place of a ternary operator.
>
> a = False
> b = [var2, var1][a]
>
> Instead of:
>
> b = var1 if a else var2
Be careful - these are not semantically identical. The first one
evaluates both var1 and var2, while the
Using list indexing with booleans in place of a ternary operator.
a = False
b = [var2, var1][a]
Instead of:
b = var1 if a else var2
On Sep 24, 2015 8:06 AM, "Steven D'Aprano" <
steve+comp.lang.pyt...@pearwood.info> wrote:
> I was looking at an in-house code base today, and the author seems to h
On 23/09/2015 17:32, Denis McMahon wrote:
On Tue, 22 Sep 2015 14:43:55 -0700, Chris Roberts wrote:
results = 134523 #(Integer)
This appears to be an integer expressed (presumably) in base 10 with 6
digits
Desired:
results = [1, 2, 3, 4, 5, 2, 3] #(INDEX)
This appears to be a pyth
Two notes about local etiquette:
1) Please reply to the list rather than to me directly. I only
include your address in the cc: in case you aren't subscribed (which
you should be, unless you're reading via the newsgroup), since I don't
recognize you as a regular poster. I'll soon stop doing so.
On Thu, Sep 24, 2015 at 8:58 AM, wrote:
> Hi Sir/Madam
>
>
> When I try to run my python program where I am using the pywin32 module I am
> getting the error as win32api module not found so how to install this module
> please let me know ASP.
Have you already installed or tried to install pywin3
Good idea.
>>> [int(x) for x in str(results)]
[1, 2, 3]
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, Sep 24, 2015 at 8:07 AM, jmp wrote:
> result = getResult()
>
> For the later, the original weird form come from a C habit to allocate
> returned structures within the caller and provide a pointer to it so the
> function can fill the data in, otherwise the structure is lost as the stack
> i
Hi Sir/Madam
When I try to run my python program where I am using the pywin32 module I am
getting the error as win32api module not found so how to install this module
please let me know ASP.
Thank You
Ashwath B H
--
https://mail.python.org/mailman/listinfo/python-list
On 09/24/2015 03:45 PM, paul.hermeneu...@gmail.com wrote:
>> I'm suprised. Why not just:
>>
>> list(str(results))
>>
>> In other words, is there something else the list constructor should do
>> with a string other than convert it to a list?
>>
> The OP wanted the result to be a list of in
On 09/24/2015 02:50 PM, paul.hermeneu...@gmail.com wrote:
> A lot of our in base weird python comes from heavily C-wired people:
>
> The classic
> for i in range(len(alist)):
> print alist[i]
>
> with its twin brother
>
> i=0
> while i < len(alist):
> print alist[i]
> i += 1
>
I have server A and Server B. Server B is a hadoop cluster which has hive
database and etc..
Server A has python 2.7. I would like to write a hive query using python on
Server A to pull data from Server B. Server A and B has connectivity and no
issues with network etc..
I have installed all nec
>> I'm suprised. Why not just:
>>
>> list(str(results))
>>
>> In other words, is there something else the list constructor should do
>> with a string other than convert it to a list?
>>
> The OP wanted the result to be a list of ints, not a list of strings.
[int(x) for x in list(str(results))]
--
On 2015-09-23 10:01, Anssi Saari wrote:
Dennis Lee Bieber writes:
On Wed, 23 Sep 2015 00:21:22 +0200, Laura Creighton
declaimed the following:
You need to convert your results into a string first.
result_int=1234523
result_list=[]
for digit in str(result_int):
result_list.append(int(
Dennis Lee Bieber writes:
> On Wed, 23 Sep 2015 00:21:22 +0200, Laura Creighton
> declaimed the following:
>
>
>>
>>You need to convert your results into a string first.
>>
>>result_int=1234523
>>result_list=[]
>>
>>for digit in str(result_int):
>>result_list.append(int(digit))
>>
>
>
Try that question here:
https://mail.python.org/mailman/listinfo/cplusplus-sig
Laura
--
https://mail.python.org/mailman/listinfo/python-list
On 24/09/2015 13:50, paul.hermeneu...@gmail.com wrote:
> A lot of our in base weird python comes from heavily C-wired people:
>
> The classic
> for i in range(len(alist)):
> print alist[i]
>
> with its twin brother
>
> i=0
> while i < len(alist):
> print alist[i]
> i += 1
>
>
> A lot of our in base weird python comes from heavily C-wired people:
>
> The classic
> for i in range(len(alist)):
> print alist[i]
>
> with its twin brother
>
> i=0
> while i < len(alist):
> print alist[i]
> i += 1
>
> And the even more annoying
>
> result = Result()
> getResult(result)
>
In a message of Thu, 24 Sep 2015 02:58:35 -0700, Heli Nix writes:
>Thanks Christian,
>
>It turned out that h5py.defs was not the only hidden import that I needed to
>add.
>
>I managed to get it working with the follwoing command adding 4 hidden
>imports.
>
>
>pyinstaller --hidden-import=h5py.d
In a message of Wed, 23 Sep 2015 19:49:17 -0700, shiva upreti writes:
>Hi
>If my script hangs because of the reasons you mentioned above, why doesnt it
>catch ConnectionError?
>My script stops for a while and when I press CTRL+C, it shows ConnectionError
>without terminating the process, and the
Thanks Christian,
It turned out that h5py.defs was not the only hidden import that I needed to
add.
I managed to get it working with the follwoing command adding 4 hidden imports.
pyinstaller --hidden-import=h5py.defs --hidden-import=h5py.utils
--hidden-import=h5py.h5ac --hidden-import=h5
On 09/24/2015 08:02 AM, Steven D'Aprano wrote:
I was looking at an in-house code base today, and the author seems to have a
rather idiosyncratic approach to Python. For example:
for k, v in mydict.items():
del(k)
...
instead of the more obvious
for v in mydict.values():
...
60 matches
Mail list logo