Giter Club home page Giter Club logo

Comments (8)

GrahamDumpleton avatar GrahamDumpleton commented on July 26, 2024 1

Could be worthwhile have both available. I'll look at what best way of doing that might be. I may want to break apart the wrappers.py file into two files.

from wrapt.

dg-pb avatar dg-pb commented on July 26, 2024

Also, this could be useful for cross-testing 2 implementations.

from wrapt.

dg-pb avatar dg-pb commented on July 26, 2024

I could issue PR on this. Of course, I understand if you want to do this yourself.

from wrapt.

GrahamDumpleton avatar GrahamDumpleton commented on July 26, 2024

Have been working on code today so can get a new release out. So am pondering how can come up with acceptable way of restructuring it.

I could move the pure Python components appearing before the C extension imports from wrappers.py into _wrapperspy.py with them import them into wrappers.py from there if no C extension. It would still be regarded as internal implementation detail though and you would need to import wrapt._wrapperspy to get the pure Python components. Just don't like the naming of the files at the moment with that option.

Another alternative is to move some of the stuff after the C extension import into a separate file called monkey.py indicative of their use in monkey patching, and see if that results in a better way of organising things.

from wrapt.

dg-pb avatar dg-pb commented on July 26, 2024

Some thoughts.

I like the former. Doesn't break backwards compatibility. Also, creating new monkey.py feels a bit superfluous given that file would only have couple of objects left in it.

It seems that there is only 1 class in wrappers.py which inherits from either C or Py implementations. For consistency it might be good to have it with both inheritances as well.

In this case, could:

  1. Create _wrappersc.py and _wrapperspy.py.
  2. Define WeakFunctionProxyBase in _wrapperspy.py
  3. Create WeakFunctionProxy(WeakFunctionProxyBase, ObjectProxy) in both _wrappersc.py and _wrapperspy.py. _wrappersc.py would import WeakFunctionProxyBase from _wrapperspy.py
  4. Then do conditional import from wrappers.py.

This way all objects with all implementations would be possible access at the same time.

from wrapt.

GrahamDumpleton avatar GrahamDumpleton commented on July 26, 2024

I did it rather differently to satisfy my ideas of what works better. Can you try:

The pure Python ObjectProxy is available using:

from wrapt.wrappers import ObjectProxy

from wrapt.

dg-pb avatar dg-pb commented on July 26, 2024

Fair. All seems to be working. Thanks for this.

from wrapt.

GrahamDumpleton avatar GrahamDumpleton commented on July 26, 2024

Have released 1.16.0 with this now.

from wrapt.

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.