Hi Python community,
I am new to Python and currently taking one online course of computer
science and programming using Python. I really like Python because it is
simple and clarity but powerful to me.
I just joint Python mailing list and i hope to enjoy Python programming
discussion with you all.
Hi friends!
Can some one help me with the best module and/or its tutorial, to generate html
reports for python scripts?
I tried pyreport and sphc; but, i am getting errors.
--
https://mail.python.org/mailman/listinfo/python-list
On Sep 2, 2015 7:51 PM, "Steven D'Aprano" wrote:
>
> What's the alternative? I asked this question earlier, and got no answer --
> apparently at least three people prefer behaviour that they cannot explain
> how to get the results they want :-)
>
> As far as I am concerned, having both of these:
>
On Thu, 3 Sep 2015 04:47 am, t...@freenet.de wrote:
> I agree with Skybuck Flying.
> I am aware if a var is a module function var or a module global var.
Congratulations!
But you're not the Python compiler, which doesn't have your superior insight
and intuition.
Inside a function, how is the co
On Thu, 3 Sep 2015 04:06 am, Ian Kelly wrote:
> On Wed, Sep 2, 2015 at 11:42 AM, Terry Reedy wrote:
>> On 9/2/2015 6:01 AM, Antoon Pardon wrote:
>>>
>>>
>> a = [1, 2, 3, 4, 5]
>> b = 1
>> b, a[b] = a[b], b
>> a
>>>
>>> [1, 2, 1, 4, 5]
[...]
> I do. I think the former behavior is
On Saturday, 14 March 2015 02:36:01 UTC+10, David H. Lipman wrote:
>
>
> > KB 2670838 - The EVIL UPDATE
>
>
> < snip >
>
>
> > GOODBYE,
> > FAILURE TO DO SO PUTS YOUR SYSTEMS AT RISK !
> >
> >
> > Bye,
> > Skybuck.
>
> I hope you like the taste of shoe leather.
>
> KB2670838 ==>
On 02/09/2015 23:25, t...@freenet.de wrote:
Therefore still hoping a new PEP will arise.
@Mark Lawrence
This response I have not checked. Can you provide arguments or clarify your
statement?
The over use of globals is never to be encouraged, which is precisely
what this would do. You could
On Wed, Sep 2, 2015, at 13:26, Sven R. Kunze wrote:
> I agree as well. First evaluate the right side, then assign it to the
> left side at once.
The behavior, if it's *not* "first evaluating the right side", is
indistinguishable from it by this test. Assigning the RHS of each case
to a separate l
On 02/09/2015 19:47, t...@freenet.de wrote:
Even Java (type-safe language) need not such things for its static or member
vars.
By this comment are you stating that Python is not type safe?
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language
On 03/09/2015 01:16, Vladimir Ignatov wrote:
Hi,
my 0.02
I don't personally use globals. And don't like "object oriented" code
(my code more inclined toward "functional" style). But sometimes I
feel like passing various minor values (like settings) all around app
via regular parameters is just
Hi,
my 0.02
I don't personally use globals. And don't like "object oriented" code
(my code more inclined toward "functional" style). But sometimes I
feel like passing various minor values (like settings) all around app
via regular parameters is just too much work. So I use
"pseudo-global" object
b, a[b] = a[b], b
Nice. If I ever notice that kind of code in our codebase I'll 1)
check file history to find out the "author" 2) ask that guy to remove
it immediately :-)
Vladimir
http://itunes.apple.com/us/app/python-code-samples/id1025613117
--
https://mail.python.org/mailman/listinf
On Wed, Sep 2, 2015 at 4:25 PM, wrote:
> That said, it is not an overusing of globals cause globals are module vars
> only.
> Or have you never written singletons or other classes in e.g Java, C++ with
> lots of static and class members and methods using this members.
I do use lots of static me
On Wednesday, September 2, 2015 at 6:29:05 PM UTC-4, Chris Angelico wrote:
> On Thu, Sep 3, 2015 at 8:15 AM, kbtyo wrote:
> > However, when I hit line 40 (referencing the gist), I receive the following
> > error:
> >
> > ---
>
MRAB wrote:
> On 2015-09-02 03:03, Rob Hills wrote:
>> Hi,
>>
>> I am developing code (Python 3.4) that transforms text data from one
>> format to another.
>>
>> As part of the process, I had a set of hard-coded str.replace(...)
>> functions that I used to clean up the incoming text into the desir
In <6c0af13a-a07d-4c29-b1fd-dd53768e6...@googlegroups.com> kbtyo
writes:
> https://gist.github.com/ahlusar1989/de2381c1fb77e96ae601
Are you sure this is the actual code you're running? Lines 48 and 49 are
clearly meant to be comments, but they do not begin with a hash sign.
--
John Gordon
On 2015-09-02 03:03, Rob Hills wrote:
Hi,
I am developing code (Python 3.4) that transforms text data from one
format to another.
As part of the process, I had a set of hard-coded str.replace(...)
functions that I used to clean up the incoming text into the desired
output format, something like
Reflecting the answers I want to add following:
Considering class usage is something I thought about
but is not the way I want use Python so far.
If so, I could stay on oo-scripting languages as well.
It is the good idea of Python about modules which are singletons
and therefore have already i
On Thu, Sep 3, 2015 at 8:15 AM, kbtyo wrote:
> However, when I hit line 40 (referencing the gist), I receive the following
> error:
>
> ---
> TypeError Traceback (most recent call last)
> in (
I am currently using Jupyter and Pythopn 3.4. I am currently using the
following script to parse and convert XML data structures, nested in a CSV -
formatted file, convert into a dictionary and then append write it back into
the same CSV. I am using the following (I added comments to explain the
On Wed, Sep 2, 2015 at 12:03 PM, Rob Hills wrote:
> My mapping file contents look like this:
>
> \r = \\n
> “ = "
Oh, lovely. Code page 1252 when you're expecting UTF-8. Sadly, you're
likely to have to cope with a whole pile of other mojibake if that
happens :(
You have my sympathy.
> < = <
>
On Wed, Sep 2, 2015 at 1:30 PM, wrote:
> Where are the error messages stored? E. g., in which (source code) file is
> the message "NameError: name 'sdfe' is not defined" stored (except for
> variable arguments like "sdfe")? I do know that I can throw exceptions for
> myself, but this question
On 02/09/2015 19:47, t...@freenet.de wrote:
I agree with Skybuck Flying.
First problem.
Using the keyword global inside each(!) function only
to mark the global var writeable in each of the functions
is really an over-regulation and very annoying from my point of view.
Second problem. Any
Where are the error messages stored? E. g., in which (source code) file is the
message "NameError: name 'sdfe' is not defined" stored (except for variable
arguments like "sdfe")? I do know that I can throw exceptions for myself, but
this question came to my mind in thinking about translating the
Hi,
I am developing code (Python 3.4) that transforms text data from one
format to another.
As part of the process, I had a set of hard-coded str.replace(...)
functions that I used to clean up the incoming text into the desired
output format, something like this:
dataIn = dataIn.replace('\r'
On 2015-09-02 21:08, Sven R. Kunze wrote:
On 02.09.2015 20:47, t...@freenet.de wrote:
I agree with Skybuck Flying.
I am aware if a var is a module function var or a module global var.
If I want read or write a global var.
Using the keyword global inside each(!) function only
to mark the global
On 02.09.2015 19:42, Terry Reedy wrote:
On 9/2/2015 6:01 AM, Antoon Pardon wrote:
a = [1, 2, 3, 4, 5]
b = 1
b, a[b] = a[b], b
a
[1, 2, 1, 4, 5]
a = [1, 2, 3, 4, 5]
b = 1
a[b], b = b, a[b]
a
[1, 1, 3, 4, 5]
I think I understand how it gets these results
but I'm not really happy with them. I
Hi everyone,
I need to do splines in a dxf file with a script, so I use python dxfwrite : It
seems that it is the best thing that exists... But impossible to be sure.
But I have a problem with : when I run this sample script :
---
#!/usr/bin/python
from dxfwrite import
On 02.09.2015 20:47, t...@freenet.de wrote:
I agree with Skybuck Flying.
I am aware if a var is a module function var or a module global var.
If I want read or write a global var.
Using the keyword global inside each(!) function only
to mark the global var writeable in each of the functions
is r
On Wed, Sep 2, 2015 at 12:47 PM, wrote:
> Using the keyword global inside each(!) function only
> to mark the global var writeable in each of the functions
> is really an over-regulation and very annoying from my point of view.
To me, marking a variable as global in a large number of functions i
And to clarify: I have not spoken about sharing constants global (spanning
over modules), where the solution provided here using imports is the solution.
I have spoken from module vars which are named or are "globals" and its
read/write access constraints inside module functions. So even the n
On 9/2/2015 11:47 AM, t...@freenet.de wrote:
I therefore would like to see a PEP which allows also writing
global module vars inside module functions without the need
for explicit setting the keyword "global" in more or less each(!)
module function as the first line of code.
If you're feeling
On Wed, 2 Sep 2015 19:06 Steven D'Aprano wrote:
Howdy,
I have a utility function for performing atomic file saves, and I'd like to
ask for a code review and comments.
I have published this on ActiveState:
https://code.activestate.com/recipes/579097-safely-and-atomically-write-to-a-file/
under
Hakugin: Thanks for the correction. Someone elsewhere showed me example
code that was very close to yours, with that being the main difference.
His gave an error message that red_button was undefined so I moved the
code block below the callbacks. After that it ran without producing
errors but
Where are you running the code from?
The interactive prompt? (E.g. idle, or after you type "python" at the
terminal) or from the terminal? (as in by typing "python p2.py" at the
terminal).
It looks like you're trying to load a file while in the interactive prompt
which won't work that way (it wil
I agree with Skybuck Flying.
I am aware if a var is a module function var or a module global var.
If I want read or write a global var.
Using the keyword global inside each(!) function only
to mark the global var writeable in each of the functions
is really an over-regulation and very annoying f
>import numpy as np
>
>import netCDF4
>
>f = netCDF4.Dataset('uwnd.mon.ltm.nc','r')
>
>
>f.variables
>
>
>and I had the message:
>
>
>netcdf4.py
>Traceback (most recent call last):
>File "", line 1, in
>NameError: name 'netcdf4' is not defined
You have a file called netcdf4.py
It contains the
Hi,
I have a Python version: Python 2.7.8
I'm runing it on: Fedora release 21
Yesterday I a sent a question:
I'm starting in the Python scripts. I run this script:
import numpy as np
import netCDF4
f = netCDF4.Dataset('uwnd.mon.ltm.nc','r')
f.variables
and I had the message:
netcd
On Wed, Sep 2, 2015 at 11:42 AM, Terry Reedy wrote:
> On 9/2/2015 6:01 AM, Antoon Pardon wrote:
>>
>>
> a = [1, 2, 3, 4, 5]
> b = 1
> b, a[b] = a[b], b
> a
>>
>> [1, 2, 1, 4, 5]
>
> a = [1, 2, 3, 4, 5]
> b = 1
> a[b], b = b, a[b]
> a
>>
>> [1, 1, 3, 4, 5]
>>
>>
Howdy,
I have a utility function for performing atomic file saves, and I'd like to
ask for a code review and comments.
I have published this on ActiveState:
https://code.activestate.com/recipes/579097-safely-and-atomically-write-to-a-file/
under an MIT licence. You should read the version there
On 9/2/2015 6:04 AM, Victor Hooi wrote:
I'm using grouper() to iterate over a textfile in groups of lines:
def grouper(iterable, n, fillvalue=None):
"Collect data into fixed-length chunks or blocks"
# grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx
args = [iter(iterable)] * n
retu
On 9/2/2015 6:01 AM, Antoon Pardon wrote:
a = [1, 2, 3, 4, 5]
b = 1
b, a[b] = a[b], b
a
[1, 2, 1, 4, 5]
a = [1, 2, 3, 4, 5]
b = 1
a[b], b = b, a[b]
a
[1, 1, 3, 4, 5]
I think I understand how it gets these results
but I'm not really happy with them. I think python
should give the second resu
On 9/2/2015 8:26 AM, Steven D'Aprano wrote:
On Wed, 2 Sep 2015 08:01 pm, Antoon Pardon wrote:
a = [1, 2, 3, 4, 5]
b = 1
b, a[b] = a[b], b
a
[1, 2, 1, 4, 5]
Equivalent to:
temp1 = a[b] # a[1] == 2
temp2 = b # 1
b = temp1 # b = 2
a[b] = temp2 # a[2] = 1
Or using a queue (FIFO) rather
I agree as well. First evaluate the right side, then assign it to the
left side at once.
On 02.09.2015 12:22, Nick Sarbicki wrote:
That's interesting. I agree with you, I'd prefer the second result in
both cases.
But makes sense as it evaluates left to right and seems to break up
the unpacki
On 02/09/2015 13:03, Victor Hooi wrote:
How many times do people have to be asked before they stop top posting?
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
--
https://mail.python.org/mailman/listinfo/python-list
On 02/09/2015 11:01, Antoon Pardon wrote:
a = [1, 2, 3, 4, 5]
b = 1
b, a[b] = a[b], b
a
[1, 2, 1, 4, 5]
a = [1, 2, 3, 4, 5]
b = 1
a[b], b = b, a[b]
a
[1, 1, 3, 4, 5]
I think I understand how it gets these results
but I'm not really happy with them. I think python
should give the second resu
I'm not sure how long this has been the case, but Raymond Hettinger is now
featured on the ActiveState page with a link direct to his recipes.
https://code.activestate.com/
Raymond has long been one of the most productive and popular recipe writers
on ActiveState, with many of his recipes being a
On Wed, 2 Sep 2015 09:49 pm, Victor Hooi wrote:
> I have a function which is meant to return a tuple:
>
> def get_metrics(server_status_json, metrics_to_extract, line_number):
>
> return ((timestamp, "serverstatus", values, tags))
>
> I also have:
>
> def create_point(t
Steven D'Aprano writes:
> On Wed, 2 Sep 2015 09:49 pm, Victor Hooi wrote:
>
>> I have a function which is meant to return a tuple:
>>
>> def get_metrics(server_status_json, metrics_to_extract, line_number):
>>
>> return ((timestamp, "serverstatus", values, tags))
[- -]
>> I
On Wed, 2 Sep 2015 09:49 pm, Victor Hooi wrote:
> I have a function which is meant to return a tuple:
>
> def get_metrics(server_status_json, metrics_to_extract, line_number):
>
> return ((timestamp, "serverstatus", values, tags))
No need for the second pair of parentheses.
On Wed, Sep 2, 2015 at 11:59 PM, Antoon Pardon
wrote:
>> But if you're confused by
>> it, there's a simple solution: Don't reference the same "thing" more
>> than once on the LHS.
>
> That is rather extreme. It would mean we avoid the following:
>
> a[i], b[i] = b[i], a[i] # references i twice on
Op 02-09-15 om 14:45 schreef Chris Angelico:
> On Wed, Sep 2, 2015 at 10:26 PM, Steven D'Aprano wrote:
>>> I think I understand how it gets these results
>>> but I'm not really happy with them. I think python
>>> should give the second result in both cases.
>> Apart from breaking backwards compati
Victor Hooi wrote:
> Hi Peter,
>
> Hmm, are you sure that will work?
If you want the starting line for the batch, yes:
$ cat tmp.txt
alpha (line #1)
beta (line #2)
gamma (line #3)
delta (line #4)
epsilon (line #5)
zeta (line #6)
eta (line #7)
theta (line #8)
iota (line #9)
kappa (line #10)
$ ca
On Wed, Sep 2, 2015 at 10:26 PM, Steven D'Aprano wrote:
>> I think I understand how it gets these results
>> but I'm not really happy with them. I think python
>> should give the second result in both cases.
>
> Apart from breaking backwards compatibility, how would you implement such a
> thing? A
On Wed, 2 Sep 2015 08:01 pm, Antoon Pardon wrote:
>
a = [1, 2, 3, 4, 5]
b = 1
b, a[b] = a[b], b
a
> [1, 2, 1, 4, 5]
Equivalent to:
temp1 = a[b] # a[1] == 2
temp2 = b # 1
b = temp1 # b = 2
a[b] = temp2 # a[2] = 1
Or using a queue (FIFO) rather than temp variables:
push
Victor Hooi writes:
> I have a function which is meant to return a tuple:
>
> def get_metrics(server_status_json, metrics_to_extract, line_number):
>
> return ((timestamp, "serverstatus", values, tags))
That returns a single tuple of four values. The double parentheses are
re
Hi Peter,
Hmm, are you sure that will work?
The indexes returned by enumerate will start from zero.
Also, I've realised line_number is a bit of a misnomer here - it's actually the
index for the chunks that grouper() is returning.
So say I had a 10-line textfile, and I was using a _BATCH_SIZE o
I have a function which is meant to return a tuple:
def get_metrics(server_status_json, metrics_to_extract, line_number):
return ((timestamp, "serverstatus", values, tags))
I also have:
def create_point(timestamp, metric_name, values, tags):
return {
In a message of Wed, 02 Sep 2015 12:14:44 +0200, Antoon Pardon writes:
See:
https://docs.python.org/3.5/library/logging.html#levels
you can just use 30 everywhere for warning, and that is what
Logger.getEffectiveLevel() will tell you even if you initialised
it with the text form.
Laura
--
https
Victor Hooi wrote:
> I'm using grouper() to iterate over a textfile in groups of lines:
>
> def grouper(iterable, n, fillvalue=None):
> "Collect data into fixed-length chunks or blocks"
> # grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx
> args = [iter(iterable)] * n
> return zip_longe
That's interesting. I agree with you, I'd prefer the second result in both
cases.
But makes sense as it evaluates left to right and seems to break up the
unpacking into separate statements.
Could be useful if you want to hold the results of a generator in sequence,
can call the same function mult
Op 02-09-15 om 11:50 schreef Peter Otten:
> Antoon Pardon wrote:
>
>> I am writing an application that will do the necessary logging.
>> However I want the level of logging to be deciced by a value
>> in a config file. Like the following:
>>
>> loglevel = WARNING
>>
>> But I can't find a function t
>>> a = [1, 2, 3, 4, 5]
>>> b = 1
>>> b, a[b] = a[b], b
>>> a
[1, 2, 1, 4, 5]
>>> a = [1, 2, 3, 4, 5]
>>> b = 1
>>> a[b], b = b, a[b]
>>> a
[1, 1, 3, 4, 5]
I think I understand how it gets these results
but I'm not really happy with them. I think python
should give the second result in both cases
I'm using grouper() to iterate over a textfile in groups of lines:
def grouper(iterable, n, fillvalue=None):
"Collect data into fixed-length chunks or blocks"
# grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx
args = [iter(iterable)] * n
return zip_longest(fillvalue=fillvalue, *args)
Ho
Antoon Pardon wrote:
> I am writing an application that will do the necessary logging.
> However I want the level of logging to be deciced by a value
> in a config file. Like the following:
>
> loglevel = WARNING
>
> But I can't find a function that does this.
>
> The reverse is possible with l
I am writing an application that will do the necessary logging.
However I want the level of logging to be deciced by a value
in a config file. Like the following:
loglevel = WARNING
But I can't find a function that does this.
The reverse is possible with logging.getLevelName. The documentation
a
In a message of Wed, 02 Sep 2015 10:50:15 +1000, Chris Angelico writes:
>And compiled C programs are notoriously hard to distribute. Can you
>pick up a Guile binary and carry it to another computer? Do you have
>to absolutely perfectly match the libguile version, architecture,
>build settings, etc?
Op 18-08-15 om 04:57 schreef harirammanohar...@gmail.com:
> execute commands as su on remote server
>
> Postby hariram » Mon Aug 17, 2015 4:02 am
> Needed:
> I need to execute commands after doing su to other user on remote server(not
> sudo which doesn't require password) how i can achieve this u
In a message of Tue, 01 Sep 2015 22:19:15 -, Grant Edwards writes:
>On 2015-09-01, Laura Creighton wrote:
>
>> Don't go around closing things you don't know are open. They
>> could be some other processes' thing.
>
>I don't understand. Closing a file descriptor that isn't open is
>harmless,
69 matches
Mail list logo