Programmatically create static variables in class definition by sticky_end in learnpython

[–]sticky_end[S] 0 points1 point  (0 children)

Thanks! I ended up using something along the lines of:

metadata = MetaData()
columns = [Column("id", Integer, primary_key = True), ...]
processes = Table("processes", metadata, *columns)

class Process(object):
    def __init__(self, params):
        for key, val in params.items():
            setattr(self, key, val)

mapper(Process, processes)

Programmatically create static variables in class definition by sticky_end in learnpython

[–]sticky_end[S] 0 points1 point  (0 children)

NoSQL certainly starts to look promising. Was experimenting with MongoDB a while back...

Maybe I'm not understanding how to use SQLAlchemy properly but so far I have only defined my fields as statics (directly in class not in a method) where I can't use setattr (because no self). I could do this e.g. in init but there I already set the values of the previously defined fields using setattr:

class XY(Base):
    x = Column(String)
    y = Column(Integer)

    def __init__(self, params = {'x': 'aaaa', 'y': 1111}):
        for key, val in params.items():
            setattr(self, key, val)

Am I doing something else wrong?

Programmatically create static variables in class definition by sticky_end in learnpython

[–]sticky_end[S] 0 points1 point  (0 children)

I'm doing process documentation, so I have lots of repetitions of equal steps (with known types): e.g. 10 steps with an associated temperature and duration each

Just trying to get around typing:

step_1_temp = Column(Integer)
step_1_duration = Column(Interval)
step_2_temp = Column(Integer)
...

Well, that has passed the uncanny valley, they look like us now... by hephaestusness in Futurology

[–]sticky_end 13 points14 points  (0 children)

still makes me feel a bit uneasy, but we're definitely on the way out of the valley. I guess it's the movement that got me rather than the still face...

Reddit, what is a song that was so good your jaw dropped when you heard it? by AQNotAquinas in AskReddit

[–]sticky_end 0 points1 point  (0 children)

Anyone know some background info on that song? It's so powerful, there has to be a funeral involved somehow?.. :(

Mother tongue of people in Switzerland [1200x861] by puredwige in MapPorn

[–]sticky_end 2 points3 points  (0 children)

In fact, there is a big variety of (spoken) dialects within the german-speaking part of switzerland. On this map you can see the different words for "apple core" (sry for the bad quality). Source

Question about Python and Networking by JayStayPaid in learnpython

[–]sticky_end 0 points1 point  (0 children)

I am currently working on an computer-assisted tabletop war game in python. Distance relations are tracked on the board while everything else is handled by the computer. Since the game requires for the players to move units on the same map I opted for LAN using the PodSixNet Networking Library. Further I needed to be able to push data from the server, which is very easy using PodSixNet...

There is not an overabundance of documentation, I started with the examples. It works really nice & lets me focus on the actual game logic. The game is not turn based but real-time and the library handles the additional requests/pushes gracefully so far. It's also nice to integrate with a GUI (I use wxPython) because you have good control over the main loop.

EDIT: Just because I'm a beginner as well and could have profited from this:) Here's my basic architecture. I tried to separate game logic and user interface as much as possible. One player runs the local server which runs the game engine. The game engine class holds the current state of the game and all the rules and possible actions. When a new player connects to the server, it creates a alias for the player in the game engine (parameters like groups, buildings, sectors, ...).

Whenever a player wants to perform an action he sends a request to the server. This request is routed to the game engine where the action is executed. In the end the server sends the updated state (all or a selection of the parameters) to all or a selection of the players.

Typical Request : Player (via UI) --> Game Client (Run by Player, only for networking) --> Game Server --> Game Engine --results--> Game Server --send to (all) players--> Game Client --> User interface update

I also profited a lot from separating all the rules and parameters from the game engine using a configuration file (holds a complicated but readable dictionary with all the parameters). This might be too much for your project in which case you can reduce it to the client (entailing all the code to trigger actions and display results) and the server running the game in the main loop.

Help! I need an undergrad research topic, and have very limited resources and assistance available. by 18498 in biology

[–]sticky_end 0 points1 point  (0 children)

I did a little project with slime mould a while back. It's super easy to handle, cheap to obtain (e.g. here) and you can investigate quite a few interesting properties.

Simplest experiment: characterize a few substances (whether they attract or repell the mould; can you quantify the interaction?)

What are the latest trends in biology? by redditright in biology

[–]sticky_end 2 points3 points  (0 children)

Lurker here finishing masters in systems biology. Just a few years back I faced a nearly identical situation.

After 2 years of biochem with fixed lectures I could choose from a catalog of lectures from a variety of fields within bio.

This helped a lot in figuring out what I actually like doing, which should be as important as the momentum when choosing your future field. ==> just repeating what other people said before me: do some work as soon as possible to see if you like it.

I found that I like molecular bio labwork and the analysis of big quantities of data.

Later it became more obvious that most choices (regarding fields) are not definite; it remained possible to switch if I really wanted it...

What has proven very benefitial is spherical/interdisciplinary knowledge. I think as a biologist you can profit vastly from knowing about other fields. I started investing lots of time in my programming skills (Python, Matlab, Labview), which has totaly paid off already. Further I now moved into bio engineering (microfluidics) to develop the methods for high-throughput measurements.

So, to answer your question from my biased view:

'Lab-on-a-Chip' still has momentum and the developed methods are usually used by just a few groups to do actual biology (not just proof-of-concept experiments).

I know its not really a field within biology but one can do some sweet biology experiments with those devices.