On Mon, 18 Apr 2005 21:11:52 -0700, Brian Sabbey
<[EMAIL PROTECTED]> wrote:
>Ron_Adam wrote:
>> The load and dump would be private to the data class object. Here's a
>> more complete example.
>>
>> import pickle
>> class PickledData(
On Mon, 18 Apr 2005 14:06:08 -0700, "Robert Brewer"
<[EMAIL PROTECTED]> wrote:
>Reinhold Birkenfeld wrote:
>> >y = (f(11, 22, x=1, y='y for f') *
>> > g(*args_from_somewhere,
>> > x='x for g', y='y for g',
>> > foo=lambda: return 'foo for g'))
>> >
>> >would be my current way to ex
On Mon, 18 Apr 2005 12:50:24 +0200, Reinhold Birkenfeld
<[EMAIL PROTECTED]> wrote:
>y = (f(11, 22, x=1, y='y for f') *
> g(*args_from_somewhere,
> x='x for g', y='y for g',
> foo=lambda: return 'foo for g'))
>
>would be my current way to express this. But still, the less lines,
>th
On Sun, 17 Apr 2005 19:56:10 -0700, Brian Sabbey
<[EMAIL PROTECTED]> wrote:
>I also wouldn't do it that way. I don't see a class as being much better,
>though. If I understand you correctly, with classes you would have
>something like:
>
>p = Pickled('pickled.txt')
>p.load()
>p.data.append('mo
On Sun, 17 Apr 2005 15:02:12 -0700, Brian Sabbey
<[EMAIL PROTECTED]> wrote:
Brian Sabbey wrote:
> I'm kicking myself for the first example I gave in my original post in
> this thread because, looking at it again, I see now that it really gives
> the wrong impression about what I want thunks to
On 17 Apr 2005 01:46:14 -0700, "Kay Schluehr" <[EMAIL PROTECTED]>
wrote:
>Ron_Adam wrote:
>
>> I sort of wonder if this is one of those things that looks like it
>> could be useful at first, but it turns out that using functions and
>> class's in t
On Sat, 16 Apr 2005 17:25:00 -0700, Brian Sabbey
<[EMAIL PROTECTED]> wrote:
>> You can already do this, this way.
>>
> def f(thunk):
>> ... before()
>> ... thunk()
>> ... after()
>> ...
> def before():
>> ... print 'before'
>> ...
> def after():
>> ... print 'after'
On Fri, 15 Apr 2005 16:44:58 -0700, Brian Sabbey
<[EMAIL PROTECTED]> wrote:
>
>Simple Thunks
>-
>
>Thunks are, as far as this PEP is concerned, anonymous functions that
>blend into their environment. They can be used in ways similar to code
>blocks in Ruby or Smalltalk. One specific
On Tue, 12 Apr 2005 12:14:38 -0400, Chris Cioffi
<[EMAIL PROTECTED]> wrote:
>My first thought is what if the function you are using uses other
>functions(maybe not exported by the module/package)? For example: if
>some_func() makes a call to _some_weird_module_specific_func(), how
>are you going
In looking at ways to reduce the size of exe's created with py2exe,
I've noticed that it will include a whole library or module even if I
only need one function or value from it.
What I would like to do is to import individual functions and then
export 'write' them to a common resource file and
On Mon, 11 Apr 2005 05:14:47 GMT, "Brandon J. Van Every"
<[EMAIL PROTECTED]> wrote:
>As is easily noticed, my website sucks. Enough people keep ragging
>on me about it, that maybe I'll up and do something about it. However,
>I currently have FrontPage 2000 and I hate it. Ideally, I would like a
On Sun, 10 Apr 2005 17:55:06 +0200, Ksenia Marasanova
<[EMAIL PROTECTED]> wrote:
>Hi,
>
>I am looking for fast, simple templating system that will allow me to
>do the following:
>- embed Python code (or some templating code) in the template
>- generate text output (not only XML/HTML)
>
>I don't ne
On Sun, 10 Apr 2005 13:18:01 +0200, "Fredrik Lundh"
<[EMAIL PROTECTED]> wrote:
>Kay Schluehr wrote:
>
>> I fear that Python 3.0 becomes some kind of vaporware in the Python
>> community that paralyzes all redesign efforts on the std-lib.
Even if Python 3.0 never materializes, The documented PEP m
On Sat, 09 Apr 2005 02:22:45 -0400, Steve Holden <[EMAIL PROTECTED]>
wrote:
>Ron_Adam wrote:
>> On Fri, 08 Apr 2005 05:15:23 -0400, vegetax <[EMAIL PROTECTED]>
>> wrote:
>>
>>
>>>Are those issues being considered right now? i cant find any PEP
On Fri, 08 Apr 2005 05:15:23 -0400, vegetax <[EMAIL PROTECTED]>
wrote:
>Are those issues being considered right now? i cant find any PEP addressing
>the issue especifically, at least cooking it for python 3000.
>
>specific topics could be:
>
>grouping related modules.
>removing useless legacy modu
On Thu, 7 Apr 2005 17:49:39 -0400, "Terry Reedy" <[EMAIL PROTECTED]>
wrote:
>"Ron_Adam" <[EMAIL PROTECTED]> wrote in message
>news:[EMAIL PROTECTED]
>> Python has one obvious best way to do things.
>
>
>More exactly, 'should preferably h
On 7 Apr 2005 11:11:31 -0400, [EMAIL PROTECTED] (Aahz) wrote:
>You're conflating two different things:
>
>* Whether Python currently has only one way to do things
>
>* Whether Python has a design goal of only one way to do things
>
>I'll agree that Python currently has many examples of more than o
>I find I am still left asking the question "why would anyone want to do
>that?".
You didn't say which part you were referring too. As far as wrapping
the same exact wrapper more than once. You probably wouldn't do that.
It's just easier to test the use of multiple wrappers that way.
As far as
On Wed, 06 Apr 2005 08:10:22 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote:
>I don't understand your seeming fixation with wrappers and wrapping.
Fixated implies, I'm stuck on a single thing, but I'm not. I am
learning as I go, and exploring some possibilities as well. :-)
> That's not
>the only
On Wed, 06 Apr 2005 16:33:24 +1200, Greg Ewing
<[EMAIL PROTECTED]> wrote:
>Ron_Adam wrote:
>> I would have preferred the @ symbol to be used as an inline assert
>> introducer. Which would have allowed us to put debug code anywhere we
>> need. Such as @print total @.
On Tue, 05 Apr 2005 19:38:38 -0400, Steve Holden <[EMAIL PROTECTED]>
wrote:
>>
>So what you are saying is that you would like to be able to use
>arbitrarily complex expressions after the :at" sign, as long as they
>return a decorator? If so, you've been "pronounced" :-)
>
>regards
> Steve
No
On Wed, 06 Apr 2005 00:23:01 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote:
>I don't know of anything other than the compiler and cpython sources.
>The byte codes are not all the same from version to version, since
>added language features may require new byte code operations, at least
>for efficie
On Tue, 05 Apr 2005 14:32:59 -0700, Scott David Daniels
<[EMAIL PROTECTED]> wrote:
>Ron_Adam wrote:
>> What I was referring to is the case:
>> @decorator(x,y,z)
>> As being a decorator expression with more than one argument.
>But, we generally say this
On 5 Apr 2005 00:35:45 -0700, "Kay Schluehr" <[EMAIL PROTECTED]>
wrote:
>Ron_Adam wrote:
>> Ok... it's works! :)
>>
>> So what do you think?
>
>Not much. As long as You do not present any nontrivial examples like
>Guidos MultiMethod decor
On Tue, 05 Apr 2005 02:55:35 -0400, Steve Holden <[EMAIL PROTECTED]>
wrote:
>Ron_Adam wrote:
>> Ok, that post may have a few(dozen?) problems in it. I got glitched
>> by idles not clearing variables between runs, so it worked for me
>> because it was getting
On Tue, 05 Apr 2005 06:52:58 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote:
>>Ok, yes, besides the globals, but I figured that part is obvious so I
>>didn't feel I needed to mention it. The function call works the same
>>even though they are not nested functions.
>
>I am afraid that is wrong. But
Hi again, If anyone is reading this.
Fixed the endless loop when stacking the same decorator instance. You
can now reuse the same exact decorator object either in stacks or on
different functions with different arguments.
The only quirk left is if you stack the same decorator object, and
have
On Mon, 4 Apr 2005 23:34:41 -0400, David Handy
<[EMAIL PROTECTED]> wrote:
I'm not sure if this is the best way. But it might work.
for method, params in deferred:
method(*params)
try:
if method.im_func is c.f.im_func:
# handle a special case
except:
if
thoughts? Any improvements? Any bugs?
Cheers,
Ron_Adam
#---start---
class Decorator(object):
"""
Decorator - A base class to make decorators with.
self.function - the function decorated.
self.arglist - list of arguments of decorator
self.preprocess - ov
Ok, that post may have a few(dozen?) problems in it. I got glitched
by idles not clearing variables between runs, so it worked for me
because it was getting values from a previous run.
This should work better, fixed a few things, too.
The decorators can now take more than one argument.
The fun
Hi, Thanks again for all the helping me understand the details of
decorators.
I put together a class to create decorators that could make them a lot
easier to use.
It still has a few glitches in it that needs to be addressed.
(1) The test for the 'function' object needs to not test for a s
On 3 Apr 2005 16:21:10 -0700, "Brendan" <[EMAIL PROTECTED]> wrote:
>Thanks for the tips. Making FW a callable class (choice 5) seems to be
>a good (if verbose) solution. I might just wrap my temporary values in
>a list [lastX, lastA, lastB] and mutate them as Michael suggests.
>Thanks to Michael
On Sun, 03 Apr 2005 23:59:51 +0200, "Martin v. Löwis"
<[EMAIL PROTECTED]> wrote:
>Ron_Adam wrote:
>> This would be the same without the nesting:
>>
>> def foo(xx):
>> global x
>> x = xx
>> return fee
>>
>>
On 3 Apr 2005 14:12:48 -0700, "Brendan" <[EMAIL PROTECTED]> wrote:
>Hi everyone
>
>I'm new to Python, so forgive me if the solution to my question should
>have been obvious. I have a function, call it F(x), which asks for two
>other functions as arguments, say A(x) and B(x). A and B are most
>ef
On 3 Apr 2005 11:17:35 -0700, "George Sakkis" <[EMAIL PROTECTED]>
wrote:
>>def define(func):
>>if not ENABLE_TYPECHECKING:
>>return lambda func: func
>># else decorate func
>
>A small correction: The argument of the decorator is not 'func' but the
>parameter checks you want to enfo
On Sun, 03 Apr 2005 08:32:09 +0200, "Martin v. Löwis"
<[EMAIL PROTECTED]> wrote:
>Ron_Adam wrote:
>> I wasn't aware that the form:
>>
>> result = function(args)(args)
>>
>> Was a legal python statement.
>>
>> So python
On 3 Apr 2005 00:11:22 -0800, "El Pitonero" <[EMAIL PROTECTED]>
wrote:
>Martin v. Löwis wrote:
>Perhaps this will make you think a bit more:
Now my problem is convincing the group I do know it. LOL
>Another example:
>
>def f():
> return f
>
>g = f()()()()()()()()()()()
>
>is perfectly valid.
On Sun, 03 Apr 2005 07:53:07 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote:
>>No, I did not know that you could pass multiple sets of arguments to
>That phraseology doesn't sound to me like your concept space is quite
>isomorphic
>with reality yet, sorry ;-)
You'll be happy to know, my concept
On Sun, 03 Apr 2005 08:37:02 +0200, "Martin v. Löwis"
<[EMAIL PROTECTED]> wrote:
>Ron_Adam wrote:
>>>Ah, so you did not know functions are objects just like numbers,
>>>strings or dictionaries. I think you may have been influenced by other
>>&g
On 3 Apr 2005 00:20:32 -0800, "George Sakkis" <[EMAIL PROTECTED]>
wrote:
>Yes, it is possible to turn off type checking at runtime; just add this
>in the beginning of your define:
>
>def define(func):
>if not ENABLE_TYPECHECKING:
>return lambda func: func
># else decorate func
>
>w
On 2 Apr 2005 20:02:47 -0800, "El Pitonero" <[EMAIL PROTECTED]>
wrote:
>Ron_Adam wrote:
>>
>> So I didn't know I could do this:
>>
>> def foo(a1):
>> def fee(a2):
>> return a1+a2
>> return fee
>>
>>
On 2 Apr 2005 10:23:53 -0800, "George Sakkis" <[EMAIL PROTECTED]>
wrote:
>It turns out it's not a "how to inflate tires with a hammer" request;
>I've actually written an optional type checking module using
>decorators. The implementation details are not easy to grok, but the
>usage is straightforw
On Sat, 02 Apr 2005 21:28:36 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote:
>I think it might help you to start out with very plain decorators rather than
>decorators as factory functions that return decorator functions that wrap the
>decorated function in a wrapper function. E.g., (this could obvi
On Sat, 02 Apr 2005 18:39:41 GMT, Ron_Adam <[EMAIL PROTECTED]>
wrote:
>>def foo():
>>a = 10
>>def bar():
>> return a*a
>>return bar
>>
>>print foo()() <--- *Here*
>>
>>
>>No decorator-specific mag
On Sat, 02 Apr 2005 21:04:57 +0200, "Diez B. Roggisch"
<[EMAIL PROTECTED]> wrote:
>> I followed that part. The part that I'm having problems with is the
>> first nested function get's the argument for the function name without
>> a previous reference to the argument name in the outer frames. So,
On 2 Apr 2005 08:39:35 -0800, "Kay Schluehr" <[EMAIL PROTECTED]>
wrote:
>
>There is actually nothing mysterious about decorators.
I've heard this quite a few times now, but *is* quite mysterious if
you are not already familiar with how they work. Or instead of
mysterious, you could say complex,
On Sat, 02 Apr 2005 19:59:30 +0200, "Diez B. Roggisch"
<[EMAIL PROTECTED]> wrote:
>> statements documenting the flow in a few minutes. I'm still a bit
>> fuzzy on how the arguments are stored and passed.
>
>The arguments are part of the outer scope of the function returned, and thus
>they ar kept
eturn get_function
Thanks, you are correct. I'll post a revised dissection with print
statements documenting the flow in a few minutes. I'm still a bit
fuzzy on how the arguments are stored and passed.
Regards,
Ron_Adam
--
http://mail.python.org/mailman/listinfo/python-list
I was having some difficulty figuring out just what was going on with
decorators. So after a considerable amount of experimenting I was
able to take one apart in a way. It required me to take a closer look
at function def's and call's, which is something I tend to take for
granted.
I'm not sure
On Sat, 02 Apr 2005 00:40:15 -0500, Steve Holden <[EMAIL PROTECTED]>
wrote:
>
>The danger in GOTO is that it allows the undisciplined programmer to
>develop a badly-structured solution to a programming problem. A
>disciplined programmer will write well-structured code with whatever
>tools come
On Fri, 01 Apr 2005 16:46:14 -0500, Jeremy Bowers <[EMAIL PROTECTED]>
wrote:
>On Fri, 01 Apr 2005 19:56:55 +, Ron_Adam wrote:
>
>> On Fri, 01 Apr 2005 13:47:06 -0500, Jeremy Bowers <[EMAIL PROTECTED]>
>> wrote:
>>>Is this an April Fools gag? If so, it
On Fri, 1 Apr 2005 12:15:35 -0800, James Stroud <[EMAIL PROTECTED]>
wrote:
>Is anybody else bothered by those stupid pascal-like ":=" assignment
>operators?
>
>Maybe, for the sake of adding more variety to the world, wiki should come up
>with a new assignment operator, like "==". I like that one
On Fri, 01 Apr 2005 13:47:06 -0500, Jeremy Bowers <[EMAIL PROTECTED]>
wrote:
>On Fri, 01 Apr 2005 18:30:56 +, Ron_Adam wrote:
>> I'm trying to figure out how to test function arguments by adding a
>> decorator.
>
>The rest of your message then goes on to viv
I'm trying to figure out how to test function arguments by adding a
decorator.
@decorate
def func( x):
# do something
return x
This allows me to wrap and replace the arguments with my own, but not
get the arguments that the original function received.
To do that I would need
On Fri, 1 Apr 2005 08:24:42 +0100 (BST), praba kar
<[EMAIL PROTECTED]> wrote:
>Dear All,
>I am new to Python. I want to know how to
>work with ternary operator in Python. I cannot
>find any ternary operator in Python. So Kindly
>clear my doubt regarding this
>
>
>
>__
On 01 Apr 2005 15:55:58 +0300, Ville Vainio <[EMAIL PROTECTED]>
wrote:
>> "Daniel" == Daniel Dittmar <[EMAIL PROTECTED]> writes:
>
>Daniel> Ville Vainio wrote:
>
>>> I need a dict (well, it would be optimal anyway) class that
>>> stores the keys as strings without coercing the case
On 31 Mar 2005 22:40:53 -0800, "Rakesh" <[EMAIL PROTECTED]>
wrote:
>Hi,
> For a particular problem of mine, I want to sort pairs
>by its value.
>
>Eg:
>
>Input:
>
>A, 4
>B, 5
>C, 1
>D, 2
>E, 3
>
>I would like the output to be:
>
>C
>D
>E
>A
>B
>
>i.e. I would like to get the keys in the sorted o
On 31 Mar 2005 20:03:00 -0800, "Ben" <[EMAIL PROTECTED]> wrote:
>Could someone tell me what is wrong and give me a better alternative to
>what I came up with.
Seperate you raw input statements from your test. Your elsif is
skipping over it.
Try using only one raw imput statement right after y
On Thu, 31 Mar 2005 19:13:39 GMT, Ron_Adam <[EMAIL PROTECTED]>
wrote:
>On Thu, 31 Mar 2005 18:37:53 GMT, Ron_Adam <[EMAIL PROTECTED]>
>wrote:
>
>>
>>Hi, Sometimes it just helps to see what's going on, so I've been
>>trying to write a tool to exa
Fixed it so it now runs from the command line and from winpython as
well as idle in Python 2.4 on Windows Xp. I still don't know about
linux systems.
I decided on viewnames.py as the filename and viewit() as the calling
name.
#---start---
# viewnames.py
"""
A utility to print the value of
On Thu, 31 Mar 2005 18:37:53 GMT, Ron_Adam <[EMAIL PROTECTED]>
wrote:
>
>Hi, Sometimes it just helps to see what's going on, so I've been
>trying to write a tool to examine what names are pointing to what
>objects in the current scope.
>
>This still has
Hi, Sometimes it just helps to see what's going on, so I've been
trying to write a tool to examine what names are pointing to what
objects in the current scope.
This still has some glitches, like not working in winpython or the
command line, I get a 'stack not deep enough' error. I haven't tes
On 30 Mar 2005 08:43:17 GMT, Duncan Booth
<[EMAIL PROTECTED]> wrote:
>Here is a rough attempt at printing the names of a variable. It will pick
>up several names where appropriate, but deliberately doesn't attempt to
>get all possible names (as you say, that could result in endless loops).
>In par
On Thu, 31 Mar 2005 16:28:15 +1200, Greg Ewing
<[EMAIL PROTECTED]> wrote:
>Oren Tirosh wrote:
>> def noglobals(f):
>> . import new
>> . return new.function(
>> . f.func_code,
>> . {'__builtins__':__builtins__},
>> . f.func_name,
>> . f.func_defaults,
>> . f.fun
On Tue, 29 Mar 2005 14:58:45 -0500, Bill Mill <[EMAIL PROTECTED]>
wrote:
>>
>> Or something else depending on how many references you made to the
>> value 8.
>
>Yes, this is true, assuming that he looks for keys with the value 8 in
>locals(). It's not necessarily true if there's a way to ask py
On Tue, 29 Mar 2005 11:23:45 -0500, Bill Mill <[EMAIL PROTECTED]>
wrote:
>On Tue, 29 Mar 2005 14:34:39 GMT, Ron_Adam <[EMAIL PROTECTED]> wrote:
>> On 28 Mar 2005 23:01:34 -0800, "Dan Bishop" <[EMAIL PROTECTED]> wrote:
>>
>> >>>> de
On Tue, 29 Mar 2005 09:09:37 -0500, Charles Hartman
<[EMAIL PROTECTED]> wrote:
>I know the answer to this is going to be "It depends . . .", but I want
>to get my mind right. In Fowler's *Refactoring* I read: "Older
>languages carried an overhead in subroutine calls, which deterred
>people from
On 28 Mar 2005 23:01:34 -0800, "Dan Bishop" <[EMAIL PROTECTED]> wrote:
def print_vars(vars_dict=None):
>...if vars_dict is None:
>... vars_dict = globals()
>...for var, value in vars_dict.items():
>... print '%s = %r' % (var, value)
>...
myPlace = 'right here'
my
On Mon, 28 Mar 2005 20:46:32 +0300, Christos "TZOTZIOY" Georgiou
<[EMAIL PROTECTED]> wrote:
>On Mon, 28 Mar 2005 17:19:42 GMT, rumours say that Ron_Adam
><[EMAIL PROTECTED]> might have written:
>
>>Is there a way to tell the imported function printx to use m
No globals, and no builtins.
Still have a few minor issues to work out. Like getting it to work
correctly after it's imported. :/
Ron_Adam
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 28 Mar 2005 13:39:17 +0200, remi <[EMAIL PROTECTED]> wrote:
>Hello,
>
>I have got a list like : mylist = ['item 1', 'item 2','item n'] and
>I would like to store the string 'item1' in a variable called s_1,
>'item2' in s_2,...,'item i' in 's_i',... The lenght of mylist is finite ;-)
On Sun, 27 Mar 2005 14:39:06 -0800, James Stroud
<[EMAIL PROTECTED]> wrote:
>Hello,
>
>I have strings represented as a combination of an alphabet (AGCT) and a an
>operator "/", that signifies degeneracy. I want to split these strings into
>lists of lists, where the degeneracies are members of th
27;t create new items within the new list. but with
literal data consisting of letters and numbers, it will work.
If you are working with a data tree, you may be able to modify this to
do what you want. Just add a test in the inner loop for the data you
want to modify.
>Any ideas, suggestion
On 26 Mar 2005 22:51:14 -0800, [EMAIL PROTECTED] (Oren
Tirosh) wrote:
>Ron_Adam <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
>> Is there a way to hide global names from a function or class?
>>
>> I want to be sure that a function doesn't
ere ***
>>
>UIAM it should do this if you import b as above.
>
>Regards,
>Bengt Richter
Good suggestion. Thanks. I was somewhat aware of the modular scope,
but was looking for way to apply it on a more local level. Michael's
suggestion looks interesting for that.
Ron_Adam
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 26 Mar 2005 12:18:39 -0800, Michael Spencer
<[EMAIL PROTECTED]> wrote:
>Ron_Adam wrote:
>> Is there a way to hide global names from a function or class?
>>
>> I want to be sure that a function doesn't use any global variables by
>> mistake. So hidin
e):
True
>>>b(False):
*** name error here ***
Ron_Adam
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 25 Mar 2005 11:31:33 -0800, James Stroud
<[EMAIL PROTECTED]> wrote:
>On Friday 25 March 2005 08:39 am, Ivan Van Laningham wrote:
>> As far as grouping by indentation goes, it's why I fell in love with
>> Python in the first place. Braces and so on are just extraneous cruft
>> as far as I'
On Fri, 25 Mar 2005 18:06:11 -0500, "George Sakkis"
<[EMAIL PROTECTED]> wrote:
>
>I'm getting off-topic here, but it strikes me that strings have so many
>methods (some of which are
>of arguable utility, e.g. swapcase), while proposing two useful methods
>(http://tinyurl.com/5nv66)
>for dicts --
On Fri, 25 Mar 2005 17:09:38 -0500, "George Sakkis"
<[EMAIL PROTECTED]> wrote:
>I posted a recipe in python cookbook
>(http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/392768) for the
>subproblem I was interested
>in initially (variable-length iterable unpacking), and I prefer it over
>ex
On Fri, 25 Mar 2005 18:58:27 +0100, Reinhold Birkenfeld
<[EMAIL PROTECTED]> wrote:
>Ron_Adam wrote:
>
>> What if you could:
>>
>> x = lambda{ x, y: x+y}
>> Hmm comma creates a problem here. so...
>
>>>> from __future__ import braces
&
r loop never reaches 1, so we can get rid of it along with the
second if statement, the additions aren't needed either.
So what you have left is this.
for foo in range(3):
pass
print "Let's see"
print foo
Which is the same as:
print "let's see\n
On 25 Mar 2005 10:09:50 GMT, Duncan Booth
<[EMAIL PROTECTED]> wrote:
>I've never found any need for an is_defined function. If in doubt I just
>make sure and initialise all variables to a suitable value before use.
>However, I'll assume you have a good use case.
I admit that that is the better
Or just call it what it is.. function{(args):expression}
Then it would be easy to explain, teach, and remember.
Ron_Adam
--
http://mail.python.org/mailman/listinfo/python-list
t;
>
>If we customize the other control flow primitives For and If it should
>be possible to create a little language only by using this primitives.
>
>It is obvious by definition of our While that we can replace arguments
>on the fly:
>
>conds = [(i)->i<3, (i)->i+2<7, (i)->i>=0]
>
>[ While((i)->(0), cond, (i)->(i+1), (res)->(res+i**2)) for cond in
>conds]
>
>=> [5,29,0]
>
>
>Wouldn't it be fun to use in Python?
>
>Only drawback: does not look like executable pseudo-code anymore :(
>
>
>Regards Kay
I think I get the gist of what you are trying to do, but I can't
follow it entirely.
Well it looks like an interesting puzzle, but you'll need to go a
little slower for some of us. I tired though. :)
Ron_Adam
--
http://mail.python.org/mailman/listinfo/python-list
85 matches
Mail list logo