| 2024-01-06 08:15:26 +0200 | received badge | ● Popular Question (source) |
| 2021-04-01 13:59:52 +0200 | received badge | ● Nice Question (source) |
| 2021-04-01 13:13:53 +0200 | received badge | ● Notable Question (source) |
| 2017-10-05 18:06:52 +0200 | received badge | ● Popular Question (source) |
| 2014-06-29 21:29:01 +0200 | received badge | ● Popular Question (source) |
| 2014-06-29 21:29:01 +0200 | received badge | ● Notable Question (source) |
| 2014-06-29 21:29:01 +0200 | received badge | ● Famous Question (source) |
| 2013-02-14 14:50:51 +0200 | received badge | ● Organizer (source) |
| 2013-02-14 14:50:33 +0200 | asked a question | Evaluating a symbolic expression for a Graph I'm able to do this: But not this: What am I missing? Is it not possible to use symbolic expressions like this? |
| 2012-08-11 00:25:41 +0200 | received badge | ● Student (source) |
| 2012-08-09 17:16:46 +0200 | commented question | Sage is not updating modules imported by an attached file To avoid any comments about not being Pythonic, I'll say that since I drafted this post, I've read up on duck typing and I'm jettisoning all the abstractmethod business. |
| 2012-08-09 16:18:57 +0200 | asked a question | Sage is not updating modules imported by an attached file My file structure looks like: project/
__init__.py
project.py
bounds.py
project.py looks approximately like: import sys
import os
import bounds
def myfunction(g):
if has_bound(g):
...
def has_bound(g):
lbound = 1
for name, obj in inspect.getmembers(bounds, inspect.isclass):
if obj.__module__ == 'bounds':
new_bound = obj.bound(g)
if new_bound > lbound:
lbound = new_bound
return lbound
bounds.py: import abc
class BoundBase(object):
@staticmethod
@abc.abstractmethod
def bound(g):
return
class SpecificBound(LowerBoundBase):
@staticmethod
def bound(g):
return 5
Now, I start a Sage session in the Terminal and do |
| 2012-08-09 11:30:21 +0200 | received badge | ● Supporter (source) |
| 2012-08-08 17:17:21 +0200 | asked a question | Structuring and naming modules I'm starting a new research project, and I'm confused about the best way to organize everything. I'll need to write a few functions that compute invariants on Graphs, but the trick is that each function needs to call lots of smaller functions that compute bounds for the invariant, and then choose the min/max of these bounds and return it. I'd like the smaller functions to be "plug and play," so that other people on the project can come up with new bounds computers, drop them in the folder, and have them automatically used. Currently, my file structure looks like this: project/
__init__.py
project.py
bounds/
__init__.py
boundcomputer1.py
boundcomputer2.py
...
If I start a Sage session and If I do Also, how do I get the functions in I'm happy to take any advice on best practice for a project like this. |
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.