> In Python the standard patten for "declaring" variables is just to assign to
> them as they are needed. If you want the effect of a declaration as you
> would do in C, you can just define the variable and initialize it to 0 or
> None. (Or {} for a new dictionary, or [] for a new list.)
Yep
"Filip Gruszczynski" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>> If you want to just declare that name exist, but doesn't want to
>> declare the type, why don't you just do this:
>>
>> def somefunc():
>> nonlocal = nonlocal
>> local = 0 # or None or [] or an initial
"Filip Gruszczynski" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
|> If you want to just declare that name exist, but doesn't want to
| > declare the type, why don't you just do this:
Names do not 'exist' in Python, nor do they have types. They are bound to
objects that have t
> If you want to just declare that name exist, but doesn't want to
> declare the type, why don't you just do this:
>
> def somefunc():
> nonlocal = nonlocal
> local = 0 # or None or [] or an initial value
> #
> return nonlocal * local
Err.. I don't quite get. How it may help me?
On Apr 23, 4:52 pm, "Filip Gruszczyński" <[EMAIL PROTECTED]> wrote:
> > You mean the type? Not in 2.x, but in 3.x, there are function
> > annotations:
>
> > def a_function(arg1: int, arg2: str) -> None: pass
>
> Nope, I don't like types ;-) 3.x seems pretty revolutionary, and this
> typing can b
Wow! This is extremely easy and seems to do exactly what I need. Those
decorators are pretty powerful then. Thanks for your help, I'll try to
use this.
> def uses(names):
> def decorator(f):
> used = set(f.func_code.co_varnames)
> declared = set(names.split())
> undecl
Steve Holden <[EMAIL PROTECTED]> wrote:
> Filip Gruszczy"ski wrote:
>> Just declaring, that they exist. Saying, that in certain function
>> there would appear only specified variables. Like in smalltalk, if I
>> remember correctly.
>>
> Icon has (had?) the same feature: if the "local" statement
Filip Gruszczyński wrote:
You mean the type? Not in 2.x, but in 3.x, there are function
annotations:
def a_function(arg1: int, arg2: str) -> None: pass
Nope, I don't like types ;-) 3.x seems pretty revolutionary, and this
typing can be appreciated by some people.
Declaring what about them
> You mean the type? Not in 2.x, but in 3.x, there are function
> annotations:
>
> def a_function(arg1: int, arg2: str) -> None: pass
Nope, I don't like types ;-) 3.x seems pretty revolutionary, and this
typing can be appreciated by some people.
> Declaring what about them? If you mean declari
En Tue, 22 Apr 2008 21:39:41 -0300, Filip Gruszczyński
<[EMAIL PROTECTED]> escribió:
Hello everyone!
It is my first message on this list, therefore I would like to say
hello to everyone. I am fourth year student of CS on the Univeristy of
Warsaw and recently I have become very interested in d
"Filip Gruszczyński" <[EMAIL PROTECTED]> writes:
> I have become very interested in dynamically typed languages,
> especially Python.
Good to know. Welcome to the group.
> I would like to ask, whether there is any way of explicitly
> declaring variables used in a function?
Declaring what about
On Apr 22, 7:39 pm, "Filip Gruszczyński" <[EMAIL PROTECTED]> wrote:
> Hello everyone!
>
> It is my first message on this list, therefore I would like to say
> hello to everyone. I am fourth year student of CS on the Univeristy of
> Warsaw and recently I have become very interested in dynamically ty
On Apr 22, 7:39 pm, "Filip Gruszczyński" <[EMAIL PROTECTED]> wrote:
> Hello everyone!
>
> It is my first message on this list, therefore I would like to say
> hello to everyone. I am fourth year student of CS on the Univeristy of
> Warsaw and recently I have become very interested in dynamically ty
Hello everyone!
It is my first message on this list, therefore I would like to say
hello to everyone. I am fourth year student of CS on the Univeristy of
Warsaw and recently I have become very interested in dynamically typed
languages, especially Python.
I would like to ask, whether there is any
Ron Adam <[EMAIL PROTECTED]> wrote:
>[EMAIL PROTECTED] wrote:
>> I want the equivalent of this:
>>
>> if a == "yes":
>>answer = "go ahead"
>> else:
>>answer = "stop"
>>
>> in [a] more compact form:
>I sometimes find it useful to do:
>
> answers = {True: "go ahead", False: "stop"}
>
Georg Brandl wrote:
> Jeffrey Schwab wrote:
>> [EMAIL PROTECTED] wrote:
>>
>>> I want the equivalent of this:
>>>
>>> if a == "yes":
>>>answer = "go ahead"
>>> else:
>>>answer = "stop"
>>>
>> def mux(s, t, f):
>> if s:
>> return t
>> return f
>
> But be aware that this i
[EMAIL PROTECTED] wrote:
>I've done this in Scheme, but I'm not sure I can in Python.
>
>I want the equivalent of this:
>
>if a == "yes":
> answer = "go ahead"
>else:
> answer = "stop"
>
>in this more compact form:
>
>
>a = (if a == "yes": "go ahead": "stop")
>
>
>is there such a form in Pytho
Jeffrey Schwab wrote:
> [EMAIL PROTECTED] wrote:
>
>> I want the equivalent of this:
>>
>> if a == "yes":
>>answer = "go ahead"
>> else:
>>answer = "stop"
>>
>> in this more compact form:
>>
>> a = (if a == "yes": "go ahead": "stop")
>>
>> is there such a form in Python? I tried playin
[EMAIL PROTECTED] wrote:
> I've done this in Scheme, but I'm not sure I can in Python.
>
> I want the equivalent of this:
>
> if a == "yes":
>answer = "go ahead"
> else:
>answer = "stop"
>
> in this more compact form:
>
>
> a = (if a == "yes": "go ahead": "stop")
>
>
> is there such
[EMAIL PROTECTED] wrote:
> I want the equivalent of this:
>
> if a == "yes":
>answer = "go ahead"
> else:
>answer = "stop"
>
> in this more compact form:
>
> a = (if a == "yes": "go ahead": "stop")
>
> is there such a form in Python? I tried playing around with lambda
> expressions, bu
On 2006-03-19, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I want the equivalent of this:
>
> if a == "yes":
>answer = "go ahead"
> else:
>answer = "stop"
If that's what you want, then write that. ;)
--
[EMAIL PROTECTED]
Grant Edwards
--
http://mail.python.org/mailman/listinfo/pytho
[EMAIL PROTECTED] writes:
> a = (if a == "yes": "go ahead": "stop")
>
> is there such a form in Python? I tried playing around with lambda
> expressions, but I couldn't quite get it to work right.
This has been the subject of huge debate over the years. The answer
is Python doesn't currently hav
Kent - Thanks for the quick reply. I tried the and/or trick - it does
work. But you're right - more trouble than its worth So for now, I
did it "the long way". It looks like (see below), this functionality
will be added in soon.
Thanks for the quick help.
-sam
--
http://mail.python.org/mail
[EMAIL PROTECTED] wrote:
> I've done this in Scheme, but I'm not sure I can in Python.
>
> I want the equivalent of this:
>
> if a == "yes":
>answer = "go ahead"
> else:
>answer = "stop"
>
> in this more compact form:
>
>
> a = (if a == "yes": "go ahead": "stop")
>
>
> is there such a form
[EMAIL PROTECTED] wrote:
> I want the equivalent of this:
>
> if a == "yes":
>answer = "go ahead"
> else:
>answer = "stop"
>
> in this more compact form:
>
>
> a = (if a == "yes": "go ahead": "stop")
If the value for the 'true' case can never have a boolean value of
False, you can use
I've done this in Scheme, but I'm not sure I can in Python.
I want the equivalent of this:
if a == "yes":
answer = "go ahead"
else:
answer = "stop"
in this more compact form:
a = (if a == "yes": "go ahead": "stop")
is there such a form in Python? I tried playing around with lambda
expr
In article <[EMAIL PROTECTED]>,
Christopher Subich <[EMAIL PROTECTED]> wrote:
.
.
.
>Out of curiosity, where would you classify interpreters for secondary
>app-specific programming languages? Specifically, mud-client stored
On Tue, 14 Jun 2005, Scott David Daniels wrote:
> Tom Anderson wrote:
>> ... If it's not, try:
>> x = "myVarName"
>> y = "myVarValue"
>> locals()[x] = y
>
> Sorry, this works with globals(), but not with locals().
Oh, weird. It works when i tried it.
Aaaah, i only tried it at the interactive pro
Steven D'Aprano wrote:
> On Mon, 13 Jun 2005 12:18:31 -0400, Ali Razavi wrote:
>
>
>>Is there any reflective facility in python
>>that I can use to define a variable with a
>>name stored in another variable ?
>>like I have :
>>x = "myVarName"
>>
>>what can I do to declare a new variable with the
Tom Anderson wrote:
> ... If it's not, try:
> x = "myVarName"
> y = "myVarValue"
> locals()[x] = y
Sorry, this works with globals(), but not with locals().
There isn't a simple way to fiddle the locals (the number
is determined when the function is built).
I do, however, agree with you about what
On Mon, 13 Jun 2005, Ali Razavi wrote:
> Tom Anderson wrote:
>> On Mon, 13 Jun 2005, Ali Razavi wrote:
>>
>>> Is there any reflective facility in python that I can use to define a
>>> variable with a name stored in another variable ?
>>>
>>> like I have :
>>> x = "myVarName"
>>>
>>> what can I
Cameron Laird wrote:
> cleaner algorithm somewhere in the neighborhood. In general,
> "application-level" programming doesn't need exec() and such.
>
> PyPy and debugger writers and you other "systems" programmers
> already know who you are.
Out of curiosity, where would you classify interprete
In article <[EMAIL PROTECTED]>,
Ali Razavi <[EMAIL PROTECTED]> wrote:
>Tom Anderson wrote:
>> On Mon, 13 Jun 2005, Ali Razavi wrote:
>>
>>> Is there any reflective facility in python that I can use to define a
>>> variable with a name stored in another variable ?
.
In article <[EMAIL PROTECTED]>,
Peter Dembinski <[EMAIL PROTECTED]> wrote:
>Benji York <[EMAIL PROTECTED]> writes:
>
>[snap]
>
>>> code = x + '= 0'
>>> exec(code)
>>
>> You should generally stay away from exec for lots of reasons.
>
>Code 'refactorizability' is one of them.
There's an affirmative
On Mon, 13 Jun 2005 12:18:31 -0400, Ali Razavi wrote:
> Is there any reflective facility in python
> that I can use to define a variable with a
> name stored in another variable ?
> like I have :
> x = "myVarName"
>
> what can I do to declare a new variable with the name of the string
> stored in
On Mon, 13 Jun 2005, Peter Dembinski wrote:
> Tom Anderson <[EMAIL PROTECTED]> writes:
>
> [snap]
>
>> The MAtrix had evarything in it: guns, a juimping off teh walls, flying
>> guns, a bullet tiem, evil computar machenes, numbers that flew, flying
>> gun bullets in slowar motian, juimping into
Tom Anderson wrote:
> On Mon, 13 Jun 2005, Ali Razavi wrote:
>
>> Is there any reflective facility in python that I can use to define a
>> variable with a name stored in another variable ?
>>
>> like I have :
>> x = "myVarName"
>>
>> what can I do to declare a new variable with the name of the st
Tom Anderson <[EMAIL PROTECTED]> writes:
[snap]
> The MAtrix had evarything in it: guns, a juimping off teh walls,
> flying guns, a bullet tiem, evil computar machenes, numbers that
> flew, flying gun bullets in slowar motian, juimping into a gun, dead
> police men, computar hackeing, Kevin Mitni
On Mon, 13 Jun 2005, Ali Razavi wrote:
> Is there any reflective facility in python that I can use to define a
> variable with a name stored in another variable ?
>
> like I have :
> x = "myVarName"
>
> what can I do to declare a new variable with the name of the string
> stored in x. And how ca
Benji York <[EMAIL PROTECTED]> writes:
[snap]
>> code = x + '= 0'
>> exec(code)
>
> You should generally stay away from exec for lots of reasons.
Code 'refactorizability' is one of them.
--
http://mail.python.org/mailman/listinfo/python-list
Ali Razavi wrote:
> Ali Razavi wrote:
>
>>Is there any reflective facility in python
>>that I can use to define a variable with a
>>name stored in another variable ?
> Got it! use higher order functions like Lisp!
No, you use higher order functions like Python. :)
> code = x + '= 0'
> exec(cod
Ali Razavi wrote:
> Is there any reflective facility in python
> that I can use to define a variable with a
> name stored in another variable ?
> like I have :
> x = "myVarName"
>
> what can I do to declare a new variable with the name of the string
> stored in x. And how can I access that implici
Is there any reflective facility in python
that I can use to define a variable with a
name stored in another variable ?
like I have :
x = "myVarName"
what can I do to declare a new variable with the name of the string
stored in x. And how can I access that implicitly later ?
--
http://mail.python
Alexander Zatvornitskiy wrote:
> Hello All!
>
> I'am novice in python, and I find one very bad thing (from my point
> of view) in language. There is no keyword or syntax to declare
> variable, like 'var' in > Pascal, or special syntax in C. It can
> cause very ugly errors,like this:
>
> epsilon=0
>
Antoon Pardon wrote:
I don't think that would be a big issue. Python uses '=' also
differently from a number of languages. My preference would
currently be for ':=' because I have the impression that if
you don't leave spaces the period in '.=' tends to be obscured.
x.=42 vsx:=42
seems a cl
Op 2005-02-10, Nick Coghlan schreef <[EMAIL PROTECTED]>:
> Antoon Pardon wrote:
>> Well it seems you have some fair points. I'll just stop here stating
>> that I would like to have it, even if it proved to be slower. Speed
>> is not that big a factor in the things I write.
>
> Oh, certainly. I wasn
Antoon Pardon wrote:
Well it seems you have some fair points. I'll just stop here stating
that I would like to have it, even if it proved to be slower. Speed
is not that big a factor in the things I write.
Oh, certainly. I wasn't suggesting the speed hit was enough to kill the idea - I
was just po
Op 2005-02-09, Nick Coghlan schreef <[EMAIL PROTECTED]>:
> Antoon Pardon wrote:
>> Op 2005-02-08, Nick Coghlan schreef <[EMAIL PROTECTED]>:
>>>The CPython *_FAST opcodes relate to functions' local variables. Behind the
>>>scenes they are implemented as integer indexing operations into a pre-sized
Op 2005-02-08, Fredrik Lundh schreef <[EMAIL PROTECTED]>:
> Peter Otten wrote:
>
>>> executed. the compiler handles "global" and "from __future__", everything
>>> else is done at runtime.
>>
>> and __debug__, too, it seems:
>
> you left out the "python -O" line.
>
> __debug__
>> False
> def
:)
SH> If, as you suggest, def were a declaration, then it should either not
SH> be possible to write
SH> if __debug__:
SH> def func(x):
SH> print x, "is bollocks"
if __debug__:
~S=0
S=5 #error in non-debug mode.
print S
That&
gram) tested separately and in whole.
But tests are not a silver bullet. static checking is also very usefull. What's
why I feel variable declaration (or explicit variable definition) may help.
Alexander, [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Antoon Pardon wrote:
Op 2005-02-08, Nick Coghlan schreef <[EMAIL PROTECTED]>:
The CPython *_FAST opcodes relate to functions' local variables. Behind the
scenes they are implemented as integer indexing operations into a pre-sized C
array. Operations don't come much faster than that :)
I don't fo
Arthur artfully argued:
> What if:
>
> There was a well conducted market survey conclusive to the effect that
> adding optional strict variable declaration would, in the longer run,
> increase Python's market share dramatically.
It's always good to examine one's
Alexander Zatvornitskiy wrote:
> You may say: give better names for your variables! Ha, I'am often don't
> understand that they mean! They are written for me by an engineer!
Hang on, though - if you don't understand what you are programming, then
how can you check if it's correct? Regardless of va
that Python's design is essentially correct as it is.
>
>
>> You wrote about "substantial cost" of var declarations. Yes, you are
>> write. But think about the cost of lack of var declarations. Compare time
>> that programmer will waste on search for the r
Jeff
I fully agree. As I stated in a message to alexander, it is quick and
easy even to write a simple project-specific tool for checking that only
allowed variable names exist in all the project files.
Compared to having to work with tons of effectively useless variable
declarations foreve
Alexander
PowerOfGenerator=TakeFromSensor()
if PowerOfGenerator>xxx:
RecalcPower(PowerOfGenerator)
PutToTheDatabase(PowerOfGenerator)
Here, python will not help you. The worst thing is that in such
calculations
you often receive plausible results.
(I think PyChecker has co
Alexander Zatvornitskiy wrote:
Another example. Let say you have variable PowerOfGenerator in your program.
But, it is only active power, so you have to (1)rename PowerOfGenerator to
ActivePowerOfGenerator, (2)calculate ReactivePowerOfGenerator, and (3)calculate
new PowerOfGenerator by formula
Po
"Alexander Zatvornitskiy"
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> The worst thing is that in such calculations you often receive plausible
results.
Exactly so!
An ordinary spelling error gets promoted to a logic error that is damn
difficult to detect, let alone trace! Bef
top <[EMAIL PROTECTED]> wrote:
> Alex Martelli wrote:
> [snip]
> > I disagree: compile time is when the compiler is running (for
> example,
> > the compiler is the component which diagnoses syntax errors, while
> other
> > errors are diagnosed ``at runtime'').
> [snip]
>
> That thing about syntax
"top" <[EMAIL PROTECTED]> wrote:
> That thing about syntax errors is news to me. I thought they were
> caught at runtime, since you can catch them as exceptions, as in:
>
> try: prijnt projnt
> except SyntaxError: print "See, it gets caught"
>
> If this happens at compile-time, I'd like to know ho
Alex Martelli wrote:
[snip]
> I disagree: compile time is when the compiler is running (for
example,
> the compiler is the component which diagnoses syntax errors, while
other
> errors are diagnosed ``at runtime'').
[snip]
That thing about syntax errors is news to me. I thought they were
caught at
Brian van den Broek said unto the world upon 2005-02-07 20:36:
Steve Holden said unto the world upon 2005-02-07 17:51:
The reason global is a wart can clearly be seen in the following example:
>>> x = 3
>>> def f(tf, v):
... if tf:
... global x
... x = v
...
>>> f(0, 5)
>>> x
5
>>
Op 2005-02-08, Nick Coghlan schreef <[EMAIL PROTECTED]>:
> Antoon Pardon wrote:
>> I have the impression you are looking at this too much from the view
>> of the current implementation where putting a an entry in
>> a directory is seen as an atomic operation.
>
> Yes and no. I *am* looking at it fr
Hi, Peter!
05 feb 2005 at 15:28, Peter Otten wrote:
>> variable names. You have to move the code into a function, though: $
>> cat epsilon.py ...skipped... $ pychecker epsilon.py epsilon.py:6:
>> Local variable (epselon) not used Well, I can change it a little to
>> pass this check. Just add
Peter Otten wrote:
>> executed. the compiler handles "global" and "from __future__", everything
>> else is done at runtime.
>
> and __debug__, too, it seems:
you left out the "python -O" line.
__debug__
> False
def f():
> ... if __debug__:
> ... global x
> ... x = 4
Antoon Pardon wrote:
I have the impression you are looking at this too much from the view
of the current implementation where putting a an entry in
a directory is seen as an atomic operation.
Yes and no. I *am* looking at it from an implementation point of view, but
dictionaries have nothing to do
Just wrote:
In article <[EMAIL PROTECTED]>,
Nick Coghlan <[EMAIL PROTECTED]> wrote:
Antoon Pardon wrote:ons already existing.
The compilor might generate a RESTORE instruction.
Whether it is done as a LOAD/STORE or a RESTORE, it has to perform the same
work
- check the name exists in the local
Op 2005-02-08, Nick Coghlan schreef <[EMAIL PROTECTED]>:
> Antoon Pardon wrote:ons already existing.
>> The compilor might generate a RESTORE instruction.
>
> Whether it is done as a LOAD/STORE or a RESTORE, it has to perform the same
> work
> - check the name exists in the local namespace, and t
Brian van den Broek wrote:
> Can it then be further (truly :-) ) said that
>
> if False:
> # thousands of lines of code here
>
> would effect the structure of the function object's bytecode, but not
> its behaviour when run? Or, at most, would cause a performance effect
> due to the bytec
Fredrik Lundh wrote:
> executed. the compiler handles "global" and "from __future__", everything
> else is done at runtime.
and __debug__, too, it seems:
>>> __debug__
False
>>> def f():
... if __debug__:
... global x
... x = 42
...
>>> f()
>>> x
Traceback (most recent call l
In article <[EMAIL PROTECTED]>,
Nick Coghlan <[EMAIL PROTECTED]> wrote:
> Antoon Pardon wrote:ons already existing.
> > The compilor might generate a RESTORE instruction.
>
> Whether it is done as a LOAD/STORE or a RESTORE, it has to perform the same
> work
> - check the name exists in the loc
Antoon Pardon wrote:ons already existing.
The compilor might generate a RESTORE instruction.
Whether it is done as a LOAD/STORE or a RESTORE, it has to perform the same work
- check the name exists in the local namespace, and throw an exception if it
doesn't. If it the name does exist, perform a
Terry Reedy wrote:
>>At compile time (by which I mean when the Python bytecode is built)
>
> Compile time is when the def statement is executed
no, that's run time. "def" is an executable statement, just like "print",
"for",
assignments, "import", etc.
the entire module is compiled (to bytecod
Terry Reedy <[EMAIL PROTECTED]> wrote:
> "Brian van den Broek" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Is the right way to understand it in this vicinity:
>
> In the vicinity, but not quite exact
>
> >At compile time (by which I mean when the Python bytecode is built)
"Brian van den Broek" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Is the right way to understand it in this vicinity:
In the vicinity, but not quite exact
>At compile time (by which I mean when the Python bytecode is built)
Compile time is when the def statement is executed
Steve Holden said unto the world upon 2005-02-07 17:51:
Alexander Zatvornitskiy wrote:
Привет Alex!
05 февраля 2005 в 17:00, Alex Martelli в своем письме к All писал:
AM> to all intents and purposes working "as if"
AM> it was a declaration. If I had to vote about the one worst formal
AM> defec
Alexander Zatvornitskiy wrote:
Привет Alex!
05 февраля 2005 в 17:00, Alex Martelli в своем письме к All писал:
>> AM> The fact that in Python there are ONLY statements, NO
>> AM> declarations,
>> What is "global"? Statement? Ok, I fill lack of "var" statement:)
AM> 'global' is an ugly wart,
O
Alexander Zatvornitskiy
<[EMAIL PROTECTED]> wrote:
> ?? Alex!
>
> 05 ??? 2005 ? 17:00, Alex Martelli ? ? ?? ? All ?:
> >> AM> The fact that in Python there are ONLY statements, NO
> >> AM> declarations,
> >> What is "global"? Statement? Ok, I fill lack of "var" statement:
Привет Nick!
06 февраля 2005 в 02:54, Nick Coghlan в своем письме к Python List писал:
NC> An alternate proposal, where the decision to request rebinding
NC> semantics is made at the point of assignment:
NC> epsilon = 0
NC> S = 0
NC> while epsilon < 10:
NC>S .= S + epsilon
NC>epsel
e that programmer will waste on search for the reason of bug
>> caused by such typo, plus time what programmer will waste while
>> remembering exact variable name.
AM> I've been programming essentially full-time in Python for about three
AM> years, plus a few more years
Op 2005-02-07, Nick Coghlan schreef <[EMAIL PROTECTED]>:
> Antoon Pardon wrote:
>> Op 2005-02-05, Nick Coghlan schreef <[EMAIL PROTECTED]>:
>>
>>
>>>[ ... ]
>>>
>>>With a rebinding operator, the intent of the last line can be made explicit:
>>>
>>>def collapse(iterable):
>>> it = iter(iterabl
Antoon Pardon wrote:
Op 2005-02-05, Nick Coghlan schreef <[EMAIL PROTECTED]>:
[ ... ]
With a rebinding operator, the intent of the last line can be made explicit:
def collapse(iterable):
it = iter(iterable)
lastitem = it.next()
yield lastitem
for item in it:
if item != last
Op 2005-02-05, Roy Smith schreef <[EMAIL PROTECTED]>:
> In article <[EMAIL PROTECTED]>,
> [EMAIL PROTECTED] (Alexander
> Zatvornitskiy) wrote:
>
>> And, one more question: do you think code like this:
>>
>> var S=0
>> var eps
>>
>> for eps in xrange(10):
>> S=S+ups
>>
>> is very bad? Please
Op 2005-02-05, Nick Coghlan schreef <[EMAIL PROTECTED]>:
> [ ... ]
>
> With a rebinding operator, the intent of the last line can be made explicit:
>
> def collapse(iterable):
> it = iter(iterable)
> lastitem = it.next()
> yield lastitem
> for item in it:
> if item !=
Roy Smith wrote:
I'm not sure what that last sentence is supposed to mean, but I have
visions (nightmares?) of someday having ANSI, ISO, IEEE, or some other such
organization notice that something useful exists which they haven't yet
standardized/broken and decide to form a committee to do it.
S
On Sun, 06 Feb 2005 08:20:29 -0500, Jeremy Bowers <[EMAIL PROTECTED]>
wrote:
>On Sun, 06 Feb 2005 07:30:33 -0500, Arthur wrote:
>> What if:
>>
>> There was a well conducted market survey conclusive to the effect that
>> adding optional strict variable dec
On Sun, 06 Feb 2005 07:30:33 -0500, Arthur wrote:
> What if:
>
> There was a well conducted market survey conclusive to the effect that
> adding optional strict variable declaration would, in the longer run,
> increase Python's market share dramatically.
>
> It jus
Roy Smith <[EMAIL PROTECTED]> wrote:
> > which is good news for sellers of books, tools, training, consultancy
> > services, and for Python programmers everywhere -- more demand always
> > helps. *BUT* the price is eternal vigilance...
>
> I'm not sure what that last sentence is supposed to mean
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Alex Martelli) wrote:
> This is a good development, overall. Against stupidity, the gods
> themselves contend in vain; Python's entrance into stupid firms broadens
> its potential appeal from less than 10% to around 100% of the market,
> which i
a well conducted market survey conclusive to the effect that
adding optional strict variable declaration would, in the longer run,
increase Python's market share dramatically.
It just would.
More books. more jobs, etc.
Why would it?
My sense of how the real world works is that there is goin
Arthur <[EMAIL PROTECTED]> wrote:
> Do the STUPID firms use Python as well.
Yes, they're definitely starting to do so.
> Why?
The single most frequent reason is that some techie sneaked it in, for
example "just for testing" or "to do a prototype" or even without any
actual permission. Firms
Nick Coghlan <[EMAIL PROTECTED]> wrote:
...
> > _temp = x.y
> > x.y = type(temp).__irebind__(temp, z)
...
> I was thinking of something simpler:
>
>x.y
>x.y = z
>
> That is, before the assignment attempt, x.y has to resolve to *something*, but
> the interpreter isn't particu
Alex Martelli wrote:
It's not clear to me what semantics, exactly, x.y := z would be defined
to have (assuming := is the syntax sugar for ``rebinding''). Perhaps,
by analogy with every other augmented operator, it should be equivalent
to:
_temp = x.y
x.y = type(temp).__irebind__(temp, z)
T
On Sat, 5 Feb 2005 20:02:44 +0100, [EMAIL PROTECTED] (Alex Martelli)
wrote:
>Arthur <[EMAIL PROTECTED]> wrote:
>
>> On Sat, 5 Feb 2005 17:00:15 +0100, [EMAIL PROTECTED] (Alex Martelli)
>> wrote:
>> >
>> >I consider this one of the worst ideas to have been proposed on this
>> >newsgroup over the ye
Arthur <[EMAIL PROTECTED]> wrote:
> On Sat, 5 Feb 2005 17:00:15 +0100, [EMAIL PROTECTED] (Alex Martelli)
> wrote:
> >
> >I consider this one of the worst ideas to have been proposed on this
> >newsgroup over the years, which _IS_ saying something. \
>
> I would disagree, but only to the extent th
On Sat, 5 Feb 2005 17:00:15 +0100, [EMAIL PROTECTED] (Alex Martelli)
wrote:
>
>I consider this one of the worst ideas to have been proposed on this
>newsgroup over the years, which _IS_ saying something. \
I would disagree, but only to the extent that nothing that is only a
request for an option t
Nick Coghlan <[EMAIL PROTECTED]> wrote:
> Alex Martelli wrote:
> > 'global' is an ugly wart, to all intents and purposes working "as if" it
> > was a declaration. If I had to vote about the one worst formal defect
> > of Python, it would surely be 'global'.
> >
> > Fortunately, it's reasonably e
Alexander Zatvornitskiy wrote:
var epsilon=0
var S
S=0
while epsilon<10:
S=S+epsilon
epselon=epsilon+1#interpreter should show error here,if it's in "strict mode"
print S
It is easy, and clean-looking.
Alexander, [EMAIL PROTECTED]
An alternate proposal, where the decision to request rebinding s
Alex Martelli wrote:
'global' is an ugly wart, to all intents and purposes working "as if" it
was a declaration. If I had to vote about the one worst formal defect
of Python, it would surely be 'global'.
Fortunately, it's reasonably easy to avoid the ugliness, by avoiding
rebinding (within functio
1 - 100 of 153 matches
Mail list logo