> Here's an example of an explicit request to revive the generator:
>
g = (x*x for x in range(3))
for x in g: print x
> 0
> 1
> 4
g = (x*x for x in range(3)) # revive the generator
for x in g: print x #now this will work
> 0
> 1
> 4
>
> ChrisA
What if the generator is p
Yingjie Lan writes:
> - Original Message -
>> From: Paul Rudin
>> Generators are like that - you consume them until they run out of
>> values. You could have done [x*x for x in range(3)] and then iterated
>> over that list as many times as you wanted.
>>
>> A generator doesn't have to
- Original Message -
> From: Paul Rudin
> The language has no explicit notion of a request to "revive" a
> generator. You could use the same syntax to make a new generator that
> yeilds the same values as the one you started with if that's what you
> want.
>
> As we've already discussed
- Original Message -
> From: Paul Rudin
> To: python-list@python.org
> Cc:
> Sent: Friday, October 21, 2011 3:27 PM
> Subject: Re: revive a generator
>
>
> The language has no explicit notion of a request to "revive" a
> generator. You could use the same syntax to make a new generator
I have to classes a and b
class a(object):
def __init__(self,x):
self.x = x
self.build()
def build(self):
return
class b(a):
def __init__(self,x):
a.__init__(self,x)
self.y = 0 # ???
def build(self):
# do something
self.
Yingjie Lan writes:
>
>
> What if the generator involves a variable from another scope,
> and before re-generating, the variable changed its value.
> Also, the generator could be passed in as an argument,
> so that we don't know its exact expression.
>
vo = 34
g = (vo*x for x in range(3
On Fri, Oct 21, 2011 at 7:02 PM, Yingjie Lan wrote:
> What if the generator involves a variable from another scope,
> and before re-generating, the variable changed its value.
> Also, the generator could be passed in as an argument,
> so that we don't know its exact expression.
>
There's actually
On Fri, Oct 21, 2011 at 7:07 PM, Sverre wrote:
> The line marked with "???" will no be executed and I don't know the
> reason. This example is working as intended, but not not the code I'm
> working on. I'm using Eclipse. I don't know how to debug this
> problem.
>
Did you notice the error you go
On Oct 21, 10:07 am, Sverre wrote:
> I have to classes a and b
>
> class a(object):
> def __init__(self,x):
> self.x = x
> self.build()
>
> def build(self):
> return
>
> class b(a):
> def __init__(self,x):
> a.__init__(self,x)
> self.y = 0 # ??
- Original Message -
> From: Paul Rudin
>
> I'm not really sure whether you intend g to yield the original values
> after your "revive" or new values based on the new value of vo. But
> still you can make a class that supports the iterator protocol and does
> whatever you want (but you
On Fri, Oct 21, 2011 at 12:10 AM, Pankaj wrote:
> I want to make an api that would recieve the SMS text from the user
> and process it then send the result back to the use. Is there any api
> that I can use to do this??
There would seem to be several options:
http://pypi.python.org/pypi?%3Aaction
- Original Message -
> From: Chris Angelico
> To: python-list@python.org
> Cc:
> Sent: Friday, October 21, 2011 4:27 PM
> Subject: Re: revive a generator
>
> On Fri, Oct 21, 2011 at 7:02 PM, Yingjie Lan wrote:
>> What if the generator involves a variable from another scope,
>> and
Hi!
Win7/x64, Python 3.2, PyPGSQL f 3.2 and Apahce 2.2.
I created a script that working in CGI mode, it is read some table,
and returns with an XML.
It was working with normal mode, under Pyscripter, and under command
line.
But!
When I trying to use it from Apache 2.2 as cgi, I got the subject
durumdara wrote:
> Hi!
>
> Win7/x64, Python 3.2, PyPGSQL f 3.2 and Apahce 2.2.
>
> I created a script that working in CGI mode, it is read some table,
> and returns with an XML.
>
> It was working with normal mode, under Pyscripter, and under command
> line.
>
> But!
>
> When I trying to use
Sverre wrote:
I have to classes a and b
class a(object):
def __init__(self,x):
self.x = x
self.build()
def build(self):
return
class b(a):
def __init__(self,x):
a.__init__(self,x)
self.y = 0 # ???
def build(self):
# do somethi
On Oct 21, 11:36 am, Ben Finney wrote:
> rusi writes:
> > The American programmer would profit more from learning Latin than
> > from learning yet another programming language.
>
> > Edsger Dijkstra in "On the fact that the Atlantic Ocean has two
> > sides"
>
> >http://www.cs.utexas.edu/users/EWD
On 10/20/2011 10:09 PM, Yingjie Lan wrote:
What if the generator is passed in as an argument
when you are writing a function? That is, the expression
is not available?
Secondly, it would be nice to automatically revive it.
For example, when another for-statement or other
equivalent is appli
On 21 окт, 13:50, Ian Kelly wrote:
> On Thu, Oct 20, 2011 at 10:17 PM, Yosifov Pavel wrote:
> > Little silly example:
>
> > class MyFile(file):
> > šdef __init__(self, *a, **ka):
> > š šsuper(MyFile, self).__init__(*a, **ka)
> > š šself.commented = 0
> > šdef write(self, s):
> > š šif s.startswit
Hey everyone.
First, I apologize because I know this question has probably gotten
asked a lot. I am looking to automate filling out web forms, and no,
its not for spamming purposes.
I have looked at mechanize so far, but I'm not sure it quite fits what
I'm looking for. I know it can act as a brows
On Thu, 20 Oct 2011 19:09:42 -0700, Yingjie Lan wrote:
>> Here's an example of an explicit request to revive the generator:
>
>
> g = (x*x for x in range(3))
> for x in g: print x
>> 0
>> 1
>> 4
> g = (x*x for x in range(3)) # revive the generator for x in g:
> print x #now t
On Fri, Oct 21, 2011 at 2:02 AM, Yingjie Lan wrote:
> Oops, my former reply has the code indentation messed up
> by the mail system. Here is a reformatted one:
>
>
> What if the generator involves a variable from another scope,
> and before re-generating, the variable changed its value.
> Also, th
Thanks Alec.
For me it works with the following Default key :
"C:\Python32\pythonw.exe" "C:\Python32\Lib\idlelib\idle.pyw" -e "%1"
Otherwise IDLE does not open, only python was executed.
--
http://mail.python.org/mailman/listinfo/python-list
On 2011-10-21, Matty Sarro wrote:
> First, I apologize because I know this question has probably gotten
> asked a lot. I am looking to automate filling out web forms, and no,
> its not for spamming purposes.
I use ClientForm for that, and I'm happy with it.
--
Grant Edwards grant
Need to refine a question I asked earlier. If I have a module,
|-- foo
|---|
|---|---bar
|---|---|
|---|---|---__init__.py
then I can say import foo.bar
But suppose I want to import foo.bar.stuff and stuff isn't located on
under `bar' because it's user
supplied code:
|-
1. Define a new class with an instance of the foo class included so that one
can use all foo's properties and add new attributes.
2. Derive a new class from foo that extends its properties with the properties
in foo accessible.
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Oct 21, 2011 at 8:05 AM, Shane wrote:
> Need to refine a question I asked earlier. If I have a module,
>
> |-- foo
> |---|
> |---|---bar
> |---|---|
> |---|---|---__init__.py
>
> then I can say import foo.bar
>
> But suppose I want to import foo.bar.stuff and stuff
On Oct 19, 11:03 pm, Steven D'Aprano wrote:
> On Wed, 19 Oct 2011 01:06:53 -0700, aspineux wrote:
> > hi
>
> import pytz
> from datetime import datetime
> pytz.timezone('GMT0').fromutc(datetime.utcnow())
> > datetime.datetime(2011, 10, 19, 7, 54, 45, 579125, tzinfo= > 'GMT0'>)
> >>>
I am biased, but you could use a plugin loader like straight.plugin at
https://github.com/ironfroggy/straight.plugin
On Fri, Oct 21, 2011 at 10:05 AM, Shane wrote:
> Need to refine a question I asked earlier. If I have a module,
>
> |-- foo
> |---|
> |---|---bar
> |---|---|
> |--
On Fri, 21 Oct 2011 07:05:32 -0700, Shane wrote:
> Need to refine a question I asked earlier. If I have a module,
>
> |-- foo
> |---|
> |---|---bar
> |---|---|
> |---|---|---__init__.py
>
> then I can say import foo.bar
No you can't, not the way you have listed it. As s
I assume you're arranging the components with a sizer. Remove them from the
sizer, reinsert them in the order you want, and then call sizer.Layout().
Cheers,
Ian
--
http://mail.python.org/mailman/listinfo/python-list
Here is a class that creates a re-iterable from any callable, such as a
generator function, that returns an iterator when called, + captured
arguments to be given to the function.
class reiterable():
def __init__(self, itercall, *args, **kwds):
self.f = itercall # callable that returns a
>what i want to do is,when i press a button, i change the order of
>selected components,how to do this?
This is so vague, I am tempted to think it is spambut on the chance it is
not, I need a lot more information than you are providing to even attempt to
give you any guidance.
1. By "button
I'm back with yet another attempt at adding accessibility features using Python
and NaturallySpeaking. I've simplified the concepts again and I really need some
help from someone who knows Microsoft Windows and Python. My goal is developing
a template for what I'm trying to do, then I can take o
On Oct 21, 2:55 am, Yingjie Lan wrote:
>
> In simulation, one can use range objects to denote a discrete domain,
> and domain comparison could be very useful. Not just equality, but also
> things like if one domain is contained in another.
Can't sets [help(set)] be used for this?
--
http://mail
On 22/10/2011 10:30 AM, Eric S. Johansson wrote:
I'm back with yet another attempt at adding accessibility features using
Python and NaturallySpeaking. I've simplified the concepts again and I
really need some help from someone who knows Microsoft Windows and
Python. My goal is developing a templ
I'm slightly surprised to search and not see any recent mention of
Python running on the BlackBerry PlayBook.
Since the PlayBook simulators (for developers) were first available
late last year, they've contained Python 2.7. Some time before
release, the permissions were changed so the binaries wer
Hi,
I wasn't really sure where to post this since the python-dev list seems
way too official. I'm wondering/questioning the behavior of
shutil.move. It currently does a check for if the dst is inside the src
directory with a _destinsrc function. This function uses
os.path.abspath to conver
On 10/21/2011 10:03 PM, Mark Hammond wrote:
On 22/10/2011 10:30 AM, Eric S. Johansson wrote:
I'm back with yet another attempt at adding accessibility features using
Python and NaturallySpeaking. I've simplified the concepts again and I
really need some help from someone who knows Microsoft Wind
On Fri, 21 Oct 2011 16:42:16 -0700, SigmundV wrote:
> On Oct 21, 2:55 am, Yingjie Lan wrote:
>>
>> In simulation, one can use range objects to denote a discrete domain,
>> and domain comparison could be very useful. Not just equality, but also
>> things like if one domain is contained in another.
On Fri, 21 Oct 2011 16:25:47 -0400, Terry Reedy wrote:
> Here is a class that creates a re-iterable from any callable, such as a
> generator function, that returns an iterator when called, + captured
> arguments to be given to the function.
>
> class reiterable():
>def __init__(self, itercall
40 matches
Mail list logo