> funcs = [ lambda x: x**i for i in range( 5 ) ]
> print funcs[0]( 2 )
> print funcs[1]( 2 )
> print funcs[2]( 2 )
>
> This gives me
>
> 16
> 16
> 16
>
> When I was excepting
>
> 1
> 2
> 4
>
> Does anyone know why?
And more importantly, what's the simplest way to achieve the latter? :)
--
Psss,
funcs = [ lambda x: x**i for i in range( 5 ) ]
print funcs[0]( 2 )
print funcs[1]( 2 )
print funcs[2]( 2 )
This gives me
16
16
16
When I was excepting
1
2
4
Does anyone know why?
Cheers,
Daniel
--
Psss, psss, put it down! - http://www.cafepress.com/putitdown
--
http://mail.python.org/mail
On Tue, 10 Jul 2012 10:46:08 -0700, Subhabrata wrote:
> Dear Group,
>
> I kept a good number of files in a folder. Now I want to read all of
> them. They are in different formats and different encoding. Using
> listdir/glob.glob I am able to find the list but how to open/read or
> process them fo
Mark Lawrence, 10.07.2012 11:42:
> I recall reading in a book in the local library
> of a manager that wouldn't employ people unless they were wearing a new
> pair of shoes. Guess they didn't take many people on.
Managers tend to like wasting resources. Buying a new pair of shoes for
each job int
On Jul 10, 4:29 am, Jean-Michel Pichavant
wrote:
> Why would you want to hire someone that knows something pointless as the
> version where feature X has been introduced ? Just tell him that feature
> X has been introducted in version Y, costless 2.5sec training. Don't you
> want to hire someone t
On Tue, Jul 10, 2012 at 1:02 PM, Ethan Furman wrote:
...
>
> Reminds me of a job posting a few years ago where the prospective employer
> wanted three plus years experience in some language, and that language had
> only been created a year and a half before.
I saw several of those when Java was n
Also:
Q3: Why are you explicitly setting the name of your "subFrame" widgets
instead of allowing Tkinter to assign a unique name?...AND are you
aware of the conflicts that can arise from such changes[1]?
Q4: Are you aware of the built-in function "enumerate"[2]? I see you
are passing around inde
On Tue, Jul 10, 2012 at 4:26 PM, Dennis Lee Bieber
wrote:
> On Tue, 10 Jul 2012 09:05:50 -0700, Ethan Furman
> declaimed the following in gmane.comp.python.general:
>
>> As an example from today, if someone claimed to have 5+ years of Python
>> experience, but didn't know that 'with' was standard
> what I want to do is
> 1.open cmd
> 2.waiting for user's typing
> 3.when I type "dir"
> 4.print the result of "dir"
> 5.then I type some other commands, printing the result until I type
> 'exit'
>
> I used
> p=subprocess.Popen('cmd',stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=s
> ubproce
I've tried to condense your code using the very limited info you have
provided. I have removed unnecessarily configuring of widgets and
exaggerated the widget borders to make debugging easier. Read below
for Q&A.
## START CONDENSED CODE ##
records = range(4)
CNF_SUBFRAME = {
'bd':5, # rowFram
else:
> print("%8.3f %s: Waited too long %6.3f" % (now()/60, self.name,
> wait) + " time units have passed - Customer has left")
> leavelist.append(self.acquired)
Yeah, I should have changed that back to :
leavelist.append(self.name) -- my thinking was that it would app
In Shamefaced
writes:
> else:
> print("%8.3f %s: Waited too long %6.3f" % (now()/60, self.name,
> wait) + " time units have passed - Customer has left")
> leavelist.append(self.acquired)
What is self.acquired? Judging from earlier code it appears to be a
funct
On 10/07/2012 18:46, Subhabrata wrote:
Dear Group,
I kept a good number of files in a folder. Now I want to read all of
them. They are in different formats and different encoding. Using
listdir/glob.glob I am able to find the list but how to open/read or
process them for different encodings?
If
Hi
I have coded a program whihc outputs what I like, but I am trying to modify it
to add specific result info to a list and then display the number of items in
the list. This is easy for me with basic code, but seems difficult when trying
to adapt my program.
My code and explanation is as follow
hello everyone, hope some of you enjoyed #EuroPython this past
week/end, and perhaps i'll see some of you at OSCON next week!
as promised, here's the one and only FINAL REMINDER of the hardcore
intro+intermediate Python course i'm offering 2012 Aug 1-3 near the
San Francisco airport. reach out to
I also judge candidates on their beards
(http://www.wired.com/wiredenterprise/2012/06/beard-gallery/). If the beard's
awesome enough, no questions needed. They're pro.
--
http://mail.python.org/mailman/listinfo/python-list
On 10/07/2012 18:12, Dennis Lee Bieber wrote:
On 10 Jul 2012 07:33:59 GMT, Steven D'Aprano
declaimed the following in
gmane.comp.python.general:
may not be capable of telling the difference between a cheese sandwich
and a box of hair -- and even the *good* interviewers are probably making
Dear Group,
I kept a good number of files in a folder. Now I want to read all of
them. They are in different formats and different encoding. Using
listdir/glob.glob I am able to find the list but how to open/read or
process them for different encodings?
If any one can help me out.I am using Pytho
On Wed, 11 Jul 2012 02:59:15 +1000, Chris Angelico wrote:
> On Wed, Jul 11, 2012 at 2:51 AM, Steven D'Aprano
> wrote:
>> If only that were true. I know quite a few people who looked the
>> interviewer straight in the eye and told the most bare-faced lies
>> without a trace of shame, and got the j
Steven D'Aprano wrote:
On Tue, 10 Jul 2012 11:29:24 +0200, Jean-Michel Pichavant wrote:
Why would you want to hire someone that knows something pointless as the
version where feature X has been introduced ? Just tell him that feature
X has been introducted in version Y, costless 2.5sec train
On Wed, Jul 11, 2012 at 2:51 AM, Steven D'Aprano
wrote:
> If only that were true. I know quite a few people who looked the
> interviewer straight in the eye and told the most bare-faced lies without
> a trace of shame, and got the job. Ten years on, at least one of them is
> making something aroun
Chris Angelico wrote:
On Wed, Jul 11, 2012 at 2:34 AM, Steven D'Aprano
wrote:
Of course, if they try to sell themselves as having
five years experience with Python 3.2...
... then they've been borrowing Guido's time machine for personal purposes.
Reminds me of a job posting a few years ago
Hi,
Wingware has released version 4.1.7 of Wing IDE, our integrated development
environment designed specifically for the Python programming language.
Wing IDE provides a professional quality code editor with vi, emacs, and
other
key bindings, auto-completion, call tips, refactoring, context-aw
On Tue, 10 Jul 2012 10:11:22 +0200, Christian Heimes wrote:
> Am 10.07.2012 09:33, schrieb Steven D'Aprano:
>> This is why I hate job interviews. You have like 30 minutes, or even as
>> little as 30 seconds, to make a good impression on somebody who may or
>> may not be capable of telling the diff
On Tue, 10 Jul 2012 11:29:24 +0200, Jean-Michel Pichavant wrote:
> Why would you want to hire someone that knows something pointless as the
> version where feature X has been introduced ? Just tell him that feature
> X has been introducted in version Y, costless 2.5sec training. Don't you
> want t
On Wed, Jul 11, 2012 at 2:34 AM, Steven D'Aprano
wrote:
> Of course, if they try to sell themselves as having
> five years experience with Python 3.2...
... then they've been borrowing Guido's time machine for personal purposes.
ChrisA
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 10 Jul 2012 09:05:50 -0700, Ethan Furman wrote:
> Jean-Michel Pichavant wrote:
>> Why would you want to hire someone that knows something pointless as
>> the version where feature X has been introduced ?
>
> As an example from today, if someone claimed to have 5+ years of Python
> experie
On Wed, Jul 11, 2012 at 1:55 AM, BartC wrote:
> There's also the risk of mixing up software created at home, with that done
> at work, with all the intellectual property issues that might arise.
You just make the matter clear from the beginning, for instance:
what's done at work stays at work, an
"Peter" wrote in message
news:35e7a860-fd41-4018-82f6-aabc32610...@googlegroups.com...
One of my favourite questions when interviewing - and it was 100% reliable
:-) - "what are your hobbies?"
If the answer included programming then they were hired, if not, then they
went to the "B" list.
Jean-Michel Pichavant wrote:
Why would you want to hire someone that knows something pointless as the
version where feature X has been introduced ?
As an example from today, if someone claimed to have 5+ years of Python
experience, but didn't know that 'with' was standard in 2.6 (or at least
On 10/07/2012 16:01, levi nie wrote:
aList=[3,2,5,4]
bList=aList[:]
bList.sort()
print "bList is",bList
cList=aList[:]
cList.sort(cmp)
print "cList is",cList
Why don't you tell us, you have the same documentatation avaialable as
everybody else.
--
Cheers.
Mark Lawrence.
--
http://mail
On 07/10/2012 11:01 AM, levi nie wrote:
> what's the effect of cmp here? The bList and cList is the same at last.
>
> code:
> aList=[3,2,5,4]
>
> bList=aList[:]
> bList.sort()
> print "bList is",bList
>
> cList=aList[:]
> cList.sort(cmp)
> print "cList is",cList
>
>
The main effect is for the read
On 07.07.12 04:56, Steven D'Aprano wrote:
On Fri, 06 Jul 2012 12:55:31 -0400, Karl Knechtel wrote:
Hello all,
While attempting to make a wrapper for opening multiple types of
UTF-encoded files (more on that later, in a separate post, I guess), I
ran into some oddities with the `codecs` module
On Jul 10, 12:33 pm, Steven D'Aprano wrote:
> This is why I hate job interviews. You have like 30 minutes, or even as
> little as 30 seconds, to make a good impression on somebody who may or
> may not be capable of telling the difference between a cheese sandwich
> and a box of hair -- and even th
what's the effect of cmp here? The bList and cList is the same at last.
code:
aList=[3,2,5,4]
bList=aList[:]
bList.sort()
print "bList is",bList
cList=aList[:]
cList.sort(cmp)
print "cList is",cList
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 2012-07-09 at 10:49 -0700, Rick Johnson wrote:
> On Jul 9, 12:58 am, Terry Reedy wrote:
> > When posting problem code, you should post a minimal, self-contained
> > example that people can try on other systems and versions. Can you
> > create the problem with one record, which you could gi
On 10/07/2012 09:11, Christian Heimes wrote:
Almost everybody can garden under ideal conditions. I grow about 15
herbs, strawberries, tomatoes, chillies and flowers on a small balcony
in the middle of the city. This year I'm going to harvest at least 200
tomatoes from two plants in a 1m * 40cm *
On 10/07/2012 09:03, Chris Angelico wrote:
On Tue, Jul 10, 2012 at 3:08 PM, Shambhu Rajak
wrote:
I agree with Christian, a developer should have hobbies other than computer
stuffs. Versatile environment give more
Ability to think differently.
I like playing guitar :-)
Music and programming d
Tim Chase wrote:
On 07/09/12 19:27, Roy Smith wrote:
prefer folks that know which features to check availability for
deployment.
Heh. Tell me, when did strings get methods? :-)
IIRC, ~2.0? I'm cognizant of the shift happening from the string
module to string methods, but I wo
Am 10.07.2012 09:33, schrieb Steven D'Aprano:
> This is why I hate job interviews. You have like 30 minutes, or even as
> little as 30 seconds, to make a good impression on somebody who may or
> may not be capable of telling the difference between a cheese sandwich
> and a box of hair -- and eve
On Tue, Jul 10, 2012 at 3:08 PM, Shambhu Rajak
wrote:
> I agree with Christian, a developer should have hobbies other than computer
> stuffs. Versatile environment give more
> Ability to think differently.
> I like playing guitar :-)
Music and programming do go VERY well together. My hobbies inc
Am 09.07.2012 17:51, schrieb Christian Tismer:
> It turns out to be a problem with multiple strips in a tiff file.
> PIL does not support that. Maybe I can find an easy solution,
> maybe I'm better off using
>
> smc.freeimage
>
> as suggested by Christian Heimes,
>
> we will see. Right now I'm p
42 matches
Mail list logo