Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 1,000 results for
tuple
- Page 1
DeepSeek R1 vs Llama 3.1-405b for Text Classification and Summarization
Programming
Computer Science
2 Months Ago
by usmanmalik57
…, we define the `predict_sentiment()` function, which accepts the model (a
tuple
containing the model name and Fireworks Path for the model…
Re: Tuple Vector iteration, element access and erasion
Programming
Software Development
11 Years Ago
by Gonbe
…this? #include <iostream> #include <
tuple
> #include <vector> #include <…string> using namespace std; int main() { typedef
tuple
<int, string, int, int> pc_data; …{ // Test: we're going to delete the
tuple
of which the 3rd element (index 2) = 3…
tuple or list?
Programming
Software Development
19 Years Ago
by shanenin
from my understanding, a list can do everything a
tuple
can do plus more. The big advantage of using a list is you can change elements, lists are mutable. Are their situations where a
tuple
is preferable to a list?
Re: Tuple List
Programming
Software Development
19 Years Ago
by vegaseat
… in common. They are both indexed containers for objects. The
tuple
is a very simple container to put some objects together… it, slice it and dice it, even comprehend it! The
tuple
is simple and consumes little memory, the list is, by…
Tuple Vector iteration, element access and erasion
Programming
Software Development
11 Years Ago
by ktsangop
…! I would like your help regarding this: I have a
tuple
vector which i must iterate through, and accessing the vector… erase or not the current vector element. My code : typedef
tuple
<int, CString, int, int> pc_data; vector <pc_data…
Tuple error
Programming
Software Development
10 Years Ago
by kxjakkk
… (t2.between(t1, t3)) I keep getting an error: `AttributeError: '
tuple
' object has no attribute 'between' ` The traceback says: Traceback (most…, in <module> print t2.between(t1, t3) AttributeError: '
tuple
' object has no attribute 'between' Any help would be great…
Re: Tuple trouble
Programming
Software Development
13 Years Ago
by vegaseat
Well, you are on to something, the
tuple
has changed. However, the id() of the whole
tuple
is still the same after the change. My advice, don't rely blindly on tuples not changing as advertised.
Re: Tuple error
Programming
Software Development
10 Years Ago
by sepp2k
As the error message says, tuples don't have a `between` method, so you can't do `t.between(...)` where `t` is a
tuple
. You can call `between` on `MyTime` objects because you defined a `between` method for the `MyTime` class. So if you create an object of that class (by using `MyTime(...)`), you can call `between` on that object.
Tuple List
Programming
Software Development
19 Years Ago
by bumsfeld
Why is there a
tuple
and list in Python. They seemed to perform similar things.
Re: Tuple List
Programming
Software Development
18 Years Ago
by jrcagle
… the sequence consists of single characters. I think of a
tuple
as a string where each 'character' could be literally any…
Tuple sorting
Programming
Software Development
15 Years Ago
by awa
Hi, I want to sort a
tuple
consisting of two floats and one array by the absolute …
Re: Tuple sorting
Programming
Software Development
15 Years Ago
by Gribouillis
[QUOTE=awa;1016397]Hi, I want to sort a
tuple
consisting of two floats and one array by the absolute …
Tuple trouble
Programming
Software Development
13 Years Ago
by Lardmeister
Tuples are immutable objects, they cannot be changed says the Python manual. [code]my_tuple = (1, 2, 3, [4, 5, 6]) # this works my_tuple[3][2] = 7 # clearly the item at index 3 in the
tuple
has changed print(my_tuple) # (1, 2, 3, [4, 5, 7]) [/code]
Re: Tuple trouble
Programming
Software Development
13 Years Ago
by predator78
Think about the words though. Did you change the
tuple
? Or did you change the item at index of?
Re: Tuple trouble
Programming
Software Development
13 Years Ago
by woooee
[QUOTE=;][/QUOTE] Lists are passed by reference, so the
tuple
contains the memory address of the list, not the list itself, and that doesn't change. Both of these statements will fail [code]my_tuple = (1, 2, 3, [4, 5, 6]) new_list = [4, 5, 6] my_tuple[3] = new_list ## new memory address my_tuple[1] = "a" [/code]
Re: Tuple trouble
Programming
Software Development
13 Years Ago
by TrustyTony
You are changing list, not
tuple
[CODE]>>> my_tuple (1, 2, 3, [4, 5, 6]) >>> type(my_tuple[3]) <class 'list'> >>> id(my_tuple[3]) 14727328 >>> my_tuple[3][2]=7 >>> id(my_tuple[3]) 14727328[/CODE]
Tuple as a Sql parameter
Programming
Software Development
13 Years Ago
by SnackDude
… , WVWHID, WVITNO, WVLOCA FROM WMRSV WHERE OHORNO IN (%s)"%
tuple
(order_list)) TypeError: not all arguments converted during string formatting[/code…
Tuple as Key in Dict Help!
Programming
Software Development
13 Years Ago
by Niner710
Hi, I have a dictionary with the key as a
tuple
. x = { ('AA',1,3):0.56, ('BB',0,3):0.…
Re: Tuple as Key in Dict Help!
Programming
Software Development
13 Years Ago
by jlm699
You could create your own class based on dictionary that checks whether that key already exists in `__setattr__` and then add the value to a list/
tuple
. When you do your `get()` you can then use `isinstance` to act accordingly.
Re: Tuple as Key in Dict Help!
Programming
Software Development
13 Years Ago
by Niner710
… am interested in is the last number of my key
tuple
. With my current d.get(('SET',1,2,1,1…
Arithmetic Tuple?
Programming
Software Development
13 Years Ago
by mike_2000_17
…in the dark: Has anyone heard or seen a
tuple
-like class template that implements all the arithmetic operators…? For example, the std::
tuple
and boost::
tuple
classes both implement all the comparison operators which …compile correctly if all the types contained in the
tuple
also have the comparison operators in question. I …
Compare Tuple Values
Programming
Software Development
15 Years Ago
by khaos64
…passw) users.append(user_in) passw.append(passw_in) users =
tuple
(users) passw =
tuple
(passw) #----------------------------------------------- if user_in in users: users = list…users.index(user_in) ind2 = passw.index(passw_in) users =
tuple
(users) passw =
tuple
(passw) if ind1 == ind2: print('Match') elif ind1…
How to parse numbers as integers in a tuple?
Programming
Software Development
14 Years Ago
by cyon
…Method 1[/B]: I could find the numbers, convert the
tuple
groups() to a list, convert the strings in that …()) ])[/CODE] [B]Method 2[/B]: I could eliminate a
tuple
-to-list conversion with findall, but this method wouldn't… the previous regex pattern: [CODE]pattern = re.compile('\d+') return
tuple
([ int(x) for x in pattern.findall( '34, 58' )])[/…
Re: Arithmetic Tuple?
Programming
Software Development
13 Years Ago
by mike_2000_17
… arithmetic: template <typename... Systems> struct composite_system { //.. typedef std::
tuple
< typename system_traits<Systems>::state_diff_type... > state_diff_type; //.. }; //Now…, SystemB, SystemA> >)); // ERROR: no operator+ for type std::
tuple
<..> // .. and so on for other operators. }; [/CODE] As…
std::tuple and boost::tuple don't support rvalue reference?
Programming
Software Development
13 Years Ago
by stereomatching
… 64bits [CODE] std::string temp = "temp"; boost::
tuple
<std::string> A( std::move(temp) ); //this…> strMove(new std::string("jjjjj")); boost::
tuple
< std::unique_ptr<std::string> > …> strShared(new std::string("wawawa")); boost::
tuple
< std::shared_ptr<std::string> > move_tuple…
Re: Compare Tuple Values
Programming
Software Development
15 Years Ago
by woooee
… = users.index(user_in) ind2 = passw.index(passw_in) users =
tuple
(users) passw =
tuple
(passw) ## but if neither user name or password is… but to use a for() loop to iterate through the
tuple
(s). You can do this two ways, (1) use…name and password, or (2) use a nested
tuple
of tuples containing both name and password, It doesn'…
Re: Arithmetic Tuple?
Programming
Software Development
13 Years Ago
by mike_2000_17
…]> why it is not in the std::
tuple
or boost::tuples::
tuple
class since other operators are already defined (comparison…there was a suggestion to overload the + operator for std::
tuple
<>. Not for element by element arithmetic plus, but…find his way to this thread looking for an arithmetic-
tuple
class template, I have attached it to this post.…
Re: Arithmetic Tuple?
Programming
Software Development
13 Years Ago
by vijayan121
> why it is not in the std::
tuple
or boost::tuples::
tuple
class since other operators are already defined (comparison). IIRC, there… was a suggestion to overload the + operator for std::
tuple
<>. Not for element by element arithmetic plus, but…
Re: Compare Tuple Values
Programming
Software Development
15 Years Ago
by lukerobi
…'] >>> users.append('steve') >>> users =
tuple
(users) >>> users ('bob', 'carl', 'edna', 'steve') >…;>> [/code] You can list it, append it, then
tuple
again without using seperate variables, it wont compromise the list…
Creating a tuple from file
Programming
Software Development
15 Years Ago
by hondros
…. I want to open a file, convert the
tuple
to a long integer, through use of the ord…I now have a string of the above
tuple
. How do I go about reconverting it? Doing …a
tuple
of it just makes it weird... EDIT: Er…... I seem to have my definitions of
tuple
and list confused... these are lists, not tuples. Oh…
1
2
3
17
Next
Last
Search
Search
Forums
Forum Index
Hardware/Software
Recommended Topics
Programming
Recommended Topics
Digital Media
Recommended Topics
Community Center
Recommended Topics
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2025 DaniWeb® LLC