Re: earwax-server
@15You can happily subclass, just override the events that are there by default.What is it about decorators that confuse you?
URL: https://forum.audiogames.net/post/591674/#p591674
--
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
Re: earwax-server
I remember trying Earwax and being put off by decorators. I'm relatively experienced in Python (at least I'd like to think so) but those just don't make sense to me. Subclassing sounds like a better approach. Lucia has the same issue, that is, globals in the main file
Re: earwax-server
@12When did you try this? I've just verified that it installs fine on Python 3.9 64 bit.@13Wow, OK, I didn't realise all that. Thanks for explaining.So the decorators do add to a dictionary, albeit a list inside a dictionary:{'on_connect': [on_connect_1, on_connect_0
Re: earwax-server
The tldr of decorators and performance is that function calls in Python are reasonably expensive because Python can't inline and always goes via a stack. So the minimal cost is (often) an extra empty function call. If all the decorator does is literally puts
Re: earwax-server
@11: Awesome! The module doesn't install for me though. Earwax installs fine, but not earwax_server```batchpip install earwax_server```Acts like it installs something, but when doing```pythonimport earwax_server```I get a ModuleNotFoundError. Any ideas?
URL: https
Re: earwax-server
@2Networking is now in mainline Earwax.See my post on the subject.
URL: https://forum.audiogames.net/post/590753/#p590753
--
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo
Re: earwax-server
@allThanks for the suggestions. You're right, I do like my decorators, but I shall think twice before using them in future.I'll be keeping them for earwax and associated stuff, because it works with Pyglet, so it kind of makes sense to stick with that style. Also, you can
Re: earwax-server
@chrisnorman7Frankly, I have seen maybe 4 or 5 decorators from you. I have seen maybe 4 or 5 decorators that aren't yours in 8 or so years of coding in Python. You're going way overboard. They aren't the only hammer.The advantage of classes is that people won't
Re: earwax-server
@5 decorators are the pythonic way for making functions that take functions and return them transformed in some way (or in your case, performing side effects). however I would be very surprised if passing functions as arguments was entirely discouraged, since for some
Re: earwax-server
I like what I'm seeing so far, but yes, @chrisnorman7 you really do like your decorators, don't you
URL: https://forum.audiogames.net/post/589948/#p589948
--
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin
Re: earwax-server
@2OK, so I've worked in the client side, although it's not in the official release yet, and it's not thoroughly tested. However, here is the test script I'm using:from pyglet.window import Window, key
from earwax import (AlreadyConnected, AlreadyConnecting
Re: earwax-server
"2Not sure yet, but I hope something like the following:from earwax import NetworkConnection
c = NetworkConnection()
@c.event
def on_connect():
print('Connected.')
@c.event
def on_data(data: bytes):
print(data)
@c.event
def on_disconnected():
Re: earwax-server
I'd probably do that as a class with a base class that you inherit from with default implementations for all events that do nothing.You're way, way too addicted to decorators. I think every time we have a conversation they come up in some example or other. I would
Re: earwax-server
@2 I think he wrote that you could connect via telnet, so I'm guessing you would just connect like you would for a MUD
URL: https://forum.audiogames.net/post/589774/#p589774
--
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https
Re: earwax-server
hey, nice little library for getting a event driven server up quickly for prototyping!my nitial thought is do the decorators really add anything here? since you use the same decorator for three different functions that need to be defined for a server instances
Re: earwax-server
Hey that's cool! How would the client interfacing with this look?
URL: https://forum.audiogames.net/post/589764/#p589764
--
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo
earwax-server
Hi all,In preparation for (hopefully) adding network support to Earwax, I have released a small module for creating game servers, with a Pyglet-like events API.You can read the docs here, or see below for a very basic chat server written with the module:"""A ba
17 matches
Mail list logo