On 27 February 2016 at 16:50, Ganesh Pal wrote:
> Iam on python 2.6 and Linux , I need input on the below program ,
> here is the spinet of my program
It would be much better if you presented a complete program here.
Otherwise the missing parts will confuse people. See:
http://sscce.org/
> file
On Sun, 28 Feb 2016 03:50 am, Ganesh Pal wrote:
> Iam on python 2.6 and Linux , I need input on the below program ,
> here is the spinet of my program
>
>
> filename='/tmp2/2.txt'
>
> def check_file():
> """
> Run the command parallel on all the machines , if there is a
> file named /
>>
> what is run(...)
>
The run (_ is a wrapper it uses suprocess.Popen and returns stdout
,error and extitcod e
> not a good idea to have catchall exception
how to fix this ?
>
>> > return False
>> > if __name__ == '__main__':
>> > main()
>> >
>> --
>>
> copy and paste your tr
On Sat, Feb 27, 2016 at 12:01 PM, Ganesh Pal wrote:
> changed baddr="" to file ="" in the example program , sorry for the typo
>
> > filename='/tmp2/2.txt'
> >
> > def check_file():
>
don't use global filename. just pass filename into check_file
def check_file(filename):
> > """
> > R
changed baddr="" to file ="" in the example program , sorry for the typo
> filename='/tmp2/2.txt'
>
> def check_file():
> """
> Run the command parallel on all the machines , if there is a
> file named /tmp/file2.txt extract file2.txt
>
> """
> global filename
> file = ''
>
[rearranged the responses in the right order]
Costin Gamenț, 09.11.2010 11:44:
On Tue, Nov 9, 2010 at 3:21 PM, Costin Gamenț wrote:
On Tue, Nov 9, 2010 at 11:33 AM, Stefan Behnel wrote:
Costin Gamenț, 09.11.2010 10:24:
Hi, I am trying to read a string as csv, but I encountered an odd
problem.
Thank you all for your interest in my problem. As Peter pointed out,
there was one row with zero elements in it and that's where my problem
was (of course it was the very last row, hence my confidence I have
"good" data).
Have a nice one,
Costin
On Tue, Nov 9, 2010 at 12:02 PM, Nitin Pawar wrote
You may want to try a spilt if you are getting 8 different elements then it
will give you a list of those elements
On Tue, Nov 9, 2010 at 3:21 PM, Costin Gamenț wrote:
> Thank you for your timely response. Yes, I am sure "i" and "j" are
> from the same iteration. I should point out that "i" actua
Thank you for your timely response. Yes, I am sure "i" and "j" are
from the same iteration. I should point out that "i" actually has 8
elements and that str(i) gives a nice printout.
On Tue, Nov 9, 2010 at 11:33 AM, Stefan Behnel wrote:
> Costin Gamenț, 09.11.2010 10:24:
>>
>> Hi, I am trying to
Costin Gamenț wrote:
> Hi, I am trying to read a string as csv, but I encountered an odd
> problem. Here's my code:
>
> csvfile = csv.reader(datastr.split('\n'), delimiter=';')
> r = ''
> for i in csvfile:
> for j in i:
> print j
>
Costin Gamenț, 09.11.2010 10:24:
Hi, I am trying to read a string as csv, but I encountered an odd
problem. Here's my code:
csvfile = csv.reader(datastr.split('\n'), delimiter=';')
r = ''
for i in csvfile:
for j in i:
print j
On May 13, 2:39 pm, Georgy Panterov <[EMAIL PROTECTED]> wrote:
>
> def deal_hand(deck):
> HAND=[]
> for _ in range(2):
> i=random.randint(0,len(deck)) #produces a random card from the deck
^ Here i can be from 0 thru (the number of cards in the
deck).
> HAND.appen
random.randint(x,y) returns a random integer between _and including_ x and
y, so randint(0, len(deck)) might return len(deck) and since python's
indices start at 0, the maximum index is len(deck)-1.
rather than using randint(0,len(deck)-1) you could just do
card = random.choice(deck)
HAND.append
TheFlyingDutchman wrote:
>> I explain it by noting that list.index and dict.get serve totally
>> different purposes. The former returns the index given a value; the
>> latter returns a value given a key.
>
> And the former raises an exception if the value is not found, while
> the latter returns N
>
> I explain it by noting that list.index and dict.get serve totally
> different purposes. The former returns the index given a value; the
> latter returns a value given a key.
And the former raises an exception if the value is not found, while
the latter returns None if the value is not found.
Neil Cerutti <[EMAIL PROTECTED]> wrote:
> It's probable that a simpler implementation using slice
> operations will be faster for shortish lengths of subseq. It was
> certainly easier to get it working correctly. ;)
>
> def find(seq, subseq):
> for i, j in itertools.izip(xrange(len(seq)-len(sub
Lawrence D'Oliveiro <[EMAIL PROTECTED]> writes:
> In message <[EMAIL PROTECTED]>,
> Jason wrote:
>
> > The reason why the exception is more Pythonic is that the return
> > value is always a guaranteed good index into the list.
>
> How do you explain dict.get, then?
I explain it by noting that l
In message <[EMAIL PROTECTED]>, Jason
wrote:
> The reason why the exception is more Pythonic is that the return value
> is always a guaranteed good index into the list.
How do you explain dict.get, then?
--
http://mail.python.org/mailman/listinfo/python-list
On 2007-09-04, Campbell Barton <[EMAIL PROTECTED]> wrote:
> Jason wrote:
>> Returning -1 is not a good return value to indicate an error.
>> After all, -1 is a valid index in most Python lists.
>> (Negative numbers index from the tail of the list.)
>
> Agree in general tho its a bit inconsistent ho
Jason wrote:
> On Aug 30, 1:27 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
>> On Thu, 30 Aug 2007 17:09:36 +1000, Ben Finney wrote:
>>> [EMAIL PROTECTED] writes:
What's with the index() function of lists throwing an exception on not
found?
>>> It's letting you know that the it
On Aug 30, 1:27 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> On Thu, 30 Aug 2007 17:09:36 +1000, Ben Finney wrote:
> > [EMAIL PROTECTED] writes:
>
> >> What's with the index() function of lists throwing an exception on not
> >> found?
>
> > It's letting you know that the item isn't in
On Mon, 03 Sep 2007 19:56:04 -0700, TheFlyingDutchman wrote
> [...] my fork of Python 3, which I am
> pleased to announce now, is called Python 3.01 while in development,
> and will be known as Python 3000 or Python 3K when it gets to a productional
> release.
I hope you're joking.
-Carsten
--
>
> Actually there was. The OP's claim
> | There are a million situations where you can have an item not be in
> | a list and it is not an exception situation.
>
> ...is just plain nonsense. zzbbaadd neither does understand exceptions
> nor what they are used for in Python. An item not being in a
Thorsten Kampe <[EMAIL PROTECTED]> writes:
> * Ben Finney (Thu, 30 Aug 2007 18:02:15 +1000)
> > Bruno Desthuilliers <[EMAIL PROTECTED]> writes:
> > > What's with using your brain instead of whining ?
> >
> > Now now, no need for snappiness.
>
> Actually there was. The OP's claim [...] ...is just
* Ben Finney (Thu, 30 Aug 2007 18:02:15 +1000)
> Bruno Desthuilliers <[EMAIL PROTECTED]> writes:
> > What's with using your brain instead of whining ?
>
> Now now, no need for snappiness.
Actually there was. The OP's claim
| There are a million situations where you can have an item not be in
| a
* Terry Reedy (Fri, 31 Aug 2007 02:28:36 -0400)
> "Marc 'BlackJack' Rintsch" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> | On Thu, 30 Aug 2007 17:09:36 +1000, Ben Finney wrote:
> | > [EMAIL PROTECTED] writes:
> | >> What's with the index() function of lists throwing an exceptio
On 9/2/07, Zentrader <[EMAIL PROTECTED]> wrote:
>
> On Aug 30, 11:23 am, [EMAIL PROTECTED] wrote:
> > Neil, Steve,
> >
> > Thanks for the responses on sets. I have not used them before and was
> > not even aware Python had them. I will try them out.
>
> And if there weren't sets you would still not
On Aug 30, 11:23 am, [EMAIL PROTECTED] wrote:
> Neil, Steve,
>
> Thanks for the responses on sets. I have not used them before and was
> not even aware Python had them. I will try them out.
And if there weren't sets you would still not use find or index but a
brute force method or dictionaries
for
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> On Sat, 01 Sep 2007 13:44:28 -0600, Michael L Torrie wrote:
>
> > Alex Martelli wrote:
> >
> >> is the "one obvious way to do it" (the set(...) is just a simple and
> >> powerful optimization -- checking membership in a set is roughly O(1),
>
On Sat, 01 Sep 2007 13:37:29 -0600, Michael L Torrie wrote:
> What's wrong, then, with doing:
>
> if i in list:
>print list.index(i)
If `i` is in the list this does the linear lookup twice.
> If we were to program this .index() method in some language that
> enforces contracts, like haskell
On Sat, 01 Sep 2007 13:44:28 -0600, Michael L Torrie wrote:
> Alex Martelli wrote:
>
>> is the "one obvious way to do it" (the set(...) is just a simple and
>> powerful optimization -- checking membership in a set is roughly O(1),
>> while checking membership in a list of N items is O(N)...).
>
Alex Martelli wrote:
> is the "one obvious way to do it" (the set(...) is just a simple and
> powerful optimization -- checking membership in a set is roughly O(1),
> while checking membership in a list of N items is O(N)...).
Depending on a how a set is stored, I'd estimate any membership check
[EMAIL PROTECTED] wrote:
> In my case of have done os.listdir() on two directories. I want to see
> what files are in directory A that are not in directory B.
> I have used exceptions in other languages and only do so on logic that
> should never happen. In this case it is known that some of the fi
On Aug 30, 7:00 pm, Steve Holden <[EMAIL PROTECTED]> wrote:
> You can also generate the files that are in one directory but ot the
> other with
>
> (afiles | bfiles) - (afiles & bfiles)
Or just (afiles ^ bfiles).
Nicko
--
(lambda f: lambda *a:f(f,*a))(
lambda f,l,i:l[i][1]+f(f,l,l[i][0]
Steve Holden wrote:
> Ricardo Aráoz wrote:
>> Paddy wrote:
>>> On Sep 1, 7:57 am, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote:
"Richie Hindle" wrote:
> But - the word for someone who posts to the internet with the intention of
> stirring up trouble derives from the word for what fi
Ricardo Aráoz wrote:
> Paddy wrote:
>> On Sep 1, 7:57 am, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote:
>>> "Richie Hindle" wrote:
But - the word for someone who posts to the internet with the intention of
stirring up trouble derives from the word for what fishermen do, not from
t
Paddy wrote:
> On Sep 1, 7:57 am, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote:
>> "Richie Hindle" wrote:
>>> But - the word for someone who posts to the internet with the intention of
>>> stirring up trouble derives from the word for what fishermen do, not from
>>> the word for something that l
"Steve Holden" wrote:
> Where's Godwin's Law when yo need it?
Hitler would not have spellt "you" like that...
- Hendrik
--
http://mail.python.org/mailman/listinfo/python-list
"Steve Holden" <[EMAIL PROTECTED]> wrote:
> Paddy wrote:
> > My accent is probably from the East Midlands of the UK, but is not
> > pronounced.
> >
> If your accent isn't pronounced how do we know what it sounds like?
>
When he says pronounced, he doesn't mean pronounced, he means pronounced
On Sat, 01 Sep 2007 17:23:04 +1000, Ben Finney wrote:
> Dennis Lee Bieber <[EMAIL PROTECTED]> writes:
>
>> I suppose you also add an extra "i" to aluminum
>
> We're not out to rewrite the table of elements. There's no such thing as
> "aluminum", and "aluminium" always has just the two "i"s.
Al
On Sep 1, 7:32 am, Steve Holden <[EMAIL PROTECTED]> wrote:
> Dennis Lee Bieber wrote:
> > On Fri, 31 Aug 2007 21:15:10 +0100, DaveM <[EMAIL PROTECTED]>
> > declaimed the following in comp.lang.python:
>
> >> No - but I would pronounce "lever" and "fever" the same way, if that helps.
>
> > To me
On Sep 1, 7:57 am, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote:
> "Richie Hindle" wrote:
> > But - the word for someone who posts to the internet with the intention of
> > stirring up trouble derives from the word for what fishermen do, not from
> > the word for something that lives under a bri
Dennis Lee Bieber <[EMAIL PROTECTED]> writes:
> I suppose you also add an extra "i" to aluminum
We're not out to rewrite the table of elements. There's no such thing
as "aluminum", and "aluminium" always has just the two "i"s.
--
\ "Rightful liberty is unobstructed action, according
Hendrik van Rooyen wrote:
> "Richie Hindle" wrote:
>
>> But - the word for someone who posts to the internet with the intention of
>> stirring up trouble derives from the word for what fishermen do, not from
>> the word for something that lives under a bridge. It derives from "trolling
>> for su
"Richie Hindle" wrote:
> But - the word for someone who posts to the internet with the intention of
> stirring up trouble derives from the word for what fishermen do, not from
> the word for something that lives under a bridge. It derives from "trolling
> for suckers" or "trolling for newbies".
"Paddy" wrote:
>
> I say the 'oll' in troll like the 'ol' in frolic, and pronounce roll
> and role similarly.
>
> My accent is probably from the East Midlands of the UK, but is not
> pronounced.
Same here - when the Troll lives under a bridge - I could not think
of something to rhyme with it -
Dennis Lee Bieber wrote:
> On Fri, 31 Aug 2007 21:15:10 +0100, DaveM <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
>
>> No - but I would pronounce "lever" and "fever" the same way, if that helps.
>>
>To me, those are different... I suppose you also add an
> extra "i
"Erik Max Francis" wrote:
> Hendrik van Rooyen wrote:
>
> > weird this - maybe a native English speaker can comment -
> > when I pronounce what fishermen do - it rhymes with roll,
> > but when I am talking about the thing that lives under bridges
> > and munches goats, the "O" sound is shorte
On Sat, 2007-09-01 at 13:50 +1200, Lawrence D'Oliveiro wrote:
> In message <[EMAIL PROTECTED]>, Carsten
> Haese wrote:
> > has_key() will go away, period. It has been made obsolete by "in", which
> > is faster and more concise.
>
> And is also a backdoor way of introducing non-virtual methods into
In message <[EMAIL PROTECTED]>, Carsten
Haese wrote:
> On Thu, 2007-08-30 at 11:21 -0700, [EMAIL PROTECTED] wrote:
>
>> I wish they were not
>> getting rid of dict.has_key() in Python 3, which I prefer to IN.
>
> That wish will only come true if you maintain your own fork of Python 3.
> has_key()
On Fri, 31 Aug 2007 02:37:15 -0700, Erik Max Francis <[EMAIL PROTECTED]>
wrote:
>_Troll_ and _frolic_ aren't pronounced with the same "o" sound in any
>accent I've ever heard of.
You've never heard an English accent then.
>Which you pronounce _boat_ and _bot_ the same way, too?
No - but I wo
Alex Martelli wrote:
> [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>...
>> Why wouldn't "the one obvious way" be:
>>
>> def inAnotB(A, B):
>> inA = set(os.listdir(A))
>> inBs = set(os.listdir(B))
>> return inA.difference(inBs)
>
> If you want a set as the result, that's one p
Paddy wrote:
> On Aug 31, 8:47 am, Erik Max Francis <[EMAIL PROTECTED]> wrote:
>> Hendrik van Rooyen wrote:
>>> weird this - maybe a native English speaker can comment -
>>> when I pronounce what fishermen do - it rhymes with roll,
>>> but when I am talking about the thing that lives under bridges
On Fri, Aug 31, 2007 at 10:27:34AM +0100, Richie Hindle wrote:
>
> [Carsten]
> > .. If we start labeling
> > people, this thread will earn you a label that rhymes with "roll".
>
> [Hendrik]
> > weird this - maybe a native English speaker can comment -
> > when I pronounce what fi
On Aug 31, 11:05 am, Jon Ribbens <[EMAIL PROTECTED]> wrote:
> On 2007-08-31, Erik Max Francis <[EMAIL PROTECTED]> wrote:
>
> >> I say the 'oll' in troll like the 'ol' in frolic, and pronounce roll
> >> and role similarly.
>
> >> My accent is probably from the East Midlands of the UK, but is not
> >
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
...
> Why wouldn't "the one obvious way" be:
>
> def inAnotB(A, B):
> inA = set(os.listdir(A))
> inBs = set(os.listdir(B))
> return inA.difference(inBs)
If you want a set as the result, that's one possibility (although
possibly a bi
On 8/30/07, Carsten Haese <[EMAIL PROTECTED]> wrote:
> Is the Pythonic way
>
> try:
> i = somelist.index(thing)
> # Do something with i
> except IndexError:
> # Do something if thing not found
That is not the Pythonic way. "# Do something with i" might also raise
an IndexError and they
>
> Fair enough, but that's a tutorial. It would be foolish to demand that a
> tutorial be a complete reference for everything that can be done with a list.
I wasn't demanding anything of the page. I was pointing out how I made
the assumption there was no way to find out if a list has a value
oth
On Thu, 30 Aug 2007 21:33:43 -0700, TheFlyingDutchman wrote
> On Aug 30, 9:06 pm, "Carsten Haese" <[EMAIL PROTECTED]> wrote:
> > On Thu, 30 Aug 2007 20:17:00 -0700, zzbbaadd wrote
> >
> > > Well IN was what I was looking for and would have saved this thread.
> > > However I don't believe IN showed
[Carsten]
> .. If we start labeling
> people, this thread will earn you a label that rhymes with "roll".
[Hendrik]
> weird this - maybe a native English speaker can comment -
> when I pronounce what fishermen do - it rhymes with roll,
> but when I am talking about the thing that
On 2007-08-31, Erik Max Francis <[EMAIL PROTECTED]> wrote:
>> I say the 'oll' in troll like the 'ol' in frolic, and pronounce roll
>> and role similarly.
>>
>> My accent is probably from the East Midlands of the UK, but is not
>> pronounced.
>
> _Troll_ and _frolic_ aren't pronounced with the same
Erik Max Francis wrote:
> Paddy wrote:
>
>> I say the 'oll' in troll like the 'ol' in frolic, and pronounce roll
>> and role similarly.
>>
>> My accent is probably from the East Midlands of the UK, but is not
>> pronounced.
>
> _Troll_ and _frolic_ aren't pronounced with the same "o" sound in any
Paddy wrote:
> I say the 'oll' in troll like the 'ol' in frolic, and pronounce roll
> and role similarly.
>
> My accent is probably from the East Midlands of the UK, but is not
> pronounced.
_Troll_ and _frolic_ aren't pronounced with the same "o" sound in any
accent I've ever heard of. Which y
On Aug 31, 8:47 am, Erik Max Francis <[EMAIL PROTECTED]> wrote:
> Hendrik van Rooyen wrote:
> > weird this - maybe a native English speaker can comment -
> > when I pronounce what fishermen do - it rhymes with roll,
> > but when I am talking about the thing that lives under bridges
> > and munches
[EMAIL PROTECTED] a écrit :
(snip)
> I don't think that is the definition used across computer science.
>
> It suddenly dawned on me that what would be best would be a contains()
> (or IN syntax for those who can't afford to wait) for lists.
No need to wait:
>>> 'a' in ['a', 'b']
True
>>> ['a'
Hendrik van Rooyen wrote:
> weird this - maybe a native English speaker can comment -
> when I pronounce what fishermen do - it rhymes with roll,
> but when I am talking about the thing that lives under bridges
> and munches goats, the "O" sound is shorter, and more
> towards the back of my mout
"Carsten Haese" wrote:
> .. If we start labeling
> people, this thread will earn you a label that rhymes with "roll".
weird this - maybe a native English speaker can comment -
when I pronounce what fishermen do - it rhymes with roll,
but when I am talking about the thing that li
[EMAIL PROTECTED] a écrit :
> On Aug 30, 4:28 pm, Ben Finney <[EMAIL PROTECTED]>
> wrote:
>> [EMAIL PROTECTED] writes:
>>> On Aug 30, 12:09 am, Ben Finney <[EMAIL PROTECTED]>
>>> wrote:
It's letting you know that the item isn't in the list. There's no
sensible return value from an "index"
"Marc 'BlackJack' Rintsch" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| On Thu, 30 Aug 2007 17:09:36 +1000, Ben Finney wrote:
|
| > [EMAIL PROTECTED] writes:
| >
| >> What's with the index() function of lists throwing an exception on not
| >> found?
| >
| > It's letting you know
On Aug 30, 9:06 pm, "Carsten Haese" <[EMAIL PROTECTED]> wrote:
> On Thu, 30 Aug 2007 20:17:00 -0700, zzbbaadd wrote
>
> > Well IN was what I was looking for and would have saved this thread.
> > However I don't believe IN showed up on the doc web page that has
> > list methods, where I found index(
On Thu, 30 Aug 2007 20:06:38 -0700, zzbbaadd wrote
> On Aug 30, 4:48 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote:
> > > It suddenly dawned on me that what would be best would be a contains()
> > > (or IN syntax for those who can't afford to wait) for lists.
> >
> > > if mylist.contains("hello):
>
On Thu, 30 Aug 2007 20:17:00 -0700, zzbbaadd wrote
> Well IN was what I was looking for and would have saved this thread.
> However I don't believe IN showed up on the doc web page that has
> list methods, where I found index().
They're not on the exact same page, but index() is in section 3.6.4
On Aug 30, 9:26 pm, [EMAIL PROTECTED] (Alex Martelli) wrote:
> <[EMAIL PROTECTED]> wrote:
>
>...
>
> > In my case of have done os.listdir() on two directories. I want to see
> > what files are in directory A that are not in directory B.
>
> So why would you care about WHERE, in the listdir of B
> Either I'm misunderstanding what you mean or you need to get a clue
> about what Python can already do before you go around making suggestions
> for what Python needs. Lists have supported "in" tests since at least
> version 1.5.2:
>
Well IN was what I was looking for and would have saved this t
On Aug 30, 4:48 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote:
> On 8/30/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Aug 30, 4:31 pm, Ben Finney <[EMAIL PROTECTED]>
> > wrote:
> > > [EMAIL PROTECTED] writes:
> > > > In my case of have done os.listdir() on two directories. I want to
Ricardo Aráoz <[EMAIL PROTECTED]> wrote:
...
> Alex Martelli wrote:
> > <[EMAIL PROTECTED]> wrote:
> >...
> >> In my case of have done os.listdir() on two directories. I want to see
> >> what files are in directory A that are not in directory B.
> >
> > So why would you care about WHERE, in
In message <[EMAIL PROTECTED]>, Ben Finney wrote:
> [EMAIL PROTECTED] writes:
>
>> What's with the index() function of lists throwing an exception on not
>> found?
>
> It's letting you know that the item isn't in the list. There's no
> sensible return value from an "index" function in that condi
Alex Martelli wrote:
> <[EMAIL PROTECTED]> wrote:
>...
>> In my case of have done os.listdir() on two directories. I want to see
>> what files are in directory A that are not in directory B.
>
> So why would you care about WHERE, in the listdir of B, are to be found
> the files that are in A b
<[EMAIL PROTECTED]> wrote:
...
> In my case of have done os.listdir() on two directories. I want to see
> what files are in directory A that are not in directory B.
So why would you care about WHERE, in the listdir of B, are to be found
the files that are in A but not B?! You should call .inde
On Fri, 2007-08-31 at 12:57 +1200, Lawrence D'Oliveiro wrote:
> In message <[EMAIL PROTECTED]>, Steve
> Holden wrote:
>
> > But why would you want to ignore built-in support like "value in dict"?
>
> Because a function can be passed as a value in its own right, a built-in
> construct cannot.
...
In message <[EMAIL PROTECTED]>, Steve
Holden wrote:
> But why would you want to ignore built-in support like "value in dict"?
Because a function can be passed as a value in its own right, a built-in
construct cannot.
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 2007-08-30 at 16:42 -0700, [EMAIL PROTECTED] wrote:
> It suddenly dawned on me that what would be best would be a contains()
> (or IN syntax for those who can't afford to wait) for lists.
Either I'm misunderstanding what you mean or you need to get a clue
about what Python can already do b
On 8/30/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> On Aug 30, 4:31 pm, Ben Finney <[EMAIL PROTECTED]>
> wrote:
> > [EMAIL PROTECTED] writes:
> > > In my case of have done os.listdir() on two directories. I want to see
> > > what files are in directory A that are not in directory B.
> >
> >
On Aug 30, 4:31 pm, Ben Finney <[EMAIL PROTECTED]>
wrote:
> [EMAIL PROTECTED] writes:
> > In my case of have done os.listdir() on two directories. I want to see
> > what files are in directory A that are not in directory B.
>
> You get that information unambiguously. It's an exceptional case,
> sin
On Aug 30, 4:28 pm, Ben Finney <[EMAIL PROTECTED]>
wrote:
> [EMAIL PROTECTED] writes:
> > On Aug 30, 12:09 am, Ben Finney <[EMAIL PROTECTED]>
> > wrote:
> > > It's letting you know that the item isn't in the list. There's no
> > > sensible return value from an "index" function in that condition.
>
[EMAIL PROTECTED] writes:
> In my case of have done os.listdir() on two directories. I want to see
> what files are in directory A that are not in directory B.
You get that information unambiguously. It's an exceptional case,
since there's no index to return, so it throws an exception.
> I have
[EMAIL PROTECTED] writes:
> On Aug 30, 12:09 am, Ben Finney <[EMAIL PROTECTED]>
> wrote:
> > It's letting you know that the item isn't in the list. There's no
> > sensible return value from an "index" function in that condition.
>
> for str:
> find( sub[, start[, end]])
> [...]
> Return -
On Thu, 30 Aug 2007 09:41:00 -0700, zzbbaadd wrote:
> On Aug 30, 12:09 am, Ben Finney <[EMAIL PROTECTED]>
> wrote:
>> [EMAIL PROTECTED] writes:
>> > What's with the index() function of lists throwing an exception on not
>> > found?
>>
>> It's letting you know that the item isn't in the list. There
On Aug 30, 5:41 pm, [EMAIL PROTECTED] wrote:
> On Aug 30, 12:09 am, Ben Finney <[EMAIL PROTECTED]>
> wrote:
>
> > [EMAIL PROTECTED] writes:
> > > What's with the index() function of lists throwing an exception on not
> > > found?
>
> > It's letting you know that the item isn't in the list. There's
On Aug 30, 7:00 pm, Steve Holden <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> >> How could it not be an exception, in the plain English sense of the
> >> word? Most certainly you're asking for the index because you want to do
> >> something with the index. If the item is not found, you h
On Thu, 2007-08-30 at 11:45 -0700, [EMAIL PROTECTED] wrote:
> > That wish will only come true if you maintain your own fork of Python 3.
> > has_key() will go away, period. It has been made obsolete by "in", which
> > is faster and more concise.
>
> Is there really some reason "key" IN dict can b
On 8/30/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > That wish will only come true if you maintain your own fork of Python 3.
> > has_key() will go away, period. It has been made obsolete by "in", which
> > is faster and more concise.
>
> Is there really some reason "key" IN dict can be
On 2007-08-30, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> That wish will only come true if you maintain your own fork of
>> Python 3. has_key() will go away, period. It has been made
>> obsolete by "in", which is faster and more concise.
>
> Is there really some reason "key" IN dict can be im
> That wish will only come true if you maintain your own fork of Python 3.
> has_key() will go away, period. It has been made obsolete by "in", which
> is faster and more concise.
Is there really some reason "key" IN dict can be implemented faster
than dict.has_key("key")???
--
http://mail.p
[EMAIL PROTECTED] wrote:
>> While I agree that Bruno's response was perhaps needlessly snippy, your
>> original question was needlessly inflammatory, as if you somehow wanted
>> some "religious zealot" to act the way Bruno did. If we start labeling
>> people, this thread will earn you a label that
On Thu, 2007-08-30 at 11:21 -0700, [EMAIL PROTECTED] wrote:
> I wish they were not
> getting rid of dict.has_key() in Python 3, which I prefer to IN.
That wish will only come true if you maintain your own fork of Python 3.
has_key() will go away, period. It has been made obsolete by "in", which
is
Neil, Steve,
Thanks for the responses on sets. I have not used them before and was
not even aware Python had them. I will try them out.
--
http://mail.python.org/mailman/listinfo/python-list
> While I agree that Bruno's response was perhaps needlessly snippy, your
> original question was needlessly inflammatory, as if you somehow wanted
> some "religious zealot" to act the way Bruno did. If we start labeling
> people, this thread will earn you a label that rhymes with "roll".
>
That is
> From: [EMAIL PROTECTED]
> >
> > How could it not be an exception, in the plain English sense of the
> > word? Most certainly you're asking for the index because you want to
do
> > something with the index. If the item is not found, you have no
index,
> > so that's a special case that must be hand
On 2007-08-30, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> How could it not be an exception, in the plain English sense
>> of the word? Most certainly you're asking for the index
>> because you want to do something with the index. If the item
>> is not found, you have no index, so that's a spec
1 - 100 of 135 matches
Mail list logo