`
huangyiiiiii
  • 浏览: 115972 次
  • 性别: Icon_minigender_1
最近访客 更多访客>>
社区版块
存档分类
最新评论
文章列表
心血来潮,实现了一个 django 的 url dispatcher,比想象中简单多了。http://djangodispatcher.googlecode.com/svn/trunk/mapper.pyhttp://djangodispatcher.googlecode.com/svn/trunk/test.py实际实现功能的代码才2、30行,功能基本完整,包括分层次的url配置,和发生异常时帮助调试用的一些信息。PS:发现最近爱上了 Test Driven.
答案很简单:Test Driven。哈哈,这个(http://code.google.com/p/pylifegame/)就是好例子!醉了,不多说了,自己看去,我要睡觉去了,嗯 ...
YiYi is a text editor written and extensible in Haskell. The goal of Yi is to provide a flexible, powerful and correct editor core dynamically scriptable in Haskell.
Pickle: An interesting stack language原来 pickle 本身就是就是一个微型的基于栈的语言,呵呵,有点意思。研究一下 pickle.py 和 pickletools.py ,可以看到更细节的东西。
Python 3000 进度报告也可以从 guido 的中文 blog 看到:http://blog.csdn.net/gvanrossum/archive/2007/06/20/1658829.aspx
Python 3000 Status Update (Long!) by Guido van Rossum """SummaryHere's a long-awaited update on where the Python 3000 project stands. We're looking at a modest two months of schedule slip, and many exciting new features. I'll be presenting this in person several times over the next two ...

老子毕业了

http://picasaweb.google.com/yi.codeplayer/070608
看 SQLAlchemy 自带的 zblog 的例子,可以看到 SQLAlchemy 一些非常有用的特性。文章相关评论数统计比如显示文章列表的同时我们希望获得相关文章的评论数,如果是用 django 那就只能放弃 ORM 的好处自己去执行 sql 语句了,否则就只会导致 n+1 条 SQL 语句的执行。在 SQLAlchemy 中你可以把任意的 select 语句映射到一个 class ,这样就可以用一条 SQL 语句搞定,还能获得 ORM 的好处,下面是原封不动拷过来的代码(只调整了下格式): # Post mapper, these are posts within a blog. # ...
multitaskmultitask allows Python programs to use generators (aka coroutines) to perform cooperative multitasking and asynchronous I/O. Applications written using multitask consist of a set of cooperating tasks that yield to a shared task manager whenever they perform a (potentially) blocking operatio ...
Polymorphic Associations with SQLAlchemySQLAlchemy 老大展示怎么用 sqlalchemy 实现 rails 的 Polymorphic Associations 顺便看了下 Rails 所谓Polymorphic Associations 的介绍,才发现其实就是我很早就介绍过的 django 的 content-type app 所干的事情,app 就是插件的意思。
Python and vim: Two great tastes that go great together用 python 扩展 vim ,想法倒是不新,不过第一次看到 tutotial 。记得 tocer 说过要用 python 写个 vim 库的,不知道有没有进展哈,呵呵。
http://dis.4chan.org/read/prog/1180084983/哈哈,有点意思,再加一个:Python 2.5 programmer:def fact(x): return x * fact(x - 1) if x > 1 else 1print fact(6)
有的时候在 blog 里写 wiki,有的时候在 wiki 里写 blog,有的时候在 blog 里发在 wiki 里写的 blog ;-)
写 model 的时候发现有些东西在重复,第一反应就是写个基类,把这些重复的东西拿出来,然而 Model 类之间继承却不是那么方便的,应该会影响到 ORM 的行为。怎么办呢?幸好 python 有多重继承。下面就是项目中做这些重复事情的类:class ModelMixin(object): def save(self): if not self.id: # creation time if hasattr(self, 'pubdate'): self.pubdate = datetime.now() i ...
建一个项目 newformstutorials ,建一个 app blog ,在 blog 的 models 中定义个:class Article(models.Model): title = models.CharField(u'标题', maxlength=255) author = models.CharField(u'作者', maxlength=20) hits = models.IntegerField(u'点击数', default=0, editable=False) content = models.TextField(u'内容')配置好数据库,把 ne ...
Global site tag (gtag.js) - Google Analytics