I'm pleased to announce a new release of Mailinglogger.
Mailinglogger provides two handlers for the standard python
logging framework that enable log entries to be emailed either as the
entries are logged or as a summary at the end of the running process.
The handlers have the following features
On Aug 17, 3:25 am, Chris Angelico wrote:
> You do NOT
> want end users having the power to set variables.
Thanks for the warning, I can see I will need to quarantine the form
input. And update() is out of the question.
-- Gnarlie
http://Gnarlodious.com/
--
http://mail.python.org/mailman/listinfo
On Aug 18, 1:08 pm, Emily Anne Moravec wrote:
> I want to add 5 to each element of a list by using a for loop.
>
> Why doesn't this work?
>
> numbers = [1, 2, 3, 4, 5]
> for n in numbers:
> n = n + 5
> print numbers
As the for loop steps through numbers, it assigns each integer value
to the
>
> I want to add 5 to each element of a list by using a for loop.
>
> Why doesn't this work?
>
> numbers = [1, 2, 3, 4, 5]
> for n in numbers:
> n = n + 5
> print numbers
>
>
The n variable in the for loop refers to each value in the list, not the
reference to the slot that value is stored in.
On Aug 17, 12:23 am, smith jack wrote:
> The environment doesn't have a file
> f:\PythonEnv\djangoEnv2\Scripts\activate_thi
> s.py -- please re-run virtualenv on this environment to update it
Although the docs aren't very clear, --relocatable should be run on
_existing_ virtualenvs. Don't think
On Aug 16, 3:15 pm, smith jack wrote:
> I have created a python environment using virtualenv, but when i want
> to import such environment to PyDev, error just appears,
> it tells there should be a Libs dir, but there is no Libs DIr in the
> virtual envronment created using virtualenv, what should
I want to add 5 to each element of a list by using a for loop.
Why doesn't this work?
numbers = [1, 2, 3, 4, 5]
for n in numbers:
n = n + 5
print numbers
--
http://mail.python.org/mailman/listinfo/python-list
On 08/17/2011 01:22 PM, Yingjie Lin wrote:
Hi Python users,
I have two lists:
li1 = ['a', 'b']
li2 = ['1', '2']
and I wish to obtain a list like this
li3 = ['a1', 'a2', 'b1', 'b2']
Is there a handy and efficient function to do this, especially when li1 and li2
are long lists.
I found zip()
Seebs wrote:
> On 2011-08-17, Steven D'Aprano
> wrote:
>> Fortunately, while we are proud of having that ability, actually *using*
>> it is considered a mortal sin. We're not Ruby developers -- if you
>> actually monkey-patch something, especially built-ins, you can expect to
>> be taken outside
This is the easiest and most pythonic way (IMHO):
l3 = [i+e for i in li1 for e in li2]
l3
['a1', 'a2', 'b1', 'b2']
Regards,
Luis
--
http://mail.python.org/mailman/listinfo/python-list
Bloody hell! This is the most persistent troll I've seen to date. He
expected to get a raging army of pythoners after him, but people are
just laughing at him. This is a mailing list, not a novel, so
colloquialisms are welcome. The language on a mailing list should be
informal and not necessarily g
On Wed, Aug 17, 2011 at 7:29 PM, Steven D'Aprano
wrote:
> The raw_input/input UI is well-designed for entering plain text data. It is
> extremely poor as a command interface.
>
> ... (Imagine how awkward it would be to use a TUI mail client or
> text editor where the only user input was from somet
Yingjie Lin wrote:
> Hi Python users,
>
> I have two lists:
>
> li1 = ['a', 'b']
> li2 = ['1', '2']
>
> and I wish to obtain a list like this
>
> li3 = ['a1', 'a2', 'b1', 'b2']
>
> Is there a handy and efficient function to do this, especially when
> li1 and li2 are long lists.
Depending on
Yingjie Lin wrote:
> Hi Python users,
>
> I have two lists:
>
> li1 = ['a', 'b']
> li2 = ['1', '2']
>
> and I wish to obtain a list like this
>
> li3 = ['a1', 'a2', 'b1', 'b2']
>
> Is there a handy and efficient function to do this, especially when li1
> and li2 are long lists.
> I found zip(
In article <98cc6556-11f3-4850-bd2b-30481b530...@mssm.edu>,
Yingjie Lin wrote:
> I have two lists:
>
> li1 = ['a', 'b']
> li2 = ['1', '2']
>
> and I wish to obtain a list like this
>
> li3 = ['a1', 'a2', 'b1', 'b2']
>
> Is there a handy and efficient function to do this, especially when li1
Yingjie Lin wrote:
> I have two lists:
>
> li1 = ['a', 'b']
> li2 = ['1', '2']
>
> and I wish to obtain a list like this
>
> li3 = ['a1', 'a2', 'b1', 'b2']
>
> Is there a handy and efficient function to do this, especially when li1
> and li2 are long lists.
> I found zip() but it only gives [('
Mel wrote:
> Yingjie Lin wrote:
>> I have two lists:
>>
>> li1 = ['a', 'b']
>> li2 = ['1', '2']
>>
>> and I wish to obtain a list like this
>>
>> li3 = ['a1', 'a2', 'b1', 'b2']
[ ... ]
> This seems to do it :
>
> mwilson@tecumseth:~$ python
> Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
>
Hi Python users,
I have two lists:
li1 = ['a', 'b']
li2 = ['1', '2']
and I wish to obtain a list like this
li3 = ['a1', 'a2', 'b1', 'b2']
Is there a handy and efficient function to do this, especially when li1 and li2
are long lists.
I found zip() but it only gives [('a', '1'), ('b', '2')],
:
Off on a tangent ...
On 16 August 2011 20:14, gc wrote:
>
> Let me address one smell from my particular example, which may be the
> one you're noticing. If I needed fifty parallel collections I would
> not use separate variables; I've coded a ghastly defaultdefaultdict
> just for this purpose,
gc wrote:
Target lists using comma separation are great, but they don't work
very well for this task. What I want is something like
a,b,c,d,e = *dict()
This isn't going to happen. From all the discussion so far I think your
best solution is a simple helper function (not tested):
def repeat
gc wrote:
> Maybe this is more visibly convenient with a complex class, like
>
> x, y, z = *SuperComplexClass(param1, param2, kwparam = "3", ...)
>
> where you need three separate objects but don't want to duplicate the
> class call (for obvious copy-paste reasons) and where bundling it in a
> l
Terry Reedy wrote:
> The difference is between "Hit to continue" (which we can do in
> portable Python) versus "Hit any key to continue" (which we cannot, and
> which also leads to the joke about people searching for the 'any' key
> ;-). The equivalent contrast for GUIs is "Click OK to continue"
anybody here have build it correctly?
how to make a msi file just as the official site did?
is there any detailed tutorial online?
--
http://mail.python.org/mailman/listinfo/python-list
On 2011-08-17, Ethan Furman wrote:
> Part of the fun of Python is experimentation. And how much fun is it to
> be told over and over, "No, you can't do that"?
Okay, I buy that.
Actually, this sort of fits with my experience of how (sane) people do it
in Ruby.
And I'm really the wrong person t
On Wed, Aug 17, 2011 at 6:38 PM, Seebs wrote:
> I may have been unclear about jumping topics; that comment was about
> monkey-patching, not about shadowing.
>
Ah, apologies.
Monkey-patching is a way of using the middle of a stack of code
without using what's below it. If everything is statically
Seebs wrote:
On 2011-08-17, Ethan Furman wrote:
Seebs wrote:
On 2011-08-17, Steven D'Aprano wrote:
Ah, well you see the thing is, this is Python. As soon as you call any
function you don't control, you no longer know what your environment is
with any certainty. For all you know, the harmless-
On 2011-08-17, Chris Angelico wrote:
> On Wed, Aug 17, 2011 at 5:33 PM, Seebs wrote:
>> If it's such a bad thing, *why is it allowed*? ?Why are you proud of the
>> ability to do something that you are never socially-allowed to do?
> Going back to my original three examples:
I may have been uncl
On Wed, Aug 17, 2011 at 5:33 PM, Seebs wrote:
> If it's such a bad thing, *why is it allowed*? Why are you proud of the
> ability to do something that you are never socially-allowed to do?
>
Going back to my original three examples:
> 1) Deliberate shadowing because you want to change the behav
On 2011-08-17, Ethan Furman wrote:
> Seebs wrote:
>> On 2011-08-17, Steven D'Aprano wrote:
>>> Ah, well you see the thing is, this is Python. As soon as you call any
>>> function you don't control, you no longer know what your environment is
>>> with any certainty. For all you know, the harmless-l
On Wed, Aug 17, 2011 at 5:55 PM, MRAB wrote:
> x, y, z = lazy copies(SuperComplexClass(param1, etc, ...))
>
This assumes that you can construct it once and then copy it reliably,
which may mean that the class implement copying correctly. It also
wouldn't work with:
a, b, c, d = *random.randint(1
Seebs wrote:
Pathological narcissism is scary. If you ever find yourself going longer
than usual without being wrong, start checking your work more carefully. :)
+1 QOTW
--
http://mail.python.org/mailman/listinfo/python-list
Seebs wrote:
On 2011-08-17, Steven D'Aprano wrote:
On Wed, 17 Aug 2011 01:17 pm Seebs wrote:
Hmm. See, I've never reached that, in Python or any other language. I
figure it creates a new potential for confusion, and that I would rather
avoid any ambiguity. I don't *like* ambiguity in code.
On 2011-08-17, Terry Reedy wrote:
> The difference is between "Hit to continue" (which we can do in
> portable Python) versus "Hit any key to continue" (which we cannot, and
> which also leads to the joke about people searching for the 'any' key
> ;-).
And more importantly, frustration and co
On 2011-08-17, Steven D'Aprano wrote:
> I shouldn't need to say this to anyone over the age of four, but being
> obnoxious to people trying to help does not encourage others to answer your
> question. You don't win points for insulting people who are trying to solve
> your problems.
The frustrati
On 8/17/2011 12:33 PM, Seebs wrote:
On 2011-08-17, peter wrote:
Is there an equivalent to msvcrt for Linux users? I haven't found
one, and have resorted to some very clumsy code which turns off
keyboard excho then reads stdin. Seems such an obvious thing to want
to do I am surprised there is n
On 17/08/2011 10:26, gc wrote:
On Aug 17, 3:13 am, Chris Angelico wrote:
Minor clarification: You don't want to initialize them to the same
value, which you can do already:
a=b=c=d=e=dict()
Right. Call the proposed syntax the "instantiate separately for each
target" operator. (It can be pr
On 2011-08-17, Steven D'Aprano wrote:
> On Wed, 17 Aug 2011 01:17 pm Seebs wrote:
> [...]
>> "Another" scope is normally a horizontal thing -- you're talking about
>> a different scope such that you are *either* in this one *or* in that
>> one.
>> Built-ins are not in a scope you are never not in
On 2011-08-17, peter wrote:
> Is there an equivalent to msvcrt for Linux users? I haven't found
> one, and have resorted to some very clumsy code which turns off
> keyboard excho then reads stdin. Seems such an obvious thing to want
> to do I am surprised there is not a standard library module fo
On 2011-08-17, Chris Angelico wrote:
> def foo(list):
>"""Foo's the list provided and returns True on success or False on
> failure."""
>
> def bar(list):
> """Counts the number of bars in the list, assuming it to be made
> of music."""
> if not foo(list): return
> You call foo() once
Hans Mulder wrote:
> Strictly speaking, os.system is deprecated and you should use
> the equivalent invocation of subprocess.call:
Strictly speaking, os.system is *not* deprecated in either Python 2.x or
3.x.
Latest stable documentation for Python 2.7 and 3.2:
http://docs.python.org/library/os.h
On Wed, Aug 17, 2011 at 2:19 AM, Gnarlodious wrote:
> I should add that this does what I want, but something a little more
> Pythonic?
>
> import cgi, os
> os.environ["QUERY_STRING"] = "name1=Val1&name2=Val2&name3=Val3"
> form=cgi.FieldStorage()
>
> form
>
> dict = {}
> for key in form.keys(): dic
The issue behind this thread is that for immutable objects, binding to n
copies has the same effect as n bindings to one object (so one does not
really have to know which one is doing), whereas the two are different
for mutable objects (so one does have to know). In short, identity
matters for
On 16/08/2011 13:38, Ayaskant Swain wrote:
Hi Tim,
Thanks for your reply. It seems this issue is related to python bug
-http://bugs.python.org/issue2528
But the patch code looks complex to me. I want to make changes only
in my python script which will read an user given directory path&
check it'
Hi,
Thanks, the problem got solved. The updated version can be found at
https://gist.github.com/1144708 in a comment below the original post.
Solution:
self.connect("destroy", self.quit)
def quit(self, widget):
self.mouseThread.kill()
gtk.main_quit()
It was not evident that quit
the warning is just as follows
E:\Tools>pip install virtualenv
Downloading/unpacking virtualenv
Downloading virtualenv-1.6.4.tar.gz (1.9Mb): 1.9Mb downloaded
Running setup.py egg_info for package virtualenv
warning: no previously-included files matching '*.*' found under directory '
do
On 17/08/11 10:03:00, peter wrote:
Is there an equivalent to msvcrt for Linux users? I haven't found
one, and have resorted to some very clumsy code which turns off
keyboard excho then reads stdin. Seems such an obvious thing to want
to do I am surprised there is not a standard library module fo
On Se shanbe 25 Mordad 1390 01:26:54 Johannes wrote:
> hi list,
> what is the best way to check if a given list (lets call it l1) is
> totally contained in a second list (l2)?
>
> for example:
> l1 = [1,2], l2 = [1,2,3,4,5] -> l1 is contained in l2
> l1 = [1,2,2,], l2 = [1,2,3,4,5] -> l1 is not co
> On 8/16/2011 7:29 PM, Terry Reedy wrote:
>
> On 8/16/2011 1:15 PM, Gerrat Rickert wrote:
>
> > I think that best practices would suggest that one shouldn't use
> > variable
> > names that shadow builtins (except in specific, special
> circumstances),
> > so I don't really think this would be an
Welcome to my killfile.
*plonk*
--
http://mail.python.org/mailman/listinfo/python-list
aspineux wrote:
> in a command prompt run
> C:\Your Python Directory\python.exe C:\Your Download directory
> \ez_setup.py
>
> Then use
>
> C:\Your Python Directory\python.exe C:\Your Python Directory\I dont
> know where the easy_install script will be installed\easy_install.py
> install module
On Wed, 17 Aug 2011 02:06:31 -0700, Gnarlodious wrote:
> I get a construct like this:
>
> form=FieldStorage(None, None, [MiniFieldStorage('name1', 'Val1'),
> MiniFieldStorage('name2', 'Val2'), MiniFieldStorage('name3', 'Val3')])
>
> Now how would I assign every variable name* its value?
Don't d
2011/8/17 Benji Ara. :
> Hello
> I wonder how you package a Tkinter gui with py2exe?
> Thanks
> Benji
>
>
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
Hi,
check the necessary steps on the py2exe homepage
http://www.py2exe.org/index.cgi/Tutorial
in your setup script, you ha
On Tue, 16 Aug 2011 09:57:57 -0400, John Posner wrote:
> How about using Python's core support for "==" on list objects:
> for i in range(alist_sz - slist_sz + 1):
> if slist == alist[i:i+slist_sz]:
> return True
This is bound to be asymptotically O(alist_sz * slist_sz),
On 16/08/2011 15:46, snorble wrote:
Interesting. Normally I would use py2exe then do "myapp.exe -install"
to install the app as a service. How do you handle installing the
service? Also what does the service show under the properties, for the
executable? "python.exe script.py" or something else?
Forgot to include a link : https://github.com/mxcl/homebrew
--
http://mail.python.org/mailman/listinfo/python-list
Checkout Homebrew. It can install in a very easy and clean way different
version of Python (as well as a lot of other stuff). It tried for a long time
to keep my Mac clean and this is so far the best I found.
--
http://mail.python.org/mailman/listinfo/python-list
Hello
I wonder how you package a Tkinter gui with py2exe?
Thanks
Benji
*
*
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 17, 5:45 am, Chris Angelico wrote:
(snip)
> > Right. Call the proposed syntax the "instantiate separately for each
> > target" operator.
>
(snip)
> It might just
> as easily be some other function call; for instance:
>
> head1,head2,head3=file.readline()
Hm--that's interesting! OK, call it
I should add that this does what I want, but something a little more
Pythonic?
import cgi, os
os.environ["QUERY_STRING"] = "name1=Val1&name2=Val2&name3=Val3"
form=cgi.FieldStorage()
form
dict = {}
for key in form.keys(): dict[ key ] = form[ key ].value
dict
locals().update(dict)
name3
-- Gnarl
On Wed, Aug 17, 2011 at 10:26 AM, gc wrote:
> On Aug 17, 3:13 am, Chris Angelico wrote:
>
>> Minor clarification: You don't want to initialize them to the same
>> value, which you can do already:
>>
>> a=b=c=d=e=dict()
>
> Right. Call the proposed syntax the "instantiate separately for each
> tar
On Wed, Aug 17, 2011 at 10:19 AM, Gnarlodious wrote:
> import cgi, os
> os.environ["QUERY_STRING"] = "name1=Val1&name2=Val2&name3=Val3"
> form=cgi.FieldStorage()
>
> form
>
> dict = {}
> for key in form.keys(): dict[ key ] = form[ key ].value
>
You could probably use a list comp for this, but the
On Aug 17, 3:13 am, Chris Angelico wrote:
> Minor clarification: You don't want to initialize them to the same
> value, which you can do already:
>
> a=b=c=d=e=dict()
Right. Call the proposed syntax the "instantiate separately for each
target" operator. (It can be precisely defined as a * on th
On Wed, Aug 17, 2011 at 10:06 AM, Gnarlodious wrote:
> I get a construct like this:
>
> form=FieldStorage(None, None, [MiniFieldStorage('name1', 'Val1'),
> MiniFieldStorage('name2', 'Val2'), MiniFieldStorage('name3', 'Val3')])
>
> when I need to assign the variable name2 the value Val2
You can pr
I should add that this does what I want, but something a little more
Pythonic?
import cgi, os
os.environ["QUERY_STRING"] = "name1=Val1&name2=Val2&name3=Val3"
form=cgi.FieldStorage()
form
dict = {}
for key in form.keys(): dict[ key ] = form[ key ].value
dict
locals().update(dict)
name3
-- Gnarl
I get a construct like this:
form=FieldStorage(None, None, [MiniFieldStorage('name1', 'Val1'),
MiniFieldStorage('name2', 'Val2'), MiniFieldStorage('name3', 'Val3')])
Now how would I assign every variable name* its value?
lI did try locals().update(form) however I get
>>> name2
-> MiniFieldStorag
I get a construct like this:
form=FieldStorage(None, None, [MiniFieldStorage('name1', 'Val1'),
MiniFieldStorage('name2', 'Val2'), MiniFieldStorage('name3', 'Val3')])
Now how would I assign every variable name* its value?
lI did try locals().update(form) however I get
>>> name2
-> MiniFieldStorag
On Wed, 17 Aug 2011 05:23 pm John Doe wrote:
> You have every right to an opinion, Fuckturd.
I shouldn't need to say this to anyone over the age of four, but being
obnoxious to people trying to help does not encourage others to answer your
question. You don't win points for insulting people who
On Wed, 17 Aug 2011 01:17 pm Seebs wrote:
[...]
> "Another" scope is normally a horizontal thing -- you're talking about
> a different scope such that you are *either* in this one *or* in that
> one.
>
> Built-ins are not in a scope you are never not in.
That's technically incorrect. Built-ins a
Is there an equivalent to msvcrt for Linux users? I haven't found
one, and have resorted to some very clumsy code which turns off
keyboard excho then reads stdin. Seems such an obvious thing to want
to do I am surprised there is not a standard library module for it. Or
have I missed someting (woul
On Wed, Aug 17, 2011 at 1:58 AM, Steven D'Aprano
wrote:
>> My thoughts would be:
>> 1. It's hard to avoid shadowing anything unless you know the entire
>> language and never forget things.
>
> Define the "entire language". Does that include the names of all the
> plethora of exceptions? How about
On Wed, Aug 17, 2011 at 2:35 AM, Seebs wrote:
> On 2011-08-17, Chris Angelico wrote:
>> It mightn't be very significant, but there'd still be some cost.
>> However, IMHO the greatest cost is the spamminess; forcing the user to
>> deal with lines and lines of warnings is not a useful way to design
Seebs wrote:
> John Doe wrote:
>> Context is lost when you quote only one level.
>
> Not significantly.
Whatever you say, Jeebs.
>> I was not answering a question about my code. I was pointing
>> out the fact that my questioner's terminology is
>> strange/corrupt.
>
> Well, that's t
On Wed, Aug 17, 2011 at 7:12 AM, Seebs wrote:
>> Yes, even the common term "command line" is foreign to me. I do
>> some powerful stuff in Windows, without need for a command line.
>
> So apparently you *do* know the term. Normally, to say that a term is
> foreign to you is to say that you have n
On Wed, Aug 17, 2011 at 1:14 AM, gc wrote:
> Perfectly reasonable request! Maybe there aren't as many cases when
> multiple variables need to be initialized to the same value as I think
> there are.
>
Minor clarification: You don't want to initialize them to the same
value, which you can do alrea
74 matches
Mail list logo