Le mardi 20 août 2013 09:55:44 UTC+2, Antoon Pardon a écrit :
> Op 20-08-13 09:31, wxjmfa...@gmail.com schreef:
>
> > Le mardi 20 août 2013 08:55:18 UTC+2, Antoon Pardon a écrit :
>
> >>
>
> >>>
>
> >>
>
> >
>
> >>
>
> >>
>
> >>
>
> >>> If you consider the implementation of sin and cos fu
Op 20-08-13 09:31, wxjmfa...@gmail.com schreef:
> Le mardi 20 août 2013 08:55:18 UTC+2, Antoon Pardon a écrit :
>>
>>>
>>
>
>>
>>
>>
>>> If you consider the implementation of sin and cos functions, they usually
>>
>>> reduce the argument modulo π to something in the first quadrant, and then
>>
>
Le mardi 20 août 2013 08:55:18 UTC+2, Antoon Pardon a écrit :
>
> >
>
>
>
>
> > If you consider the implementation of sin and cos functions, they usually
>
> > reduce the argument modulo π to something in the first quadrant, and then
>
> > use symmetry to adjust the value. So changing th
Op 20-08-13 07:48, Steven D'Aprano schreef:
> On Mon, 19 Aug 2013 22:34:00 +0200, Antoon Pardon wrote:
>
>> Op 19-08-13 19:05, Steven D'Aprano schreef:
>>
>>
>>> I wish Python had stronger support for enforcing constantness, to whit,
>>> some way to say "you can't rebind or delete this name once i
Le mardi 20 août 2013 07:48:37 UTC+2, Steven D'Aprano a écrit :
> On Mon, 19 Aug 2013 22:34:00 +0200, Antoon Pardon wrote:
>
>
>
> > Op 19-08-13 19:05, Steven D'Aprano schreef:
>
> >
>
> >
>
> >> I wish Python had stronger support for enforcing constantness, to whit,
>
> >> some way to say
On Mon, 19 Aug 2013 22:34:00 +0200, Antoon Pardon wrote:
> Op 19-08-13 19:05, Steven D'Aprano schreef:
>
>
>> I wish Python had stronger support for enforcing constantness, to whit,
>> some way to say "you can't rebind or delete this name once it is
>> bound". You can do it with attributes, by u
Antoon Pardon writes:
> Op 19-08-13 09:45, Dave Angel schreef:
> > Antoon Pardon wrote:
> >> I think you are overstating your case. Classes and functions are
> >> variables too and in general nobody seems to have a problem with
> >> them being global.
> >
> > It's global *variables* that are to
Op 19-08-13 19:05, Steven D'Aprano schreef:
I wish Python had stronger support for enforcing constantness, to whit,
some way to say "you can't rebind or delete this name once it is bound".
You can do it with attributes, by use of property, or in C extensions,
but you cannot do it with top-level
Op 19-08-13 18:57, Steven D'Aprano schreef:
On Mon, 19 Aug 2013 10:16:36 +0200, Antoon Pardon wrote:
Op 19-08-13 09:45, Dave Angel schreef:
Antoon Pardon wrote:
Op 17-08-13 17:01, Steven D'Aprano schreef:
And here you re-import the name "y" from struct_global. That rebinds
the current modu
Op 19-08-13 17:04, Chris Angelico schreef:
On Mon, Aug 19, 2013 at 3:55 PM, Antoon Pardon
wrote:
Pity enough they chose a
way that didn't allow programmers to protect names they thought
important enough to do so too.
As of Python 3, we can redefine something that used to be a keyword,
which i
On Mon, Aug 19, 2013 at 6:16 PM, Steven D'Aprano
wrote:
> On Mon, 19 Aug 2013 16:57:37 +, Steven D'Aprano wrote:
>
>> def func(x):
>> ...
>>
>> # later
>> save_func = func
>> func = lambda x, y: do_stuff(x, 3*y)-4 result =
>> something_that_calls_func()
>> func = save_func
>>
>>
>> Nasty,
On Mon, 19 Aug 2013 16:57:37 +, Steven D'Aprano wrote:
> def func(x):
> ...
>
> # later
> save_func = func
> func = lambda x, y: do_stuff(x, 3*y)-4 result =
> something_that_calls_func()
> func = save_func
>
>
> Nasty, horrible code, yes? But it's nasty and horrible because "func" is
>
On Mon, 19 Aug 2013 09:32:53 +0100, Chris Angelico wrote:
> Python does have constants. It just doesn't have interpreter support for
> them. Same as private members, in fact.
"Constant by convention".
I wish Python had stronger support for enforcing constantness, to whit,
some way to say "you c
On Mon, 19 Aug 2013 10:16:36 +0200, Antoon Pardon wrote:
> Op 19-08-13 09:45, Dave Angel schreef:
>> Antoon Pardon wrote:
>>
>>> Op 17-08-13 17:01, Steven D'Aprano schreef:
And here you re-import the name "y" from struct_global. That rebinds
the current module's "y" with whatever v
On Mon, Aug 19, 2013 at 3:55 PM, Antoon Pardon
wrote:
> Pity enough they chose a
> way that didn't allow programmers to protect names they thought
> important enough to do so too.
As of Python 3, we can redefine something that used to be a keyword,
which is even stronger than a constant.
def pri
Op 19-08-13 14:33, Dave Angel schreef:
> Antoon Pardon wrote:
>
>> Op 19-08-13 11:18, Chris Angelico schreef:
>
>>> The issue
>>> was regarding imports, and it's perfectly safe to import a constant,
>>> even if the interpreter doesn't protect you from then being a total
>>> idiot and changing
Antoon Pardon wrote:
> Op 19-08-13 11:18, Chris Angelico schreef:
>> The issue
>> was regarding imports, and it's perfectly safe to import a constant,
>> even if the interpreter doesn't protect you from then being a total
>> idiot and changing it.
>
> Python doesn't have constants, so you sta
Op 19-08-13 11:18, Chris Angelico schreef:
> On Mon, Aug 19, 2013 at 10:03 AM, Antoon Pardon
> wrote:
>> This is irrelevant. That some context defines a constant, and that you
>> can use a variable with the same name as a constant in python, doesn't
>> contradict the statement that python (as a la
Chris Angelico wrote:
> On Mon, Aug 19, 2013 at 10:03 AM, Antoon Pardon
> wrote:
>> This is irrelevant. That some context defines a constant, and that you
>> can use a variable with the same name as a constant in python, doesn't
>> contradict the statement that python (as a language) doesn't has
On Mon, Aug 19, 2013 at 10:03 AM, Antoon Pardon
wrote:
> This is irrelevant. That some context defines a constant, and that you
> can use a variable with the same name as a constant in python, doesn't
> contradict the statement that python (as a language) doesn't has
> constants. There is nothing
Op 19-08-13 10:32, Chris Angelico schreef:
> On Mon, Aug 19, 2013 at 9:16 AM, Antoon Pardon
> wrote:
>> Op 19-08-13 09:45, Dave Angel schreef:
>>> Antoon Pardon wrote:
I think you are overstating your case. Classes and functions are
variables too and in general nobody seems to have a pro
On Mon, Aug 19, 2013 at 9:16 AM, Antoon Pardon
wrote:
> Op 19-08-13 09:45, Dave Angel schreef:
>> Antoon Pardon wrote:
>>> I think you are overstating your case. Classes and functions are
>>> variables too and in general nobody seems to have a problem with them
>>> being global.
>>>
>>
>> It's glo
Op 19-08-13 09:45, Dave Angel schreef:
> Antoon Pardon wrote:
>
>> Op 17-08-13 17:01, Steven D'Aprano schreef:
>>>
>>> And here you re-import the name "y" from struct_global. That rebinds the
>>> current module's "y" with whatever value struct_global.y has *now*,
>>> rather than a second (or a m
Antoon Pardon wrote:
> Op 17-08-13 17:01, Steven D'Aprano schreef:
>>
>> And here you re-import the name "y" from struct_global. That rebinds the
>> current module's "y" with whatever value struct_global.y has *now*,
>> rather than a second (or a minute, or an hour) earlier when the first
>> i
Op 17-08-13 17:01, Steven D'Aprano schreef:
>
> And here you re-import the name "y" from struct_global. That rebinds the
> current module's "y" with whatever value struct_global.y has *now*,
> rather than a second (or a minute, or an hour) earlier when the first
> import took place. Obviously a
On Sat, 17 Aug 2013 07:25:43 -0700, tmellman wrote:
> I have this file that has this:
>
> from struct_global import y
> from struct_global import x
The import of x appears to be irrelevant, so I'll ignore it.
Here you import y from the struct_global module. This creates a new name
y in
I have this file that has this:
from struct_global import y
from struct_global import x
and this usage (a few lines later in a class method definition in the same
file):
if y == x:
If I stop there in pdb, I can observe this:
(Pdb) p x
66
(Pdb) p y
-1
27 matches
Mail list logo