Skip to content

Invalid syntax error using := #2

@DrBwts

Description

@DrBwts

Pthyon 3.8

I'm using the following code from the examples on the docs page,

import schemdraw
from schemdraw import logic

with schemdraw.Drawing() as d:
    d.config(unit=0.5)
    d += (S := logic.Xor().label('S', 'right'))
    d += logic.Line().left(d.unit*2).at(S.in1).idot().label('A', 'left')
    d += (B := logic.Line().left().at(S.in2).dot())
    d += logic.Line().left().label('B', 'left')
    d += logic.Line().down(d.unit*3).at(S.in1)
    d += (C := logic.And().right().anchor('in1').label('C', 'right'))
    d += logic.Wire('|-').at(B.end).to(C.in2)

This throws the folloiwng error,

  File "D:\Python codes\temp.py", line 11
    d += (S := logic.Xor().label('S', 'right'))
            ^
SyntaxError: invalid syntax

Any idea why this is happening?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions