File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -515,13 +515,18 @@ Native ports
515515 >>> with serial.serial_for_url(port) as s:
516516 ... s.write(b ' hello' )
517517
518- Here no port argument is given, so it is not opened automatically:
518+ The port is opened automatically:
519519
520- >>> with serial.Serial() as s:
521- ... s .port = ...
522- ... s.open()
520+ >>> port = serial.Serial()
521+ >>> port .port = ' ...'
522+ >>> with port as s:
523523 ... s.write(b ' hello' )
524524
525+ Which also means that ``with `` statements can be used repeatedly,
526+ each time opening and closing the port.
527+
528+ .. versionchanged :: 3.4 the port is automatically opened
529+
525530
526531 .. method :: __exit__(exc_type, exc_val, exc_tb)
527532
@@ -618,7 +623,7 @@ Native ports
618623
619624 .. method :: isOpen()
620625
621- .. deprecated :: 3.0 see :attr:`is_open`
626+ .. deprecated :: 3.0 see :attr:`is_open`
622627
623628 .. attribute :: writeTimeout
624629
You can’t perform that action at this time.
0 commit comments