When I use:
puts [format "%s (%s)" ${package} ${blockingPckg}]
I get:
pyppmd (py7zr)
When I use:
lappend manual ${package}
puts ${manual}
I get:
pyppmd
But when I use:
lappend manual [format "%s (%s)" ${package} ${blockingPckg}]
puts ${manual}
I get:
{pyppmd (py7zr)}
What could be happening here? I would expect:
pyppmd (py7zr)
When I use:
puts [format "%s (%s)" ${package} ${blockingPckg}]
I get:
pyppmd (py7zr)
When I use:
lappend manual ${package}
puts ${manual}
I get:
pyppmd
But when I use:
lappend manual [format "%s (%s)" ${package} ${blockingPckg}]
puts ${manual}
I get:
{pyppmd (py7zr)}
What could be happening here? I would expect:
pyppmd (py7zr)
But when I use:
lappend manual [format "%s (%s)" ${package} ${blockingPckg}]
It works when I use:
append manual [format "%s (%s) " ${package} ${blockingPckg}]
But I am still interested in what is happening.
But when I use:
lappend manual [format "%s (%s)" ${package} ${blockingPckg}]
puts ${manual}
I get:
{pyppmd (py7zr)}
What could be happening here? I would expect:
pyppmd (py7zr)
When I use:
puts [format "%s (%s)" ${package} ${blockingPckg}]
I get:
pyppmd (py7zr)
When I use:
lappend manual ${package}
puts ${manual}
I get:
pyppmd
But when I use:
lappend manual [format "%s (%s)" ${package} ${blockingPckg}]
puts ${manual}
I get:
{pyppmd (py7zr)}
Am 29.09.2022 um 00:00 schrieb Cecil Westerhof:
When I use:
puts [format "%s (%s)" ${package} ${blockingPckg}]
I get:
pyppmd (py7zr)
When I use:
lappend manual ${package}
puts ${manual}
I get:
pyppmd
But when I use:
lappend manual [format "%s (%s)" ${package} ${blockingPckg}]
puts ${manual}
I get:
{pyppmd (py7zr)}
lappend is a list append and transforms each parameter to a valid list element. As the string contains a space, curly braces aree added.
To make it simpler, you may write:
lappend manual "pyppmd (py7zr)"
On 9/28/22 6:00 PM, Cecil Westerhof wrote:
When I use:
puts [format "%s (%s)" ${package} ${blockingPckg}]
I get:
pyppmd (py7zr)
When I use:
lappend manual ${package}
puts ${manual}
I get:
pyppmd
But when I use:
lappend manual [format "%s (%s)" ${package} ${blockingPckg}]
puts ${manual}
I get:
{pyppmd (py7zr)}
What could be happening here? I would expect:
pyppmd (py7zr)
It is because of the space: Your manual variable is a list, which
contains an element with characters that require special handling in
Tcl, which here happens to be the space character. Space is also the
default delimiter that [puts] uses when printing lists. In this case,
it would cause a confusion as to whether what it printed was two
separate elements, or a single element with spaces in it.
Try eliminating the space by using "%s(%s)" as the format or try using
[join $manual] before printing it.
append manual [format "%s (%s) " ${package} ${blockingPckg}]
Harald Oehlmann <[email protected]> writes:
Am 29.09.2022 um 00:00 schrieb Cecil Westerhof:
When I use:
puts [format "%s (%s)" ${package} ${blockingPckg}]
I get:
pyppmd (py7zr)
When I use:
lappend manual ${package}
puts ${manual}
I get:
pyppmd
But when I use:
lappend manual [format "%s (%s)" ${package} ${blockingPckg}]
puts ${manual}
I get:
{pyppmd (py7zr)}
lappend is a list append and transforms each parameter to a valid list
element. As the string contains a space, curly braces aree added.
To make it simpler, you may write:
lappend manual "pyppmd (py7zr)"
I do not think that that will work, because the format is giving that
string.
I use tclsh not enough. I should have know this. :'-(
First I only saved the package name, now I add the blocking package.
I should have used append instead of lappend from day one, but in the original case the result was the same. So it did not have
consequences.
But it was still a bug in my opinion: I needed a string, so no reason
to work with a list.
Cecil Westerhof <[email protected]> writes:
append manual [format "%s (%s) " ${package} ${blockingPckg}]
And I make thing needlessly difficult again. I should just use:
append manual "${package} (${blockingPackage}) "
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (3 / 13) |
| Uptime: | 00:44:22 |
| Calls: | 12,098 |
| Calls today: | 6 |
| Files: | 15,003 |
| Messages: | 6,517,858 |