zoukankan      html  css  js  c++  java
  • Python3基础 complex 声明复数

    •        Python : 3.7.3
    •          OS : Ubuntu 18.04.2 LTS
    •         IDE : pycharm-community-2019.1.3
    •       Conda : 4.7.5
    •    typesetting : Markdown

    code

    coder@ubuntu:~$ source activate py37
    (py37) coder@ubuntu:~$ ipython
    Python 3.7.3 (default, Mar 27 2019, 22:11:17) 
    Type 'copyright', 'credits' or 'license' for more information
    IPython 7.5.0 -- An enhanced Interactive Python. Type '?' for help.
    
    In [1]: complex_num = 1 + 2j                                                    
    
    In [2]: type(complex_num)                                                       
    Out[2]: complex
    
    In [3]: complex_num = complex(5, 6)                                             
    
    In [4]: type(complex_num),complex_num                                           
    Out[4]: (complex, (5+6j))
    
    In [5]: exit                                                                    
    (py37) coder@ubuntu:~$ conda deactivate
    coder@ubuntu:~$ 
    
    

    source_code

    
    class complex(object):
        """
        Create a complex number from a real part and an optional imaginary part.
        
        This is equivalent to (real + imag*1j) where imag defaults to 0.
        """
        def conjugate(self): # real signature unknown; restored from __doc__
            """
            complex.conjugate() -> complex
            
            Return the complex conjugate of its argument. (3-4j).conjugate() == 3+4j.
            """
            return complex
    
        def __abs__(self, *args, **kwargs): # real signature unknown
            """ abs(self) """
            pass
    
        def __add__(self, *args, **kwargs): # real signature unknown
            """ Return self+value. """
            pass
    
        def __bool__(self, *args, **kwargs): # real signature unknown
            """ self != 0 """
            pass
    
        def __divmod__(self, *args, **kwargs): # real signature unknown
            """ Return divmod(self, value). """
            pass
    
        def __eq__(self, *args, **kwargs): # real signature unknown
            """ Return self==value. """
            pass
    
        def __float__(self, *args, **kwargs): # real signature unknown
            """ float(self) """
            pass
    
        def __floordiv__(self, *args, **kwargs): # real signature unknown
            """ Return self//value. """
            pass
    
        def __format__(self): # real signature unknown; restored from __doc__
            """
            complex.__format__() -> str
            
            Convert to a string according to format_spec.
            """
            return ""
    
        def __getattribute__(self, *args, **kwargs): # real signature unknown
            """ Return getattr(self, name). """
            pass
    
        def __getnewargs__(self, *args, **kwargs): # real signature unknown
            pass
    
        def __ge__(self, *args, **kwargs): # real signature unknown
            """ Return self>=value. """
            pass
    
        def __gt__(self, *args, **kwargs): # real signature unknown
            """ Return self>value. """
            pass
    
        def __hash__(self, *args, **kwargs): # real signature unknown
            """ Return hash(self). """
            pass
    
        def __init__(self, *args, **kwargs): # real signature unknown
            pass
    
        def __int__(self, *args, **kwargs): # real signature unknown
            """ int(self) """
            pass
    
        def __le__(self, *args, **kwargs): # real signature unknown
            """ Return self<=value. """
            pass
    
        def __lt__(self, *args, **kwargs): # real signature unknown
            """ Return self<value. """
            pass
    
        def __mod__(self, *args, **kwargs): # real signature unknown
            """ Return self%value. """
            pass
    
        def __mul__(self, *args, **kwargs): # real signature unknown
            """ Return self*value. """
            pass
    
        def __neg__(self, *args, **kwargs): # real signature unknown
            """ -self """
            pass
    
        @staticmethod # known case of __new__
        def __new__(*args, **kwargs): # real signature unknown
            """ Create and return a new object.  See help(type) for accurate signature. """
            pass
    
        def __ne__(self, *args, **kwargs): # real signature unknown
            """ Return self!=value. """
            pass
    
        def __pos__(self, *args, **kwargs): # real signature unknown
            """ +self """
            pass
    
        def __pow__(self, *args, **kwargs): # real signature unknown
            """ Return pow(self, value, mod). """
            pass
    
        def __radd__(self, *args, **kwargs): # real signature unknown
            """ Return value+self. """
            pass
    
        def __rdivmod__(self, *args, **kwargs): # real signature unknown
            """ Return divmod(value, self). """
            pass
    
        def __repr__(self, *args, **kwargs): # real signature unknown
            """ Return repr(self). """
            pass
    
        def __rfloordiv__(self, *args, **kwargs): # real signature unknown
            """ Return value//self. """
            pass
    
        def __rmod__(self, *args, **kwargs): # real signature unknown
            """ Return value%self. """
            pass
    
        def __rmul__(self, *args, **kwargs): # real signature unknown
            """ Return value*self. """
            pass
    
        def __rpow__(self, *args, **kwargs): # real signature unknown
            """ Return pow(value, self, mod). """
            pass
    
        def __rsub__(self, *args, **kwargs): # real signature unknown
            """ Return value-self. """
            pass
    
        def __rtruediv__(self, *args, **kwargs): # real signature unknown
            """ Return value/self. """
            pass
    
        def __str__(self, *args, **kwargs): # real signature unknown
            """ Return str(self). """
            pass
    
        def __sub__(self, *args, **kwargs): # real signature unknown
            """ Return self-value. """
            pass
    
        def __truediv__(self, *args, **kwargs): # real signature unknown
            """ Return self/value. """
            pass
    
        imag = property(lambda self: 0.0)
        """the imaginary part of a complex number
    
        :type: float
        """
    
        real = property(lambda self: 0.0)
        """the real part of a complex number
    
        :type: float
        """
    
    
    

    resource

    • [文档 - English] docs.python.org/3
    • [文档 - 中文] docs.python.org/zh-cn/3
    • [规范] www.python.org/dev/peps/pep-0008
    • [规范] zh-google-styleguide.readthedocs.io/en/latest/google-python-styleguide/python_language_rules
    • [源码] www.python.org/downloads/source
    • [ PEP ] www.python.org/dev/peps
    • [平台] www.cnblogs.com
    • [平台] gitee.com


    Python具有开源、跨平台、解释型、交互式等特性,值得学习。
    Python的设计哲学:优雅,明确,简单。提倡用一种方法,最好是只有一种方法来做一件事。
    代码的书写要遵守规范,这样有助于沟通和理解。
    每种语言都有独特的思想,初学者需要转变思维、踏实践行、坚持积累。

  • 相关阅读:
    python开发_html_html处理
    python开发_logging_日志处理
    IIS 7 应用程序池自动回收关闭的解决方案
    C#流水号生成汇总(四)
    通过内存盘提高MSMQ的消息吞吐能力
    c#分页工具类,完美实现List分页
    IIS 未能从程序集“System.ServiceModel, Version=3.0.0.0, Culture=neutral,
    win7电脑遇到端口被占用的情况该如何查看并将其关闭
    如何创建内存盘
    IP地址便捷修改器 V3.5 绿色版
  • 原文地址:https://www.cnblogs.com/xingchuxin/p/11116883.html
Copyright © 2011-2022 走看看