Ignore:
Timestamp:
02/19/06 03:10:24 (9 years ago)
Author:
xi
Message:

Fix segfault under Python2.3.

Support for complex numbers.

Add /usr/local to the search path.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/syck/dumpers.py

    r36 r49  
    144144        return _syck.Scalar(value, tag="tag:yaml.org,2002:float") 
    145145 
     146    def represent_complex(self, object): 
     147        if object.real != 0.0: 
     148            value = '%s+%sj' % (repr(object.real), repr(object.imag)) 
     149        else: 
     150            value = '%sj' % repr(object.imag) 
     151        return _syck.Scalar(value, tag="tag:python.yaml.org,2002:complex") 
     152 
    146153    def represent_sets_Set(self, object): 
    147154        return _syck.Seq(list(object), tag="tag:yaml.org,2002:set") 
     
    165172    represent_function = represent_type 
    166173    represent_builtin_function_or_method = represent_type 
     174 
     175    def represent_module(self, object): 
     176        return _syck.Scalar('', tag="tag:python.yaml.org,2002:module:"+object.__name__) 
    167177 
    168178    def represent_instance(self, object): 
Note: See TracChangeset for help on using the changeset viewer.