Code Monkey home page Code Monkey logo

Comments (4)

nandoflorestan avatar nandoflorestan commented on August 17, 2024

Kajiki isn't supposed to implement everything that Genshi had. Kajiki is glad to drop a few of the misfeatures, especially those that made Genshi slow.

Now this feature here can be very convenient for the programmer, but the implementation would certainly cost something. I am not sure what is more valuable here.

I don't have the answer, I am just commenting like, don't expect Kajiki to be a clone of Genshi.

from kajiki.

vthriller avatar vthriller commented on August 17, 2024

don't expect Kajiki to be a clone of Genshi.

I certainly don't, but re: cost, well, even Jinja (which is universally considered a fast templating engine) supports this, so I thought this is the feature that's worth porting.

In [5]: from jinja2 import Template

In [8]: Template('{{ foo.bar }}').render(foo=foo)
Out[8]: 'baz'

from kajiki.

amol- avatar amol- commented on August 17, 2024

Uhm, I'm vaguely against this proposal for the reason that Kajiki maps your code to pure python code, which I like as it guarantees me that the code I wrote will be the resulting code. Providing this would mean injecting a call in every attribute access (which apart slowing down things) would break the guarantee that we don't inject additional behaviours in user code.

from kajiki.

CastixGitHub avatar CastixGitHub commented on August 17, 2024

I don't like this feature neither, getitem and getattr are two separate things in python

In [1]: spam = dict(egg='Spam')

In [2]: spam['egg']
Out[2]: 'Spam'

In [3]: spam.egg
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-1f641a831589> in <module>()
----> 1 spam.egg

AttributeError: 'dict' object has no attribute 'egg'

In [4]: pippo = type('Pippo', (object, ), dict(pluto='topolino'))()

In [5]: pippo.pluto
Out[5]: 'topolino'

In [6]: pippo['pluto']
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-6-dc79750a7340> in <module>()
----> 1 pippo['pluto']

TypeError: 'Pippo' object is not subscriptable

You may be intrested in https://stackoverflow.com/a/23689767 anyway. It's not about kajiki

from kajiki.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.