On 10/09/2012 02:07 AM, Bob Martin wrote:
> in 682592 20121008 232126 "Prasad, Ramit" wrote:
>> Thomas Bach wrote:=0D=0A> Hi there,=0D=0A> =0D=0A> On Sat, Oct 06, 2012 at =
>> 03:08:38PM +, Steven D'Aprano wrote:=0D=0A> >=0D=0A> > my_tuple
in 682592 20121008 232126 "Prasad, Ramit" wrote:
>Thomas Bach wrote:=0D=0A> Hi there,=0D=0A> =0D=0A> On Sat, Oct 06, 2012 at =
>03:08:38PM +, Steven D'Aprano wrote:=0D=0A> >=0D=0A> > my_tuple =3D my_=
>tuple[:4]=0D=0A> > a,b,c,d =3D my_tuple
On Oct 9, 2:16 pm, Token Type wrote:
> When I try my above codes, what puzzles me is that when
> the data in the dictionary increase, some data become
> missing in the sorted result. Quite odd. In the pairs,
> we have {'journey':'voyage'} but in the sorted result no (
> 'journey-voyage',0.25)
>
>
Thanks indeed for all your suggestions. When I try my above codes, what puzzles
me is that when the data in the dictionary increase, some data become missing
in the sorted result. Quite odd. In the pairs, we have {'journey':'voyage'} but
in the sorted result no ('journey-voyage',0.25), which did
On Oct 9, 1:13 pm, Token Type wrote:
> yes, thanks all your tips. I did try sorted with itemgetter.
> However, the sorted results are same as follows whether I
> set reverse=True or reverse= False. Isn't it strange? Thanks.
That's because you're sorting each entry individually, not the entire
res
On Mon, Oct 8, 2012 at 9:13 PM, Token Type wrote:
> yes, thanks all your tips. I did try sorted with itemgetter. However, the
> sorted results are same as follows whether I set reverse=True or reverse=
> False. Isn't it strange? Thanks.
First of all, "sorted" does not sort the list in place as
Dear all, the problem has been solved as follows. Thanks anyway:
>>> import nltk
>>> from nltk.corpus import wordnet as wn
>>> pairs = {'car':'automobile', 'gem':'jewel', 'journey':'voyage'}
>>> list_simi=[]
>>> for key in pairs:
word1 = wn.synset(str(key) + '.n.01')
word2 = wn.syn
On Oct 9, 12:06 pm, Roy Smith wrote:
> I'm going to go with this one. I think people tend to over-abuse list
> comprehensions.
I weep whenever I find `_ = [...]` in other people's code.
--
http://mail.python.org/mailman/listinfo/python-list
yes, thanks all your tips. I did try sorted with itemgetter. However, the
sorted results are same as follows whether I set reverse=True or reverse=
False. Isn't it strange? Thanks.
>>> import nltk
>>> from nltk.corpus import wordnet as wn
>>> pairs = {'car':'automobile', 'gem':'jewel', 'journey'
On Oct 9, 7:34 am, rusi wrote:
> How about a 2-paren version?
>
> >>> x = [1,2,3]
> >>> reduce(operator.add, [['insert', a] for a in x])
>
> ['insert', 1, 'insert', 2, 'insert', 3]
Or if one prefers the different parens on the other side:
>>> reduce(operator.add, (['insert', a] for a in x))
['i
On Oct 9, 7:06 am, Roy Smith wrote:
> In article ,
> Terry Reedy wrote:
>
>
>
>
>
>
>
>
>
> > On 10/8/2012 3:28 PM, mooremath...@gmail.com wrote:
> > > What's the best way to accomplish this? Am I over-complicating it? My
> > > gut
> > > feeling is there is a better way than the following:
>
On 10/08/2012 09:45 PM, Terry Reedy wrote:
> On 10/8/2012 11:13 AM, Dave Angel wrote:
>
>>> Isn't it true, though, that Python 3.3 has a completely new
>>> implementation of decimal that largely removes this disadvantage?
>
>> I wouldn't know, I'm on 3.2. However, I sincerely doubt if it's within
In article ,
Terry Reedy wrote:
> On 10/8/2012 3:28 PM, mooremath...@gmail.com wrote:
> > What's the best way to accomplish this? Am I over-complicating it? My gut
> > feeling is there is a better way than the following:
> >
> import itertools
> x = [1, 2, 3]
> y = list(itertoo
On 10/8/2012 3:28 PM, mooremath...@gmail.com wrote:
What's the best way to accomplish this? Am I over-complicating it? My gut
feeling is there is a better way than the following:
import itertools
x = [1, 2, 3]
y = list(itertools.chain.from_iterable(('insertme', x[i]) for i in
range(len(x)))
On 10/8/2012 11:13 AM, Dave Angel wrote:
Isn't it true, though, that Python 3.3 has a completely new
implementation of decimal that largely removes this disadvantage?
I wouldn't know, I'm on 3.2. However, I sincerely doubt if it's within
a factor of 100 of the speed of the binary float, at l
mooremath...@gmail.com wrote:
> What's the best way to accomplish this? Am I over-complicating it?
> My gut feeling is there is a better way than the following:
>
> >>> import itertools
> >>> x = [1, 2, 3]
> >>> y = list(itertools.chain.from_iterable(('insertme', x[i]) for i
> in range(len(x
2012/10/6 Tomer Filiba
> http://plumbum.readthedocs.org/en/latest/index.html
>
> Ever wished the wrist-handiness of shell scripts be put into a real
> programming language? Say hello to Plumbum Shell Combinators. Plumbum
> (Latin for lead, which was used to create pipes back in the day) is a smal
Thomas Bach wrote:
> Hi there,
>
> On Sat, Oct 06, 2012 at 03:08:38PM +, Steven D'Aprano wrote:
> >
> > my_tuple = my_tuple[:4]
> > a,b,c,d = my_tuple if len(my_tuple) == 4 else (my_tuple + (None,)*4)[:4]
> >
>
> Are you sure this works as you expect? I just stumbled over the following:
>
>
On Mon, 08 Oct 2012 12:28:43 -0700, mooremathewl wrote:
import itertools
x = [1, 2, 3]
y = list(itertools.chain.from_iterable(('insertme', x[i]) for i in
range(len(x y
> ['insertme', 1, 'insertme', 2, 'insertme', 3]
>>> [i for j in [1,2,3] for i in ('insertme', j)]
On 8 October 2012 22:45, Thomas Bach wrote:
> Hi there,
>
> On Sat, Oct 06, 2012 at 03:08:38PM +, Steven D'Aprano wrote:
> >
> > my_tuple = my_tuple[:4]
> > a,b,c,d = my_tuple if len(my_tuple) == 4 else (my_tuple + (None,)*4)[:4]
> >
>
> Are you sure this works as you expect? I just stumbled
mooremath...@gmail.com writes:
x = [1, 2, 3] ..
y
> ['insertme', 1, 'insertme', 2, 'insertme', 3]
def ix(prefix, x):
for a in x:
yield prefix
yield a
y = list(ix('insertme', x))
from itertools import *
y = list(chain.from_iterable(izip(repeat('insertme'
Agon Hajdari wrote:
> On 10/08/2012 11:15 PM, Prasad, Ramit wrote:
> > Agon Hajdari wrote:
> >>
> >> On 10/08/2012 09:45 PM, Chris Kaynor wrote:
> >>> [('insertme', i) for i in x]
> >>
> >> This is not enough, you have to merge it afterwards.
> >
> > Why do you say that? It seems to work just fine
Hi there,
On Sat, Oct 06, 2012 at 03:08:38PM +, Steven D'Aprano wrote:
>
> my_tuple = my_tuple[:4]
> a,b,c,d = my_tuple if len(my_tuple) == 4 else (my_tuple + (None,)*4)[:4]
>
Are you sure this works as you expect? I just stumbled over the following:
$ python
Python 3.2.3 (default, Jun 25
On 10/08/2012 11:15 PM, Prasad, Ramit wrote:
> Agon Hajdari wrote:
>> Sent: Monday, October 08, 2012 3:12 PM
>> To: python-list@python.org
>> Subject: Re: Insert item before each element of a list
>>
>> On 10/08/2012 09:45 PM, Chris Kaynor wrote:
>>> [('insertme', i) for i in x]
>>
>> This is not e
Agon Hajdari wrote:
> Sent: Monday, October 08, 2012 3:12 PM
> To: python-list@python.org
> Subject: Re: Insert item before each element of a list
>
> On 10/08/2012 09:45 PM, Chris Kaynor wrote:
> > [('insertme', i) for i in x]
>
> This is not enough, you have to merge it afterwards.
Why do you
mooremath...@gmail.com wrote:
> What's the best way to accomplish this? Am I over-complicating it? My
> gut feeling is there is a better way than the following:
>
import itertools
x = [1, 2, 3]
y = list(itertools.chain.from_iterable(('insertme', x[i]) for i in
range(len(x)))
On 10/08/2012 09:45 PM, Chris Kaynor wrote:
> [('insertme', i) for i in x]
This is not enough, you have to merge it afterwards.
y = [item for tup in y for item in tup]
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, Oct 8, 2012 at 1:52 PM, Joshua Landau
wrote:
> But it's not far. I wouldn't use Ian Kelly's method (no offence), because of
> len(x): it's less compatible with iterables. Others have ninja'd me with
> good comments, too.
That's fair, I probably wouldn't use it either. It points to a
poss
On 8 October 2012 20:28, wrote:
> What's the best way to accomplish this? Am I over-complicating it? My
> gut feeling is there is a better way than the following:
>
> >>> import itertools
> >>> x = [1, 2, 3]
> >>> y = list(itertools.chain.from_iterable(('insertme', x[i]) for i in
> range(len(x)
On 2012-10-08 20:28, mooremath...@gmail.com wrote:
What's the best way to accomplish this? Am I over-complicating it? My gut
feeling is there is a better way than the following:
import itertools
x = [1, 2, 3]
y = list(itertools.chain.from_iterable(('insertme', x[i]) for i in
range(len(x
On Mon, Oct 8, 2012 at 12:28 PM, wrote:
> What's the best way to accomplish this? Am I over-complicating it? My
> gut feeling is there is a better way than the following:
>
> >>> import itertools
> >>> x = [1, 2, 3]
> >>> y = list(itertools.chain.from_iterable(('insertme', x[i]) for i in
> rang
On Mon, Oct 8, 2012 at 1:28 PM, wrote:
> What's the best way to accomplish this? Am I over-complicating it? My gut
> feeling is there is a better way than the following:
>
import itertools
x = [1, 2, 3]
y = list(itertools.chain.from_iterable(('insertme', x[i]) for i in
ran
What's the best way to accomplish this? Am I over-complicating it? My gut
feeling is there is a better way than the following:
>>> import itertools
>>> x = [1, 2, 3]
>>> y = list(itertools.chain.from_iterable(('insertme', x[i]) for i in
>>> range(len(x
>>> y
['insertme', 1, 'insertme', 2,
On Mon, Oct 8, 2012 at 2:50 PM, Laszlo Nagy wrote:
>>
>> Seq validation
>> 1 Program3,1,3,4 # max(F1,F3) to F4
>> ..
>> n
>> How to using python to Read the text file, Build the data as object
>> class ?
>
> Open the file using the open() command. Then iterate over the lines within
Seq validation
1 Program3,1,3,4 # max(F1,F3) to F4
..
n
How to using python to Read the text file, Build the data as object
class ?
Open the file using the open() command. Then iterate over the lines
within a stateful algorithm that parses the lines with regular expressions.
Wh
Hi All
I have Data call FM01. Each format have F1.. F50 Fields. And Global
Program G1..Gn.
The format like below as text file
FM01
Fld #FieldValidation
1F1 N/A
2F2 N/A
3F3 Program1,1,2,3 # Add F1 and F2 value to F3
4F4
Am 08.10.2012 16:07, schrieb iMath:
To get the accurate value of 1 - 0.999 ,how to implement the python
algorithm ?
Algorithms are generally language-agnostic, so what is your question
BTW ,Windows’s calculator get the accurate value ,anyone who knows how to
implement it ?
You
On Tue, Oct 9, 2012 at 2:13 AM, Dave Angel wrote:
> On 10/08/2012 11:00 AM, Chris Angelico wrote:
>> On Tue, Oct 9, 2012 at 1:48 AM, Dave Angel wrote:
>>> The Decimal class has the disadvantage that it's tons slower on any modern
>>> machine I know of...
>> Isn't it true, though, that Python 3.3
On 10/08/2012 11:00 AM, Chris Angelico wrote:
> On Tue, Oct 9, 2012 at 1:48 AM, Dave Angel wrote:
>> import decimal
>> a = decimal.Decimal(4.3)
>> print(a)
>>
>> 5.0996447286321199499070644378662109375
> Ah, the delights of copy-paste :)
>
>> The Decimal class has the disadvantage that
On Tue, Oct 9, 2012 at 1:48 AM, Dave Angel wrote:
> import decimal
> a = decimal.Decimal(4.3)
> print(a)
>
> 5.0996447286321199499070644378662109375
Ah, the delights of copy-paste :)
> The Decimal class has the disadvantage that it's tons slower on any modern
> machine I know of...
On Monday, October 8, 2012 1:00:52 AM UTC+5:30, subhaba...@gmail.com wrote:
> Dear Group,
>
>
>
> Suppose I have a string as,
>
>
>
> "Project Gutenberg has 36000 free ebooks for Kindle Android iPad iPhone."
>
>
>
> I am terming it as,
>
>
>
> str1= "Project Gutenberg has 36000 free eb
On 10/08/2012 10:07 AM, iMath wrote:
> To get the accurate value of 1 - 0.999 ,how to implement the
> python algorithm ?
> BTW ,Windows’s calculator get the accurate value ,anyone who knows how to
> implement it ?
Windows calculator is an application, not a programming language. Lik
Thank you
On Mon, Oct 8, 2012 at 11:37 AM, alex23 wrote:
> On Oct 8, 1:03 pm, yujian wrote:
> > I want to save all the URLs in current opened windows, and then close
> > all the windows.
>
> Try mechanize or Selenium.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail
Hi all,
I'm very pleased to announce new releases of Pylint and
underlying ASTNG library, respectivly 0.26 and 0.24.1. The great
news is that both bring a lot of new features and some bug fixes,
mostly provided by the community effort.
We're still trying to make it easier to contribute on our fre
To get the accurate value of 1 - 0.999 ,how to implement the python
algorithm ?
BTW ,Windows’s calculator get the accurate value ,anyone who knows how to
implement it ?
--
http://mail.python.org/mailman/listinfo/python-list
On Friday, October 5, 2012 5:03:01 PM UTC+5:30, Günther Dietrich wrote:
> justmailha...@gmail.com wrote:
>
>
>
> >How to read properties file in Python? I found ConfigParser() but it has a
>
> >'section' limitation, so looking for other alternatives.
>
>
>
> Have a look at PyYAML.
>
>
>
46 matches
Mail list logo