A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-May/079054.html below:

How should we deal with constant values?

[Python-Dev] Optimization of Python ASTs: How should we deal with constant values? [Python-Dev] Optimization of Python ASTs: How should we deal with constant values?"Martin v. Löwis" martin at v.loewis.de
Fri May 2 19:38:48 CEST 2008
Thomas Lee wrote:
> Martin v. Löwis wrote:
>>> This leaves us with a few options:
>>>     
>>
>> 5. Reuse/Abuse Num(object) for arbitrary constants.
>>    AFAICT, this should work out of the box.
>>
>>   
> Eek. It *does* seem like Num would work out of the box, but would this
> be a good idea?

No. I suggested it just for completeness.

> What about *replacing* Num with Const? Might make optimizations
> specifically for numeric values slightly hairier, and semantically I
> think they might be different enough to warrant separate AST nodes
> despite the similarity in implementation at the compiler level.

I think they should be separate. Const would be a mere addition;
for compatibility with other uses of the AST, that's actually better
than simultaneous removal of Num.

Regards,
Martin

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4