> On Jun 12, 2015, at 11:00 PM, Fabien wrote:
> but that awful bug made me wonder: is it a bad practice to interactively
> modify the list you are iterating over?
Yes.
I am a newbie. I also have been confused when I read the tutorial. It
recommends make a copy before looping. Then I try.
#
On Friday, June 12, 2015 at 6:48:18 PM UTC-5, Chris Angelico wrote:
> On Sat, Jun 13, 2015 at 5:39 AM, Malik Rumi wrote:
> > for line in lines:
> > for item in fileinput.input(s2):
> > if line in item:
> > with open(line + '_list', 'a+') as l:
> > l.append(
On Friday, June 12, 2015 at 3:31:36 PM UTC-5, Ian wrote:
> On Fri, Jun 12, 2015 at 1:39 PM, Malik Rumi wrote:
> > I am trying to find a list of strings in a directory of files. Here is my
> > code:
> >
> > # -*- coding: utf-8 -*-
> > import os
> > import fileinput
> >
> > s2 = os.listdir('/home/m
On Fri, 12 Jun 2015 17:37:32 -0700 (PDT), sohcahto...@gmail.com wrote:
>On Friday, June 12, 2015 at 5:03:25 PM UTC-7, Seymore4Head wrote:
>> On Fri, 12 Jun 2015 15:57:53 -0700 (PDT), sohcahto...@gmail.com wrote:
>>
>> >On Friday, June 12, 2015 at 3:23:32 PM UTC-7, Seymore4Head wrote:
>> >> Is the
On 13-06-2015 02:25, Steven D'Aprano wrote:
> On Fri, 12 Jun 2015 16:53:08 +0100, Paulo da Silva wrote:
>
...
>
> You should use SimpleNamespace, as Peter suggests, but *not* subclass it.
> If you subclass it and add methods:
>
> class C(SimpleNamespace):
> def foo(self, arg):
> pr
On 12-06-2015 20:12, Peter Otten wrote:
> Paulo da Silva wrote:
>
>> On 12-06-2015 17:17, Peter Otten wrote:
>>> Paulo da Silva wrote:
>>>
>> ...
...
> It *is* a class, and by making C a subclass of SimpleNamespace C inherits
> the initialiser which does the actual work of updating the __dict__
On 06/12/2015 04:20 PM, Seymore4Head wrote:
> Is there a program what runs on Windows that uses a national blacklist
> to block phone calls?
I'm sure you could install and use the Asterisk PBX software, and I bet
people have made scripts for it to block calls in this way. You'll need
to take your
On Fri, 12 Jun 2015 16:53:08 +0100, Paulo da Silva wrote:
> I would like to do something like this:
>
> class C:
> def __init__(self,**parms):
> ...
>
> c=C(f1=1,f2=None)
>
> I want to have, for the object
> self.f1=1
> self.f2=None
>
> for an arbitrary number of parame
On Friday, June 12, 2015 at 5:27:21 PM UTC-7, Chris Angelico wrote:
> On Sat, Jun 13, 2015 at 10:02 AM, wrote:
> >> >>> ints = [0, 1, 2, 2, 1, 4, 6, 5, 5]
> >> >>> ints[:] = [i for i in ints if not i % 2]
> >> >>> ints
> >> [0, 2, 2, 4, 6]
> >>
> >>
> >> --
> >> Terry Jan Reedy
> >
> > On the
On Friday, June 12, 2015 at 5:03:25 PM UTC-7, Seymore4Head wrote:
> On Fri, 12 Jun 2015 15:57:53 -0700 (PDT), sohcahto...@gmail.com wrote:
>
> >On Friday, June 12, 2015 at 3:23:32 PM UTC-7, Seymore4Head wrote:
> >> Is there a program what runs on Windows that uses a national blacklist
> >> to bloc
On Sat, Jun 13, 2015 at 10:02 AM, wrote:
>> >>> ints = [0, 1, 2, 2, 1, 4, 6, 5, 5]
>> >>> ints[:] = [i for i in ints if not i % 2]
>> >>> ints
>> [0, 2, 2, 4, 6]
>>
>>
>> --
>> Terry Jan Reedy
>
> On the second line of your final solution, is there any reason you're using
> `ints[:]` rather t
On Sat, Jun 13, 2015 at 10:00 AM, Seymore4Head
wrote:
> On Fri, 12 Jun 2015 15:57:53 -0700 (PDT), sohcahto...@gmail.com wrote:
>
>>On Friday, June 12, 2015 at 3:23:32 PM UTC-7, Seymore4Head wrote:
>>> Is there a program what runs on Windows that uses a national blacklist
>>> to block phone calls?
On Fri, 12 Jun 2015 15:57:53 -0700 (PDT), sohcahto...@gmail.com wrote:
>On Friday, June 12, 2015 at 3:23:32 PM UTC-7, Seymore4Head wrote:
>> Is there a program what runs on Windows that uses a national blacklist
>> to block phone calls?
>
>Are you talking about a Windows Phone? Windows for a PC d
On Friday, June 12, 2015 at 4:44:08 PM UTC-7, Terry Reedy wrote:
> On 6/12/2015 4:34 PM, Laura Creighton wrote:
> > The real problem is removing things from lists when you are iterating
> > over them, not adding things to the end of lists.
>
> One needs to iterate backwards.
>
> >>> ints = [0, 1
On Sat, Jun 13, 2015 at 5:39 AM, Malik Rumi wrote:
> for line in lines:
> for item in fileinput.input(s2):
> if line in item:
> with open(line + '_list', 'a+') as l:
> l.append(filename(), filelineno(), line)
Ian's already answered your actual question, b
On 6/12/2015 4:34 PM, Laura Creighton wrote:
The real problem is removing things from lists when you are iterating
over them, not adding things to the end of lists.
One needs to iterate backwards.
>>> ints = [0, 1, 2, 2, 1, 4, 6, 5, 5]
>>> for i in range(len(ints)-1, -1, -1):
if ints[
On 6/12/2015 11:00 AM, Fabien wrote:
is it a bad practice
to interactively modify the list you are iterating over?
One needs care. Appending to the end of the list is OK, unless you
append a billion items or so ;-) Appending to the end of a queue while
*removing* items from the front of the
On 6/12/2015 7:12 AM, Thomas Güttler wrote:
Here is a snippet from the argparse module:
{{{
def parse_known_args(self, args=None, namespace=None):
...
# default Namespace built from parser defaults
if namespace is None:
namespace = Namespace() # < ===
On Friday, June 12, 2015 at 3:23:32 PM UTC-7, Seymore4Head wrote:
> Is there a program what runs on Windows that uses a national blacklist
> to block phone calls?
Are you talking about a Windows Phone? Windows for a PC doesn't make phone
calls unless that's a new feature that I don't know about.
On Friday, June 12, 2015 at 3:12:26 PM UTC-7, Thomas 'PointedEars' Lahn wrote:
> Ian Kelly wrote:
>
> > [...] Thomas 'PointedEars' Lahn [...] wrote:
> >> Ian Kelly wrote:
> >>> The probability of 123456789 and 1 are equal. The probability
> >>> of a sequence containing all nine numbers and
On Fri, Jun 12, 2015, at 18:09, Thomas 'PointedEars' Lahn wrote:
> Do you deny that “123456789” *is* “a sequence containing all nine
> numbers”
Do you deny that "123456798" *is* "a sequence containing all nine
numbers"?
Does this mean that "123456789" *is* "123456798" by the transitive
property?
On Jun 12, 2015 4:16 PM, "Thomas 'PointedEars' Lahn"
wrote:
>
> Ian Kelly wrote:
>
> > […] Thomas 'PointedEars' Lahn […] wrote:
> >> Ian Kelly wrote:
> >>> The probability of 123456789 and 1 are equal. The probability
> >>> of a sequence containing all nine numbers and a sequence containin
Is there a program what runs on Windows that uses a national blacklist
to block phone calls?
--
https://mail.python.org/mailman/listinfo/python-list
Ian Kelly wrote:
> […] Thomas 'PointedEars' Lahn […] wrote:
>> Ian Kelly wrote:
>>> The probability of 123456789 and 1 are equal. The probability
>>> of a sequence containing all nine numbers and a sequence containing
>>> only 1s are *not* equal.d
>> There is a contradiction in that statem
On Fri, Jun 12, 2015 at 3:32 PM, Thomas 'PointedEars' Lahn
wrote:
> Ian Kelly wrote:
>
>> The probability of 123456789 and 1 are equal. The probability
>> of a sequence containing all nine numbers and a sequence containing
>> only 1s are *not* equal.
>
> There is a contradiction in that st
On Fri, Jun 12, 2015, at 17:32, Thomas 'PointedEars' Lahn wrote:
> Ian Kelly wrote:
>
> > The probability of 123456789 and 1 are equal. The probability
> > of a sequence containing all nine numbers and a sequence containing
> > only 1s are *not* equal.
>
> There is a contradiction in that
On Fri, 12 Jun 2015 23:32:31 +0200, Thomas 'PointedEars' Lahn wrote:
> Ian Kelly wrote:
>
>> The probability of 123456789 and 1 are equal. The probability
>> of a sequence containing all nine numbers and a sequence containing
>> only 1s are *not* equal.
>
> There is a contradiction in th
Ian Kelly wrote:
> The probability of 123456789 and 1 are equal. The probability
> of a sequence containing all nine numbers and a sequence containing
> only 1s are *not* equal.
There is a contradiction in that statement. Can you find it?
--
PointedEars
Twitter: @PointedEars2
Please d
In a message of Fri, 12 Jun 2015 10:52:19 -0700, subhabrata.bane...@gmail.com w
rites:
>Dear Group,
>
>I wrote a Python code. In the code there are two modules where we may insert
>data from outside. They are updating some training module and updating index.
>As a standalone code this is working
The subprocess module uses upper bound MAXFD which is defined as
try:
MAXFD = os.sysconf("SC_OPEN_MAX")
except:
MAXFD = 256
/Jean
--
https://mail.python.org/mailman/listinfo/python-list
The real problem is removing things from lists when you are iterating
over them, not adding things to the end of lists.
Python 2.7.9 (default, Mar 1 2015, 12:57:24)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> mylist = [1,2,3]
>>> for i in mylis
On Fri, Jun 12, 2015 at 1:39 PM, Malik Rumi wrote:
> I am trying to find a list of strings in a directory of files. Here is my
> code:
>
> # -*- coding: utf-8 -*-
> import os
> import fileinput
>
> s2 = os.listdir('/home/malikarumi/Projects/P5/shortstories')
Note that the filenames that will be
In a message of Fri, 12 Jun 2015 10:39:36 -0700, Wayne Norman writes:
>ok I have wxFormBuilder as well and so could use some help with working on my
>project I would explain exactally what I am doing to and one who wishes to aid
>me with this.
>
>for now I will has it has to do with a minecraft m
I am trying to find a list of strings in a directory of files. Here is my code:
# -*- coding: utf-8 -*-
import os
import fileinput
s2 = os.listdir('/home/malikarumi/Projects/P5/shortstories')
with open('/home/malikarumi/Projects/P5/list_stories') as f:
lines = f.readlines()
for line in lin
Paulo da Silva wrote:
> On 12-06-2015 17:17, Peter Otten wrote:
>> Paulo da Silva wrote:
>>
> ...
>
>>
> import types
> class C(types.SimpleNamespace):
>> ... pass
>> ...
> c = C(f1=1, f2=None)
> c
>> C(f1=1, f2=None)
>>
>
> Thanks for all your explanations.
> This solutio
In article <6651a781-abe1-4f25-b1f3-1f849776d...@googlegroups.com>,
Andrei wrote:
> On Monday, June 8, 2015 at 1:08:07 AM UTC+2, Ned Deily wrote:
> > In article <11e093d5-b78e-4ac6-9a7f-649cb2c2c...@googlegroups.com>,
> > Andrei wrote:
> > > Alright, I have had some development in
> > > http:/
On Friday, June 12, 2015 at 10:52:30 AM UTC-7, subhabrat...@gmail.com wrote:
> Dear Group,
>
> I wrote a Python code. In the code there are two modules where we may insert
> data from outside. They are updating some training module and updating index.
> As a standalone code this is working fine.
In article <90a23bdc-7703-4397-b83a-92718ae10...@googlegroups.com>,
Sebastian M Cheung via Python-list wrote:
> On Thursday, June 11, 2015 at 11:07:59 PM UTC+1, Sebastian M Cheung wrote:
> > For some reason I cannot build now in XCode:
> >
> > $ xcodebuild -find python
> > /Users/sebc/anaconda/b
On 12-06-2015 17:17, Peter Otten wrote:
> Paulo da Silva wrote:
>
...
>
import types
class C(types.SimpleNamespace):
> ... pass
> ...
c = C(f1=1, f2=None)
c
> C(f1=1, f2=None)
>
Thanks for all your explanations.
This solution works. Would you please detail a little on
On 12-06-2015 17:17, gst wrote:
> Le vendredi 12 juin 2015 11:53:24 UTC-4, Paulo da Silva a écrit :
> in the __init__, simply do:
>
> self.__dict__.update(**parms)
>
> regards,
>
Ok. Thanks.
--
https://mail.python.org/mailman/listinfo/python-list
Dear Group,
I wrote a Python code. In the code there are two modules where we may insert
data from outside. They are updating some training module and updating index.
As a standalone code this is working fine.
I need to port this code to REST. I tried to learn Flask. My Practice for Flask
is
On 12/06/2015 18:39, Wayne Norman wrote:
ok I have wxFormBuilder as well and so could use some help with working on my
project I would explain exactally what I am doing to and one who wishes to aid
me with this.
for now I will has it has to do with a minecraft mod if you would like to known
m
ok I have wxFormBuilder as well and so could use some help with working on my
project I would explain exactally what I am doing to and one who wishes to aid
me with this.
for now I will has it has to do with a minecraft mod if you would like to known
more I will put more here
--
https://mail.p
On 12/06/2015 16:00, Fabien wrote:
Folks,
I am developing a program which I'd like to be python 2 and 3
compatible. I am still relatively new to python and I use primarily py3
for development. Every once in a while I use a py2 interpreter to see if
my tests pass through.
I just spent several ho
On Fri, 12 Jun 2015 10:24:05 +0530, Alby Issac wrote:
>
> Am new to this group.
[snip]
Welcome.
> . . . I just want to know that is it possible to implement a filter
> for view updates in the database tables using python. and that filter
> will help to reject false updates in the source databas
Le vendredi 12 juin 2015 11:53:24 UTC-4, Paulo da Silva a écrit :
> I would like to do something like this:
>
> class C:
> def __init__(self,**parms):
> ...
>
> c=C(f1=1,f2=None)
>
> I want to have, for the object
> self.f1=1
> self.f2=None
>
> for an arbitrary number of
Paulo da Silva wrote:
> I would like to do something like this:
>
> class C:
> def __init__(self,**parms):
> ...
>
> c=C(f1=1,f2=None)
>
> I want to have, for the object
> self.f1=1
> self.f2=None
>
> for an arbitrary number of parameters.
>
> What is the best way to achieve this?
Use a dict
On 06/12/2015 05:26 PM, Ian Kelly wrote:
but that awful bug made me wonder: is it a bad practice to
>interactively modify the list you are iterating over?
Generally speaking, yes, it's bad practice to add or remove items
because this may result in items being visited more than once or not
at all
I would like to do something like this:
class C:
def __init__(self,**parms):
...
c=C(f1=1,f2=None)
I want to have, for the object
self.f1=1
self.f2=None
for an arbitrary number of parameters.
What is the best way to achieve this?
Thanks
--
https://mail.python
On 06/12/2015 05:26 PM, Ian Kelly wrote:
for stuff, branch in zip(stuffs, branches):
> # compute flux
> ...
> # add to the downstream branch
> id_branch = branches.index(branch.flows_to)
> branches[id_branch].property.append(stuff_i_computed)
Er, I don't s
On Fri, Jun 12, 2015 at 9:00 AM, Fabien wrote:
> Folks,
>
> I am developing a program which I'd like to be python 2 and 3 compatible. I
> am still relatively new to python and I use primarily py3 for development.
> Every once in a while I use a py2 interpreter to see if my tests pass
> through.
>
On 06/12/2015 05:00 PM, Fabien wrote:
I've found the izip() function which should do what I want
I've just come accross a stackoverflow post where they recommend:
from future_builtins import zip
which is OK since I don't want to support versions <= 2.6
--
https://mail.python.org/mailman/listi
Folks,
I am developing a program which I'd like to be python 2 and 3
compatible. I am still relatively new to python and I use primarily py3
for development. Every once in a while I use a py2 interpreter to see if
my tests pass through.
I just spent several hours tracking down a bug which wa
For completeness I will note that Windows is completely different. The
plain exit status (1 for typical command failures) appears in the
os.system result rather than a wait-encoded value. And, incidentally, an
MSVC program which calls abort() will return an exit status of 3. A
process that terminat
On 06/12/2015 05:36 AM, Sebastian M Cheung via Python-list wrote:
> Are these available? Any good ones to recommend?
The only use case for such a program that I can think of is a compiler
that is just using another language as an intermediate step, and that
language is usually going to be compiled
On Fri, Jun 12, 2015, at 09:54, Ian Kelly wrote:
> Exit code 0 traditionally means success. The exit status is two bytes,
> with
> the low-order byte normally containing the exit code and the high-order
> byte containing the signal that caused the program to exit.
That's backwards. The signal (or
On Jun 12, 2015 6:53 AM, "Stefan Behnel" wrote:
>
> Sebastian M Cheung via Python-list schrieb am 12.06.2015 um 13:36:
> > Are these available? Any good ones to recommend?
>
> I recommend not doing that. You'd end up with ugly and unidiomatic Python
> code that's impossible to maintain, whereas yo
On Jun 12, 2015 7:54 AM, "Ian Kelly" wrote:
>
> On Jun 12, 2015 7:21 AM, "Grawburg" wrote:
> >
> > I have a piece of code written for a Raspberry Pi with no explanation
for two of the lines -- and I can't find an explanation I understand.
> >
> > Here are the lines:
> > if os.system('modprobe --f
On 2015-06-12, Ben Finney wrote:
> There is no standardisation of exit status values between different
> programs. The best one can say is “exit status 0 means success”.
> Anything further is specific to particular programs and is not
> universal.
>
> You'll need to see the documentation for ‘mod
On Jun 12, 2015 7:21 AM, "Grawburg" wrote:
>
> I have a piece of code written for a Raspberry Pi with no explanation for
two of the lines -- and I can't find an explanation I understand.
>
> Here are the lines:
> if os.system('modprobe --first-time -q w1_gpio') ==0
>
> if os.system('modprobe -q w1
Grawburg wrote:
> I have a piece of code written for a Raspberry Pi with no explanation for
> two of the lines -- and I can't find an explanation I understand.
>
> Here are the lines:
> if os.system('modprobe --first-time -q w1_gpio') ==0
>
> if os.system('modprobe -q w1_gpio') == 256:
>
>
>
On 2015-06-12, Grawburg wrote:
> I have a piece of code written for a Raspberry Pi with no explanation for two
> of the lines -- and I can't find an explanation I understand.
>
> Here are the lines:
> if os.system('modprobe --first-time -q w1_gpio') ==0
>
> if os.system('modprobe -q w1_gpio') ==
Grawburg writes:
> if os.system('modprobe --first-time -q w1_gpio') ==0
>
> if os.system('modprobe -q w1_gpio') == 256:
>
> I know what the 'modprobe...' is, it's the 0 and the 256 I don't get.
> Where do these numbers come from?
They are integer literals, they come from the source code.
The st
I have a piece of code written for a Raspberry Pi with no explanation for two
of the lines -- and I can't find an explanation I understand.
Here are the lines:
if os.system('modprobe --first-time -q w1_gpio') ==0
if os.system('modprobe -q w1_gpio') == 256:
I know what the 'modprobe...' is, it
On 12/06/2015 12:36, Sebastian M Cheung via Python-list wrote:
Are these available? Any good ones to recommend?
Yes and no.
--
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/pyt
Hi
I've been trying to configure Apache and Python 2.7 on Red Hat. I've tried
the different configurations i've seen on the web, I've given chmod -R 777
tu my python code but I still get 403 Forbidden and I don't get any errors.
Regards,
Néstor
--
https://mail.python.org/mailman/listinfo/python
Sebastian M Cheung via Python-list schrieb am 12.06.2015 um 13:36:
> Are these available? Any good ones to recommend?
I recommend not doing that. You'd end up with ugly and unidiomatic Python
code that's impossible to maintain, whereas you now (hopefully) have
somewhat idiomatic Java code that sho
Hi Steven,
I understand your solution. It is correct and works.
But the missing five characters "self." in the upstream code
produces a lot of more lines in the final result.
Regards,
Thomas Güttler
Am Freitag, 12. Juni 2015 14:24:06 UTC+2 schrieb Steven D'Aprano:
> On Fri, 12 Jun 2015 04:12
On Fri, 12 Jun 2015 04:12:52 -0700, Thomas Güttler wrote:
> Here is a snippet from the argparse module:
>
> {{{
> def parse_known_args(self, args=None, namespace=None):
> ...
> # default Namespace built from parser defaults if namespace is
> None:
> namespa
Are these available? Any good ones to recommend?
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, Jun 12, 2015 at 9:12 PM, Thomas Güttler wrote:
> I prefer "self.Namespace()" to namespace kwargs.
>
> What do you think?
Given that the namespace argument already exists, and you're proposing
a change, you'll need a much stronger justification than mere
preference. What's the downside of
Here is a snippet from the argparse module:
{{{
def parse_known_args(self, args=None, namespace=None):
...
# default Namespace built from parser defaults
if namespace is None:
namespace = Namespace() # < === my issue
}}}
I subclass from the class of the
Steven D'Aprano :
> This is better written as:
>
> if any(substr in inp1 for substr in
>['AND', 'OR', 'NOT', '>', '&', 'MAYBE', '(', '*', ' " ']):
> print 'FINE'
Or, equivalently:
for substr in ['AND', 'OR', 'NOT', '>', '&', 'MAYBE', '(', '*', ' " ']:
if substr
On Thu, 11 Jun 2015 08:40:50 -0700, subhabrata.banerji wrote:
> if ("AND" in inp1) or ("OR" in inp1) or ("NOT" in inp1) or (">" in
> inp1) or ("&" in inp1) or ("MAYBE" in inp1) or ("(" in inp1) or ("*"
> in inp1) or (''' " ''' in inp1):
This is better written as:
if any(substr in inp
ANNOUNCING
eGenix.com pyOpenSSL Distribution
Version 0.13.9
An easy-to-install and easy-to-use distribution
of the pyOpenSSL Python interface for OpenSS
Hi,
Am new to this group. Am a PG student in Computer Science Engineering
from India. I have some doubts related to my academic research.
I just want to know that is it possible to implement a filter for view
updates in the database tables using python. and that filter will help to
reject false
76 matches
Mail list logo